duanhao7786 2014-04-03 03:10
浏览 79
已采纳

Magento“编辑捆绑 - >更新购物车”添加新捆绑而不是更新当前捆绑

Having a weird bug that doesn't seem to be troubling anyone else on the Magento forums or the rest of the web.

When I go to the shopping cart and click "Edit" to change the configuration of a bundle product it takes me to the page

".../checkout/cart/configure/id/<id number>/" 

and I can change the options for the bundle. But when I click the "Update Cart" button at the bottom of the bundle page it adds a brand new bundle to the cart with the configuration I just selected. Obviously I'd rather have it edit the current bundle and I believe it should be doing that - the id number in the URL is obviously meant for this purpose.

Looking at:

design/frontend/base/default/template/checkout/cart/item/configure/updatecart.phtml 

I see it calls for the Update Cart button:

<button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart" onclick="
productAddToCartForm.submit(this)"><span><span><?php echo $buttonTitle ?></span></span></button>

I'm not sure if the fact that it called an AddToCart form rather than maybe an Update form might have something to do with it? The other interesting thing is that if I look at:

app/code/core/Mage/Checkout/controllers/CartController.php

There's a function called "configureAction" - this runs when you go to the /configure url and gets the cart item id. There's another function called "updateItemOptionsAction" - this looks like the one that I want? It doesn't seem to get called though.

Has anyone run into a similar issue? I feel like I'm in the right area but I can't seem to figure out exactly why this wouldn't work out-the-box?

Thanks!

EDIT:

Solution for those looking in the future....:

The file located in {MY SKIN}/template/catalog/product/view.phtml had this code for the add to cart button:

<form action="<?php echo $this->getAddToCartUrl($_product) ?>"

so even with the "Update Cart" button showing correctly, the behaviour of the button would always add to cart rather than update cart. I changed it to this:

<form action="<?php echo $this->getSubmitUrl($_product) ?>" 

And it works! Took a while to diagnose because the default/modern template supplied by Magento actually is incorrect and will always show the add to cart button rather than the update cart button - so when I reverted to a "default" template test behaviour this threw a spanner in the works.

  • 写回答

1条回答 默认 最新

  • dreamlife2014 2014-04-16 03:07
    关注

    I had the same issue as you, plus another minor issue with the button. After a whole lot of searching I eventually found a forum post with a link to the following Magento wiki page:

    http://www.magentocommerce.com/wiki/4_-_themes_and_template_customization/how_do_upgrade_your_template_from_1.4_to_1.5

    In essence, there may be something wrong with your checkout.xml file in your template. I would suggest temporarily remove {YOUR-TEMPLATE}/template/catalog/product/view.html and also temporarily remove {YOUR-TEMPLATE}/layout/checkout.xml , then clear your cache files, then retry and see whether the issue is fixed. If removing those two files fixes the issue, then re-instate them and compare them to the original base versions, and using a process of elimination, figure out which specific sections your own files are missing (or including) incorrectly.

    In my particular case, I was missing the

    <reference name="product.info">
      <block type="checkout/cart_item_configure" name="checkout.cart.item.configure.block"></block>
    </reference>
    

    inside checkout.xml, under the <checkout_cart_configure translate="label"> section, as per the info in that wiki page.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效