添加到购物车按钮不工作-拒绝获得不安全的标题"X-JSON"
Add to cart button not working - Refused to get unsafe header "X-JSON"
我的"添加到购物车"按钮突然停止工作。我不知道为什么,因为我没有做任何改变。我正在使用Magento版本1.7。
这是我的网站链接- http://www.bridalhotspot.co.uk/。
当你点击"添加到购物车"时,通常你会得到"继续购物"或"进入购物车"的选项,但由于某种原因,它现在只给出了"继续购物"的选项,而没有将产品添加到购物车中。
这是我的addtocart.phtml
文件中的代码:
<?php $_product = $this->getProduct(); ?>
<?php $buttonTitle = $this->__('Add to Cart'); ?>
<?php if($_product->isSaleable()): ?>
<div class="add-to-cart">
<?php if(!$_product->isGrouped()): ?>
<label for="qty"><?php echo $this->__('Qty:') ?></label>
<input type="text" name="qty" id="qty" maxlength="12" value="<?php echo
$this>getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>" class="input- text qty" />
<?php endif; ?>
<button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><span><span><?php echo $buttonTitle ?></span></span></button>
<?php echo $this->getChildHtml('', true, true) ?>
</div>
<?php endif;
?>
编辑:我收到以下错误在我的控制台- Refused to get unsafe header "X-JSON"
时,试图添加到购物车。
Refused to get unsafe header "X-JSON" prototype.js:1637
Ajax.Request.Class.create.getHeader prototype.js:1637
Ajax.Response.Class.create._getHeaderJSON prototype.js:1714
Ajax.Response.Class.create.initialize prototype.js:1675
klass prototype.js:101
Ajax.Request.Class.create.respondToReadyState prototype.js:1595
Ajax.Request.Class.create.onStateChange prototype.js:1545
(anonymous function)
try this
onclick="setLocation('<?php echo Mage::helper('checkout/cart')->getAddUrl($product); ?>')"
尝试启用"在前端使用安全url ",查看系统->配置->通用-> Web ->安全-> "在前端使用安全url "
相关文章:
- CORS保持在SecurityError上:操作不安全
- createObjectURL blob url在Firefox中不安全
- 地理定位API从Chrome 50中的不安全来源中删除
- 为什么流星会被认为是不安全的
- SecurityError:操作在canvas.toDataURL中不安全
- Mootools:拒绝设置不安全的标头“;连接”;
- Chrome for bookmarlet 中的“不安全内容”
- 为什么内联 JS 块不安全
- jQuery:Javascript抛出错误“;操作不安全”;设置值时
- AngularJS-ngBindHtml和'不安全'html
- HTML5历史API-操作不安全
- 刚将我的网站移到ssl,但我有不安全的内容
- 角度相加“;“不安全”;在尝试下载文件时将其转换为url
- Chrome扩展:不安全的JavaScript尝试访问具有URL的框架域、协议和端口必须匹配
- Safari 7,Mac OS X:确定Java是否处于'不安全'模式
- 操作不安全-watermark.js
- 在我的站点中实现了CSP,但第三方库使用内联javascript.我可以选择性地允许'不安全的内联'
- "不安全的JavaScript尝试访问URL为..的帧"使用本地文件
- Firefox扩展中的localStorage抛出“;操作不安全"例外
- 得到"操作不安全”;通过tinymce添加tinymce时出错.EditorManager.execComma