Monday 13 January 2020

Magento Shipping costs using category and weight

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

  1. Add a new condition_name to the CSV named package_weight_category with category id as condition value
  2. Modify the getRate method to find in the DDBB using the categories of the products in the cart and condition_name = 'package_weight_category'
  3. If anything is found save the cost
  4. Subtract the weight of the products of the categories found to the total weight
  5. If weight >0 find the cost of the updated weight and add it to the cost
  6. Return the calculated cost

My questions are

  1. Is this solution functional?
  2. It's possible pass the info of the categories and quantity of the products to the Mage_Shipping_Model_Rate_Request object?
  3. 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