Product Attribute/Variation Applies to Total - After Quantity is Calculated
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:
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
Also, for the record, I'm on Sitefinity 5.2.
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
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
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:
So, in the case that a user buys Products A, B (wrapped), C, and D (wrapped), the final order would look like this:
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
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
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
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.
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.
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;
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.