Introduced in Feature Pack 2

Modifying the existing Deprecated featureMadisons starter store to expose the day-of-month scheduling option

In this step, you modify the Deprecated featureMadisons starter store JSP and JavaScript files to accept the frequency and the day-of-month parameters for the scheduled recurring order. In particular, you modify the checkout page to accept the day-of-month schedule type.

Procedure

  1. Modify the checkout page JSP to include the every month schedule option with a day-of-month selection box.
    1. In the Enterprise Explorer view, expand Stores > WebContent > Madisons > ShoppingArea > CheckoutSection.
    2. Open the RecurringOrderCheckoutDisplay.jsp file.
    3. Locate the following code:
      <c:when test="${actualInterval == RecurringOrderFrequency6 && actualIntervalUOM == RecurringOrderFrequencyUOM6}">
      	<c:set var="interval" value="6"/>
      </c:when>
      Add the following code immediately after this line:
      <c:when test="${actualInterval == RecurringOrderFrequency1 && actualIntervalUOM == RecurringOrderFrequencyMonthUOM}">
      	<c:set var="interval" value="30"/>
      </c:when>
    4. Find the following <select> element with id="ScheduleOrderFrequency" that lists the frequency options available for scheduling a recurring order: Modify it from
      <select class="drop_down" name="ScheduleOrderFrequency" 
      id="ScheduleOrderFrequency" onchange="this.blur();">
      to
      <select class="drop_down" name="ScheduleOrderFrequency" 
      id="ScheduleOrderFrequency" onchange="this.blur();displayDayOfMonth();">
    5. Add the following code after the last option of the <select> element with id="ScheduleOrderFrequency" to display the Every month option:
      <option value="30" <c:if test="${interval == 30}">selected="selected"</c:if>>
        <fmt:message key="SCHEDULE_ORDER_INTERVAL_7" bundle="${storeText}"/>
      </option>
      
    6. Locate the following code:
      <c:when test="${interval == 6}">
      	<c:out value='${RecurringOrderFrequencyText6}'/>
      </c:when>
      Add the following code immediately after this line:
      <c:when test="${interval == 30}">
      	<fmt:message key="SCHEDULE_ORDER_INTERVAL_7" bundle="${storeText}"/>
      </c:when>
    7. Save the changes.
  2. Modify the JavaScript used in the checkout JSP.
    1. In the Enterprise Explorer view, expand Stores > WebContent > Madisons > javascript > CheckoutArea.
    2. Open the CheckoutHelper.js file.
    3. Locate the following code in prepareOrderSchedule method:
      dojo.cookie(key1, t);
      dojo.cookie(key2, interval);
      Add the following code after the previous section:
      if(interval == "30"){
        var key3 = "WC_ScheduleOrder_" +   
        document.getElementById("orderIdToSchedule").value + 
        "_dayOfMonth";
        var dayOfMonth = dojo.byId("DayOfMonth").value;
        dojo.cookie(key3, dayOfMonth);
      
        var key4 = "WC_ScheduleOrder_" +
      document.getElementById("orderIdToSchedule").value +
      "_duration";
        var duration = dojo.byId("Duration").value;
        dojo.cookie(key4, duration);
      }
    4. Locate the following code in scheduleOrder method:
      else if(dojo.cookie("WC_ScheduleOrder_" + orderId + "_interval") == '6'){
      params["fulfillmentInterval"] = '4';
      params["fulfillmentIntervalUOM"] = 'WEE';
      }
      Add the following code after the previous section:
      else if(dojo.cookie("WC_ScheduleOrder_" + orderId + "_interval") == '30'){
      params["fulfillmentInterval"]='1';
      params["fulfillmentIntervalUOM"] = 'MON';
      params["dayOfMonth"]=dojo.cookie("WC_ScheduleOrder_" + orderId + "_dayOfMonth");
      params["scheduleType"] = 'dayOfMonth';
      if(dojo.cookie("WC_ScheduleOrder_" + orderId + "_duration") != '0'){
      params["timePeriod"]=dojo.cookie("WC_ScheduleOrder_" + orderId + "_duration");
      params["timePeriodUOM"]='MON';
      }
      }
    5. Save the changes.
  3. Copy the RecurringOrderCheckoutDisplayExt.jsp file from temp\Madisons\ShoppingArea\CheckoutSection and paste to Stores\Madisons\ShoppingArea\CheckoutSection directory.
  4. Add the new text in the storetext.properties file.
    1. In the Enterprise Explorer view, expand Stores > Java Resources:src > Madisons.
    2. Open the storetext.properties file.
    3. Add the following properties to the end of the file:
      SCHEDULE_ORDER_INTERVAL_7 = Every Month
      SCHEDULE_ORDER_DAY_OF_MONTH = Day of Month
      SCHEDULE_ORDER_DURATION = Duration
      SCHEDULE_ORDER_X_MONTHS = {0} Months

Results

The following screen captures show the result of the customization.

Add the day of month schedule support on the Shipping and Billing page.

Screen capture showing recurring order
Display the details of the selected day-of-month scheduling on the Order Summary page

Screen capture showing recurring order