More in this section

Forums / General Discussions / Ecommerce - Weight in variations

Ecommerce - Weight in variations

2 posts, 0 answered
  1. Christian
    Christian avatar
    23 posts
    31 Jul 2008
    29 Jun 2015
    Link to this post

    In 2014 I added the following topic to PITS:

    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?

  2. Sabrie Nedzhip
    Sabrie Nedzhip avatar
    534 posts
    17 Aug 2017
    01 Jul 2015
    Link to this post
    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:

    Sabrie Nedzhip
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
2 posts, 0 answered