How to manually calculate the weight of configurable product
-
16-10-2019 - |
Question
i have the following problem:
when I try to edit an order in Magento, on the initial loading of the edit page,
Mage_Shipping_Model_Rate_Request::getPackageWeight()
returns zero.This behaviour occurs only with configurable products.
My question is how can i calculate manually the total weight of the package. I am using Magento 1.7.0.2 CE. Thanks in advance!
Solution
The weight of quote items is calculated by the shipping total model Mage_Sales_Model_Quote_Address_Total_Shipping
in the collect()
method.
After the item weight is collected, the total model then calls $address->collectShippingRates();
to trigger the shipping rate calculation.
I suggest you look at the loop in the total model mentioned above, where it iterates over each item, to see why a configurable doesn't get a weight value assigned.
The only thing I can think of without further access is that maybe you have a sales rule in place that sets free_shipping
on the quote item.
Before you wonder, the weight_type
attribute is only used for bundled
products to indicate if the total weight should be fixed or calculated dynamically from the associated products.