我的"添加到购物车"按钮突然停止工作。我不知道为什么,因为我没有做任何改变。我正在使用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 "