Ecommerce - Weight in variations
In 2014 I added the following topic to PITS:
feedback.telerik.com/.../101311-weight-in-variations
Problem: If you add variations to a product in many cases the weight differs from variation to variation. Therefore there must be an option to adjust the weight per variation.
I can not understand why such a basic feature is not implemented. Furthermore there is no progress in the Ecommerce module at all. When will be there new features?
Hi Christian,
After doing some research into this, we have found this workaround solution that may help you achieve this functionality in Sitefinity, but this will only work if the weight of the product to be purchased will not be entered by the user.
These are the steps to be followed within Sitefinity:
1. Create a product attribute that will be used as the Weight (Please do not use the name Weight for this as it a reserved name for the product and will cause errors)
2. Create the values for the attribute (5,10,15..etc)
3. Create the product variations using the values of the attribute created
After following the previous steps you will need to implement a custom solution where you will extend the EcommerceOrderCalculator and override the CalculateAndSaveChanged() method. You will need to iterate through all items in the cart until you get the product you want to modify. Here you will need to get the variation of the item and get the attribute values found in the Variant property to get the AttributeValueId, but you will need to deserialize this object before doing this. After this you should overwrite the Weight property of the product, with the weight established in the variation.
You will also need to add a Global.asax file and subscribe to the Bootstrapper_Initializer and register your custom class.
You should be able to see the changes to the shipping calculations after applying this solution.
I am attaching files with sample code as a reference for you to use in creating a custom solution to achieve this functionality, please use this at your consideration.
You may also refer to the following article for more details about the custom order calculator:
http://docs.sitefinity.com/tutorial-create-a-custom-order-calculator
Regards,
Sabrie Nedzhip
Telerik