Javascript BigCommerce自定义字段将影响价格
这是一个大型商业网站。我需要收集每个产品的交货日期信息,因此我添加了一个jQuery datepicker和一些单选按钮,供客户选择他们想要的交货日期。(见屏幕截图) 我想知道是否有可能为每个选项指定货币价值,这些货币价值将添加到产品总价中,并且,一旦提交订单,将所选选项与其他订单细节一起传递 我不确定它是否非常相关,但也粘贴了我的HTML和datepicker代码 免责声明:我不熟悉BigCommerceAPI,但如果这是唯一的方法,我愿意尝试一下。否则,一些jQuery或javascript就是我被告知的可能是我的最佳选择。然而,我在这两方面都是新手,所以,如果是这样的话,请尽可能具体地回答。非常感谢Javascript BigCommerce自定义字段将影响价格,javascript,jquery,bigcommerce,Javascript,Jquery,Bigcommerce,这是一个大型商业网站。我需要收集每个产品的交货日期信息,因此我添加了一个jQuery datepicker和一些单选按钮,供客户选择他们想要的交货日期。(见屏幕截图) 我想知道是否有可能为每个选项指定货币价值,这些货币价值将添加到产品总价中,并且,一旦提交订单,将所选选项与其他订单细节一起传递 我不确定它是否非常相关,但也粘贴了我的HTML和datepicker代码 免责声明:我不熟悉BigCommerceAPI,但如果这是唯一的方法,我愿意尝试一下。否则,一些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>
$(文档).ready(函数(){
//假日
var natDays=[
[1,1,‘新年’,//2014
[1,20,《马丁·路德·金》,//2014
[2,17,‘华盛顿的生日’],//2014年
[5,26,‘阵亡将士纪念日’,//2014
[7,4,‘独立日’],//2014年
[9,1,“劳动节”],//2014年
[10,14,‘哥伦布日’,//2013年
[11,11,‘退伍军人日’,//2013年
[11,28,‘感恩节’,//2013
[12,25,‘圣诞节’//2013
];
var dateMin=新日期();
dateMin.setDate(dateMin.getDate()+(dateMin.getHours()>=14?1:0);
add工作日(dateMin,4);
函数AddBusinessDays(curdate、weekDaysToAdd){
而(工作日添加>0){
curdate.setDate(curdate.getDate()+1);
//检查当前日期是否为工作日
如果(noWeekendsOrHolidays(curdate)[0]){
平日添加--;
}
}
}
函数noWeekendsOrHolidays(日期){
var noWeekend=$.datepicker.noWeekends(日期);
if(noWeekend[0]){
返回国家日(日期);
}否则{
立即返回;
}
}
功能国家日(日期){
对于(i=0;i
#日期选择器{高度:17px;最大宽度:120px;}
#日期选择器{-webkit边界半径:0 3px 3px 0;-moz边界半径:0 3px 3px 0;边界半径:0 3px 3px 0;}
收音机选项的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>
请从交付选项中选择:
标准装运
最早交货日期: 来自日期选择器的估计日期 {datepicker在这里运行}
由文件保证。书写(d_名称[当前日期]+“”+m_名称[当前月份]+“”+curr\u日期+“”) +sup+“”+当前年份)
3天快递。额外15美元
由文件保证。书写(d_名称[当前日期]+“”+m_名称[当前月份]+“”+curr\u日期+“”) +sup+“”+当前年份)
2天快递。额外25美元
那是什么JS?看起来不像BC。