IE8中的Magento产品页面:添加到购物车的增量默认值,忽略数量字段.Form.js第266行错误
Magento product page in IE8: add to cart increments by default value, ignoring quantity field. form.js line 266 errors
默认的form.js文件似乎是错误的,当"添加到购物车"被点击。这将阻止正确传递数量字段的值。Magento代替默认值。这个脚本不会出错,数量字段在其他浏览器中也能正常工作。
此外,当我切换回默认主题时,添加到购物车按钮可以正常工作。你知道我该从哪里开始吗。这里有什么不适合IE8的地方吗?我没有修改任何添加到购物车的函数,也没有修改form.js文件。
更新:我有一个browserstack帐户。调试显示VarienForm是未定义的,抛出两个"'productAddToCartForm'是null或不是一个对象"错误。定义VarienForm的Form.js被加载到header中,所以它应该可以用于内联JS。
因为你看不到行号,这里是有问题的行:
this.regionSelectEl.options.add(option);
函数如下:
update: function()
{
if (this.regions[this.countryEl.value]) {
var i, option, region, def;
def = this.regionSelectEl.getAttribute('defaultValue');
if (this.regionTextEl) {
if (!def) {
def = this.regionTextEl.value.toLowerCase();
}
this.regionTextEl.value = '';
}
this.regionSelectEl.options.length = 1;
for (regionId in this.regions[this.countryEl.value]) {
region = this.regions[this.countryEl.value][regionId];
option = document.createElement('OPTION');
option.value = regionId;
option.text = region.name.stripTags();
option.title = region.name;
if (this.regionSelectEl.options.add) {
this.regionSelectEl.options.add(option); //***this is line 266***
} else {
this.regionSelectEl.appendChild(option);
}
if (regionId==def || (region.name && region.name.toLowerCase()==def) ||
(region.name && region.code.toLowerCase()==def)
) {
this.regionSelectEl.value = regionId;
}
}
if (this.disableAction=='hide') {
if (this.regionTextEl) {
this.regionTextEl.style.display = 'none';
}
this.regionSelectEl.style.display = '';
} else if (this.disableAction=='disable') {
if (this.regionTextEl) {
this.regionTextEl.disabled = true;
}
this.regionSelectEl.disabled = false;
}
this.setMarkDisplay(this.regionSelectEl, true);
} else {
if (this.disableAction=='hide') {
if (this.regionTextEl) {
this.regionTextEl.style.display = '';
}
this.regionSelectEl.style.display = 'none';
Validation.reset(this.regionSelectEl);
} else if (this.disableAction=='disable') {
if (this.regionTextEl) {
this.regionTextEl.disabled = false;
}
this.regionSelectEl.disabled = true;
} else if (this.disableAction=='nullify') {
this.regionSelectEl.options.length = 1;
this.regionSelectEl.value = '';
this.regionSelectEl.selectedIndex = 0;
this.lastCountryId = '';
}
this.setMarkDisplay(this.regionSelectEl, false);
}
区域选择应该只在购物车或结帐时触发。检查你的模板是否在skin/frontend/your_theme/js
中使用了自己的JS-Files。我认为你的模板是为不同的Magento版本制作的,所以你的html文件中的css选择器不再适合JS了。所以你要么使用匹配JS-Files,要么将你的产品模板与基本模板中的产品模板进行比较,并调整CSS类。
相关文章:
- 我的shareService在angular 2中发送值工作正常,但当我渲染我的另一个组件时,会获得默认值
- jquerydatetimepicker日期和时间应在框默认值中,而无需单击框
- 如果值为空,如何设置输入的默认值?jQuery
- 骨干模型默认值-todos.js示例中不必要的代码
- jquery日期选择器年份范围默认值
- Html5输入属性的默认值,如最小值、最大值、大小等
- 根据两个下拉列表的默认值禁用按钮
- 如何创建具有默认值的JavaScript对象字段?(AngularJS模型相关)
- Angularjs-设置不带ng选项的select的默认值
- jQuery Datepicker从日期开始设置默认值
- 如何设置浏览器打开的文件对话框的文件名(一些默认值)
- JQuery BlockUI鼠标加载光标没有't在Google Chrome中返回默认值
- Selectize选择默认值
- 在KeystoneJS中为Types.Money设置默认值
- 是否可以同时为一个元素的所有事件指定阻止默认值
- 防止在IE7中按回车键时出现默认值
- 如何覆盖jqGrid's语言默认值
- 如何为显示jquery滑块值的文本框设置默认值
- IE8中的Magento产品页面:添加到购物车的增量默认值,忽略数量字段.Form.js第266行错误
- 回送,Angular:如何在form中设置默认值