2

这是一个 BigCommerce 网站。我需要收集每个产品的交货日期信息,因此我添加了一个 jQuery 日期选择器和一些单选按钮,供客户选择他们想要的交货日期。(见屏幕截图)。

我想知道是否可以为将添加到产品总价中的每个选项分配货币价值,并且在提交订单后,将所选选项与其他订单详细信息一起传递。

我不确定它是否非常相关,但也粘贴了我的 HTML 和 datepicker 代码。

免责声明:我不熟悉 BigCommerce API,但如果这是唯一的方法,我愿意尝试一下。否则,有人告诉我一些 jQuery 或 javascript 可能是我最好的选择。但是,我在这两个方面都是新手,如果这是要走的路,请尽可能具体地回答您的问题。非常感激。

在此处输入图像描述

    <script type="text/javascript">
    $(document).ready(function() {

    //holidays
    var natDays = [
      [1, 1, 'New Year'], //2014
      [1, 20, 'Martin Luther King'], //2014
      [2, 17, 'Washingtons Birthday'], //2014       
      [5, 26, 'Memorial Day'], //2014
      [7, 4, 'Independence Day'], //2014
      [9, 1, 'Labour Day'], //2014
      [10, 14, 'Columbus Day'], //2013
      [11, 11, 'Veterans Day'], //2013
      [11, 28, 'Thanks Giving Day'], //2013 
      [12, 25, 'Christmas'] //2013     
];

    var dateMin = new Date();
    dateMin.setDate(dateMin.getDate() + (dateMin.getHours() >= 14 ? 1 : 0));
    AddBusinessDays(dateMin, 4);

    function AddBusinessDays(curdate, weekDaysToAdd) {
        while (weekDaysToAdd > 0) {
            curdate.setDate(curdate.getDate() + 1);
            //check if current day is business day
            if (noWeekendsOrHolidays(curdate)[0]) {
                weekDaysToAdd--;
            }
        }
    }    

    function noWeekendsOrHolidays(date) {
        var noWeekend = $.datepicker.noWeekends(date);
        if (noWeekend[0]) {
            return nationalDays(date);
        } else {
            return noWeekend;
        }
    }
    function nationalDays(date) {
        for (i = 0; i < natDays.length; i++) {
            if (date.getMonth() == natDays[i][0] - 1 && date.getDate() == natDays[i][1]) {
                return [false, natDays[i][2] + '_day'];
            }
        }
        return [true, ''];
    }
      $('#datepicker').datepicker({ 
            inline: true,
            beforeShowDay: noWeekendsOrHolidays,           
            showOn: "both",            
            firstDay: 0,
                dateformat: "dd/mm/yy",
            changeFirstDay: false,
            showButtonPanel: true,       
            minDate: dateMin            
    });
  });
  </script>

<p>
<label for="datepicker">Desired Delivery Date: </label>
  <input type="text" id="datepicker" placeholder="ex. 01/01/2013" name="properties[Delivery Date]" readonly />
  <label><font size=1>Need it faster? Call us! (800) 880-0307</font>
  </label></p>
<style>
  #datepicker { height: 17px; max-width: 120px; }
  #datepicker {-webkit-border-radius: 0 3px 3px 0; -moz-border-radius: 0 3px 3px 0; border-radius: 0 3px 3px 0;}
</style>

收音机选项的 HTML:

 <p style="margin-top: 15px; margin-left: 40px;"><font size=3>Please Choose From Delivery Options:</font></p>   
    <br>                                                             
    <label for="Standard" style=" margin-left: 40px;">
    <input id="Standard" type="radio" name="properties[Delivery]" value="Standard Shipping" />
    <font>Standard Shipping</font><br>
    <p>
    <font size=1 style="margin-left: 18px;">Earliest Date of Delivery: 
    <span id="delivery-date">Estimated Date from Datepicker</span></font>
    </p>
    </label>
    {datepicker goes here}                                   
    <hr style=" margin-left: 40px;"> 
     <br>                                                            
     <label for="3DayExpress" style=" margin-left: 40px;">
     <input id="3DayExpress" type="radio"name="properties[Delivery]" value="3Day Express" />
     <font>Guaranteed by <script>document.write(d_names[curr_day] + " " + m_names[curr_month] + " " + curr_date + "<SUP>"
                                + sup + "</SUP> " + curr_year);</script>.<br></font><font size=1 style="margin-left: 18px;">3 Day Express Shipping. Additional $15</font>                  </label>
    <br>                                                             
    <label for="2DayExpress" style=" margin-left: 40px;">
    <input id="2DayExpress" type="radio" name="properties[Delivery]" value="2Day Express" />
    <font>Guaranteed by <script>document.write(d_names[curr_day] + " " + m_names[curr_month] + " " + curr_date + "<SUP>"
                                + sup + "</SUP> " + curr_year);</script>.<br></font><font size=1 style="margin-left: 18px;">2 Day Express Shipping. Additional $25</font>
   </label><br>
4

0 回答 0