Magento "Edit Bundle -> Update Cart" adds new bundle rather than updates current one

StackOverflow https://stackoverflow.com/questions/22827148

  •  26-06-2023
  •  | 
  •  

문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top