+1-888-365-2779
Try Now
More in this section

Forums / Ecommerce / Product Attribute/Variation Applies to Total - After Quantity is Calculated

Product Attribute/Variation Applies to Total - After Quantity is Calculated

11 posts, 0 answered
  1. Brandon
    Brandon avatar
    19 posts
    Registered:
    16 Jan 2013
    08 Feb 2013
    Link to this post

    Hello,

    I've been unable to find a way to achieve this. Hoping someone may have some experience, know a plugin, or have a clever idea...

    With product attributes/variations we can add the ability for a product to be altered and that alteration comes with a price increase.

    So we have:

    • Product A = $100
    • Product A (gift wrapped) = $100 + $10

    So above, if you ordered a quantity of 3, the first item would come to $300, and the second would come to $330.

    But, what if "gift wrapping" only cost $10 no matter what the quantity was... And we actually need the second option above to total $310.

    TotalItemPrice = (3 x 100) + 10

    Is there a way to achieve this? 

    Thanks,
    Brandon

  2. Brandon
    Brandon avatar
    19 posts
    Registered:
    16 Jan 2013
    09 Feb 2013 in reply to Brandon
    Link to this post

    Also, for the record, I'm on Sitefinity 5.2.

  3. Brandon
    Brandon avatar
    19 posts
    Registered:
    16 Jan 2013
    12 Feb 2013
    Link to this post

    We've heard from Telerik on this, and it sounds like the next release of Sitefinity may allow us to control pricing a bit more. However, timing on that is not going to be good for us.

    We've not yet had any cleaver ideas on how to solve this in Sitefinity 5.2... If anyone has an idea, we'd really appreciate your thoughts.

    Thanks,
    Brandon

  4. Randy Hodge
    Randy Hodge avatar
    96 posts
    Registered:
    03 Nov 2014
    12 Feb 2013
    Link to this post
    Hi Brandon,

    One possible solution for you would be to make a hidden product for gift wrapping. Then using the techniques described here, add a giftwrap checkbox to the checkout and add the giftwrap product to the cart if it is checked.

    Kind regards,
    Randy Hodge
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  5. Brandon
    Brandon avatar
    19 posts
    Registered:
    16 Jan 2013
    14 Feb 2013 in reply to Randy Hodge
    Link to this post

    Randy,

    Thanks for your comments! It has taken me a while to get my head wrapped around this one... So you're recommending we create a generic "Gift Wrapping" product that costs $10, and then by adding a checkbox to the product itself we will be able to do two things:

    1. Recognize which products in the order have had a "Gift Wrapping" checkbox checked
    2. Trigger an add-to-cart function that simultaneously adds a second item to the cart, which is the "Gift Wrapping" product.

    So, in the case that a user buys Products A, B (wrapped), C, and D (wrapped), the final order would look like this:

    • Product A [Qty 1] = $100 x 1
    • Product B (wrapped) [Qty 3] = $100 x 3
    • Product C [Qty 2] = $100 x 2
    • Product D (wrapped) [Qty 1] = $100 x 1
    • Gift Wrapping [Qty 2] = $10 x 2

    So that totals $720. Two products were wrapped, thus $20, and the quantity of those two ignored (as I requested in my use-case scenario).

    I think that could work. A tad odd for the user-experience, but I think it's ultimately understandable. The people invoicing the order will get the right amount, and thanks to the product checkbox, the people fullfilling the orders should recognize which items were requested for gift wrapping.

    So the big question... How would we hook up an add-to-cart trigger that simultaneously adds a second product to the cart?

    Thanks,
    Brandon

  6. Randy Hodge
    Randy Hodge avatar
    96 posts
    Registered:
    03 Nov 2014
    18 Feb 2013
    Link to this post
    Hello Brandon,

    You can inherit from the AddToCart widget and override InitializeControls to subscribe to your own event for the button click. There you can check the product for gift wrapping and add the GiftWrap product to the cart or increment it's quantity if it's already there.

    Regards,
    Randy Hodge
    the Telerik team
  7. Brandon
    Brandon avatar
    19 posts
    Registered:
    16 Jan 2013
    19 Feb 2013 in reply to Randy Hodge
    Link to this post

    Randy,

    I appreciate your help so far.

    We're unable to implement your suggestion because we don't know how to hook into the correct processes, and we can't find any sample code of how to do it.

    The "Add to Cart" widget seems to be unaware of the rest of the custom fields on the page at the time it is used -- it uses an AJAX call to add to cart. But we are unaware of a better hook in the processes of adding to the cart where we could check the products custom value settings.

    We also couldn't find sample code for how to programmatically add a product to the shopping cart (or increment it's quantity).

    Sample code seems sparse online, and the documentation doesn't get this detailed.

    Any help is appreciated!

    Brandon

  8. Brandon
    Brandon avatar
    19 posts
    Registered:
    16 Jan 2013
    19 Feb 2013 in reply to Brandon
    Link to this post

    I think we have it functional, in most respects now. I'll post more details after we know for sure, and finish testing.

    However, we've found that this solution poses a "can of worms" of other things to consider... Such as, what if the user removes the original item that was set to be gift-wrapped once they make it to the checkout page? And it allows the new hidden "Gift Wrapping" product to be treated as any other, where it can be removed at checkout, but it is disconnected from the original item which is still "flagged" for gift-wrapping. A potential whole for getting the wrapping without paying for it...

    Just some thoughts, if anyone else is trying to do this.

  9. Gregg
    Gregg avatar
    20 posts
    Registered:
    22 Jan 2013
    20 Feb 2013 in reply to Randy Hodge
    Link to this post

    Randy, You mention creating a Hidden product. Can you explain how to do that. We've created the product but It's showing up in our site as a valid product. If I make it inactive then the shopping cart does a lot of unwanted stuff including not adding the product price to the total.

    How can we make the product not visible to shoppers. 

  10. Randy Hodge
    Randy Hodge avatar
    96 posts
    Registered:
    03 Nov 2014
    22 Feb 2013
    Link to this post
    Hello Brandon,

    What you will need to try is leave the Gift Wrap product active and remove it from the ProductMasterList.

    To do that, create a new class that inherits from ProductsMasterView and overrides the GetDataSource method.
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using Telerik.Sitefinity.Modules.Ecommerce.Catalog.Web.UI.Views;
    using Telerik.Sitefinity.Ecommerce.Catalog.Model;
    using Telerik.Sitefinity.Model;
       
    namespace SitefinityWebApp
    {
        public class ProductsMasterViewCustom : ProductsMasterView
        {
            protected override IList<Product> GetDataSource()
            {
                IList<Product> prodList = base.GetDataSource();
                 
                for (int x = prodList.Count - 1; x >= 0; x--)
                {
                    if (prodList[x].Title == "GiftWrap")
                    {
                        prodList.RemoveAt(x);
                        break;
                    }  
                }
                 
                return prodList;
            }
        }
    }
    Here we override GetDataSource. First, let the base class do the built-in implementation and get the product list. Then we look for the GiftWrap product and remove it from the list.
    Save your class and build your web app.
    Then register the new class as shown in this blog post.

    I hope this helps you.

    All the best,
    Randy Hodge
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  11. Gregg
    Gregg avatar
    20 posts
    Registered:
    22 Jan 2013
    06 Jun 2013 in reply to Randy Hodge
    Link to this post
    Randy, Sorry so long getting back to you on this but we've been busy getting this site up and running. I just wanted to give you a big HIGH FIVE and thank you for your help. And let others know that your suggestions worked to resolve our issues.

    We created a custom "AddToShoppingCart" widget where we add the "wrapping" product if the checkbox has been checked. And your "ProductsMasterViewCustom" code works great to keep the "wrapping" product from showing up in the store as regular product.

    We do still have to watch for the disconnect between the "wrapping" product and the product to be wrapped where one or the other can be deleted once on the shopping cart. But we've been able to work with that until a better solution comes along.

11 posts, 0 answered