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.

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

报告相同问题?

悬赏问题

  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line