dsk95913 2014-07-29 11:57
浏览 20

添加到购物车按钮目录搜索网格破碎

I have a magento store where the Add to Cart button has stopped working and instead a search query is performed ( where the & are changed to &amp so it doesn't even work ) This can be seen by adding a item to cart here: http://bit.ly/1o8SwmE

This add to cart button does however work on category grid pages. I have tried pasting the link generated in the form into a web browser and it also redirects me to the same broken search page, I have also tried pasting the action link from the add to cart form on a working category grid page into firebug on the non working page and this then adds the product from the category page perfectly.

The snippets of code i have used are pasted below and other people have had them working it seems so this may not be the issue.

    OLD CODE
<form action="<?php echo $this->getAddToCartUrl($_product) ?>" method="post" id="product_addtocart_form_<?php echo $_product->getId()?>"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>
    <?php if(!$_product->isGrouped()): ?>
    <label for="qty"><?php echo $this->__('QTY') ?>:</label>
    <input type="text" name="qty" id="qty" class="new-qty-cat" value="<?php echo ($this->getMinimalQty($_product)?$this->getMinimalQty($_product):1) ?>" />
    <?php endif; ?>
    <button class="new-qty-button" type="button" onclick="this.form.submit()"></button>
</form>
    <?php else: ?>
    <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
    <?php endif; ?>

    NEW CODE
<form action="<?php echo $this->getAddToCartUrl($_product) ?>" method="post" id="product_addtocart_form_<?php echo $_product->getId(); ?>">
    <input name="qty" type="text" class="input-text qty" id="qty" maxlength="12" value="<?php echo $this->getMinimalQty($_product) ?>" />
    <button class=form-button" onclick="productAddToCartForm_<?php echo $_product->getId(); ?>.submit()"><span><?php echo $this->__('Add to Cart') ?></span></button>
</form>
<script type="text/javascript"> var productAddToCartForm_<?php echo $_product->getId(); ?> = new VarienForm('product_addtocart_form_<?php echo $_product->getId(); ?>');    productAddToCartForm_<?php echo $_product->getId(); ?>.submit = function(){ if (this.validator.validate()) {    this.form.submit(); }   }.bind(productAddToCartForm_<?php echo $_product->getId(); ?>);</script>

    NEW CODE 2
<form action="<?php echo $this->getAddToCartUrl($_product) ?>" method="post" id="product_addtocart_form_<?php echo $_product->getId()?>"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>
    <?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->getMinimalQty($_product)?$this->getMinimalQty($_product):1) ?>" />
    <?php endif; ?>
    <button type="button" onclick="this.form.submit()"><span><span><span><?php echo $this->__('Add to Cart') ?></span></span></span></button>
</form>


    New Code 3
    <form action="<?php echo $this->getAddToCartUrl($_product) ?>" method="post" id="product_addtocart_form_<?php echo $_product->getId()?>"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>
<?php if(!$_product->isGrouped()): ?>
<label for="qty"><?php echo $this->__('Qty') ?>:</label>
<input class="new-qty-cat" type="text" name="qty" id="qty" maxlength="12" value="<?php echo ($this->getMinimalQty($_product)?$this->getMinimalQty($_product):1) ?>" />
<?php endif; ?>
<button type="button" class="new-qty-button" onclick="this.form.submit()"><span><span>   </span></span></button>
   </form>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 求视频摘要youtube和ovp数据集
    • ¥15 怎么改成输入一个要删除的数后现实剩余的数再输入一个删除的数再现实剩余的数用yes表示继续no结束程序
    • ¥15 在启动roslaunch时出现如下问题
    • ¥15 汇编语言实现加减法计算器的功能
    • ¥20 关于多单片机模块化的一些问题
    • ¥30 seata使用出现报错,其他服务找不到seata
    • ¥35 引用csv数据文件(4列1800行),通过高斯-赛德尔法拟合曲线,在选取(每五十点取1点)数据,求该数据点的曲率中心。
    • ¥20 程序只发送0X01,串口助手显示不正确,配置看了没有问题115200-8-1-no,如何解决?
    • ¥15 Google speech command 数据集获取
    • ¥15 vue3+element-plus页面崩溃