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 shipping_tablerate
database table includes a cost
field, which is populated in the Mage_Shipping_Model_Carrier_Tablerate
object during the collectRates
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 Mage_Shipping_Model_Rate_Request
object to pass into collectRates()
. That seems unnecessarily inefficient given that the data is already loaded from the table and should be accessible.
I have tried Observing the <shipping_carrier_tablerate_load/>
event, but it seems that the _load
event is not thrown for that model.
I have also tried accessing the rate from the quote:
$quote = Mage::getSingleton('checkout/cart')->getQuote();
$address = $quote->getShippingAddress();
$rate = $address->getShippingRateByCode($code ='tablerate_bestway');
I can see the calculated price
, however cost
is not present in that model.
At this stage, I'm running out of ideas. Any suggestions gratefully received!
Thanks, Jonathan