Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

table rate shipping getPrice() not using latest cart content
 
mediaplay
Jr. Member
 
Total Posts:  1
Joined:  2009-07-06
 

I’m having this strange problem:

I am using “table rate” shipping, with shipping dependent on weight.

I added a function that is tied to the event “checkout_cart_update_items_after” (did that through the config.xml of the new module containing the function).

Now, the problem occurs when the client increases the Qty of an item in the cart page, crossing to a higher shipping rate in the table of shipping rates.

The function is being called by the event dispatcher. Accessing the cart using various ‘get...()’ methods shows it as updated, however the getPrice() for the table rate shipping still computes the price for the previous shipping weight!

I am using the following code to iterate over the shipping method prices within the called function:

$_shippingRateGroups = Mage::getSingleton(’checkout/session’)->getQuote()->getShippingAddress()->getGroupedAllShippingRates();
foreach ($_shippingRateGroups as $code => $_rates):
$that = Mage::getSingleton(’checkout/session’);
Mage::log("add_default_shipping: shipping price for “.$code.”: “.count($_rates).” + “.$_rates[0]->getPrice());
endforeach;

Any ideas why the getPrice() method for table rate doesn’t compute new rate based on updated quantities, even though it is called as part of the checkout_cart_update_items_after event ?

Thanks !

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top