#StackBounty: #magento-1.9 #shipping-methods #calendar Which file controls the 3. Shipping Method during checkout?

Bounty: 50

Magento 1.9.4
Porto theme

I am trying to setup a 2nd flat rate shipping method as per here:

How to add another flat rate shipping option?

and I’m already having problems with that which I wonder if they have to do with some difference in Magento version 1.9.1 versus 1.9.4?

Anyways, once I get that added on (we use one flat rate shipping price for deliveries in the city and another rate for everything outside our city), I previously setup a calendar from Amasty on the shipping page of the check-out.

Given the 2 scenarios:

  1. flat rate for DELIVERIES in the city
  2. flat rate for shipping outside the city

The calendar was used for only the local delivery option #1 in our city. Customers were getting confused, however, and they were selecting a date from the calendar for the nationwide delivery (option #2). So someone helped me set it up in such a way that the calendar would appear ONLY when the customer selected option #1. This was in our Magento 1.9.1 version. We just setup with a new install on Magento 1.9.4 and I cannot remember which file had those modifications.

What file/files could I possibly look for on our old Magento 1.9.1 system that would be responsible for this? (would potentially had that modified code to make the calendar appear/disappear based on which shipping option is selected?)

I know we spent a lot of time making this modification and my goal is to identify which file has that code and just copy that over from my old Magento 1.9.1 install into the Magento 1.9.4 new installation.


Get this bounty!!!

#StackBounty: #shipping-methods #calendar Which file controls the 3. Shipping Method during checkout?

Bounty: 50

Magento 1.9.4
Porto theme

I am trying to setup a 2nd flat rate shipping method as per here:

How to add another flat rate shipping option?

and I’m already having problems with that which I wonder if they have to do with some difference in Magento version 1.9.1 versus 1.9.4?

Anyways, once I get that added on (we use one flat rate shipping price for deliveries in the city and another rate for everything outside our city), I previously setup a calendar from Amasty on the shipping page of the check-out.

Given the 2 scenarios:

  1. flat rate for DELIVERIES in the city
  2. flat rate for shipping outside the city

The calendar was used for only the local delivery option #1 in our city. Customers were getting confused, however, and they were selecting a date from the calendar for the nationwide delivery (option #2). So someone helped me set it up in such a way that the calendar would appear ONLY when the customer selected option #1. This was in our Magento 1.9.1 version. We just setup with a new install on Magento 1.9.4 and I cannot remember which file had those modifications.

What file/files could I possibly look for on our old Magento 1.9.1 system that would be responsible for this? (would potentially had that modified code to make the calendar appear/disappear based on which shipping option is selected?)

I know we spent a lot of time making this modification and my goal is to identify which file has that code and just copy that over from my old Magento 1.9.1 install into the Magento 1.9.4 new installation.


Get this bounty!!!

Week of Day String to INT

To change a Day of the week like Monday, Tuesday and so on to integer the use the following code:

  public int dayNameComparison(String dayName) {
           java.text.DateFormatSymbols objDaySymbol = new java.text.DateFormatSymbols();
           String symbolDayNames[] = objDaySymbol.getWeekdays();
           for (int countDayname = 0; countDayname < symbolDayNames.length;countDayname++) {
                if (dayName.equalsIgnoreCase(symbolDayNames[countDayname])) {
                      return countDayname;
                   }
               }
             return 0;
          }

 

This way when u pass the day as parameter the you will get the output as integer. This output can be used directly in Calendar class as input :

 

public static void main(String[] args) {
         TestMouse testMouse = new TestMouse();
         int i = testMouse.dayNameComparison("Tuesday");
         System.out.println("" + i);
         java.util.Calendar calendar = java.util.Calendar.getInstance();
         calendar.set(java.util.Calendar.DAY_OF_WEEK, i);
         System.out.println(new java.text.SimpleDateFormat("EEEE").format(calendar.getTime()));//Prints: Tuesday
}

xsd:date maps to java.util.Calendar

My schema has an element of type xs:date, which jaxb maps to a java.util.Calendar. If I create a Calendar object with Calendar.getInstance(), it marshalls to “2003-11-24-05:00”.

How can I get it to marshall to just “2003-11-24”?

SOLUTION:
Write a converter class (see MyConverter below) and added an annotation/appinfo to the xml schema, also shown below.

public class MyConverter
{
static final SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
static public String printCalendar(Calendar c)
{
return df.format(c.getTime());
}

static public Calendar parseCalendar(String c) throws ParseException
{
Date d = df.parse(c);
Calendar cal = Calendar.getInstance();
cal.setTime(d);
return cal;
}
}




<jaxb:globalBindings
<jaxb:javaType name="java.util.Calendar" xmlType="xsd:date"
printMethod="MyConverter.printCalendar"
parseMethod="MyConverter.parseCalendar"
/>



...

Source : https://forums.oracle.com/forums/thread.jspa?threadID=1624090