I'm working with magento 1.9.3 and need to change the shipping costs calculation based on table rate to use weight and category vs destination in the same table rate.
I have some products need to add extra cost based on category vs destination and the rest of products use the normal weight vs destination shipping cost calculation.
Before start coding i would like to have a different approach to find an easy and clean solution to this.
By now this is the idea
- Add a new
condition_name
to the CSV namedpackage_weight_category
with category id ascondition value
- Modify the getRate method to find in the DDBB using the categories of the products in the cart and
condition_name = 'package_weight_category'
- If anything is found save the cost
- Subtract the weight of the products of the categories found to the total weight
- If
weight >0
find the cost of the updated weight and add it to the cost - Return the calculated cost
My questions are
- Is this solution functional?
- It's possible pass the info of the categories and quantity of the products to the
Mage_Shipping_Model_Rate_Request
object? - Any better solution or different approach to solve this?
Thanks in advance just for reading
from Magento Shipping costs using category and weight
No comments:
Post a Comment