Accessing shipping cost in Magento's cart and/or checkout

fossilRMW

New Member
Please note, this question is regarding the shipping cost, not price. There is an important difference, i.e. what $$ charge the shipping method incurs for the store owner, as opposed to what is $$ charge is paid by the customer. The \[code\]shipping_tablerate\[/code\] database table includes a \[code\]cost\[/code\] field, which is populated in the \[code\]Mage_Shipping_Model_Carrier_Tablerate\[/code\] object during the \[code\]collectRates\[/code\] method. However, that field is not accessible anywhere else in the stack, e.g. from a quote's address. I need to access that value on the cart page, and I can't find anyway to achieve it, other than to instantiate a \[code\]Mage_Shipping_Model_Rate_Request\[/code\] object to pass into \[code\]collectRates()\[/code\]. That seems unnecessarily inefficient given that the data is already loaded from the table and should be accessible. I have tried Observing the \[code\]<shipping_carrier_tablerate_load/>\[/code\] event, but it seems that the \[code\]_load\[/code\] event is not thrown for that model. I have also tried accessing the rate from the quote: \[code\]$quote = Mage::getSingleton('checkout/cart')->getQuote();$address = $quote->getShippingAddress();$rate = $address->getShippingRateByCode($code ='tablerate_bestway');\[/code\]I can see the calculated \[code\]price\[/code\], however \[code\]cost\[/code\] is not present in that model.At this stage, I'm running out of ideas. Any suggestions gratefully received!Thanks,Jonathan
 
Back
Top