How is this handled in Merchello? If the store is giving out coupons that can be use for discounts, should the coupons be created as contents? Then the price-off in the coupon will be inserted as a line item? If yes, at what point can I add the discount as a line item? And where should it be done?
Great timing on this actually as I'm tasked to implement coupons for a client in the next few weeks.
Merchello has a line item type of "Discount" which is intended to be used for this purpose among other things. In our scenario it makes more sense to apply the coupons during the checkout process (probably after quoting the shipping) but you could certainly wire something up to directly apply the discounted price on the product line item if that fits your requirements more appropriately.
Other ways:
Merchello also has essentially the same event model as Umbraco, so in some situations it may be useful to add discounts either in response to a Saving or Saved event.
There are several builders that are based off of definable "Task Chains". Essentially this is a linked list of Umbraco Attempts which sequentially execute until either the end of the chain is reached or a failure occurs. Adding a new task is pretty straight forward but not well documented. Checkout the /App_Plugins/Merchello/Config/Merchello.config file and if this is a direction you want to go, lets hookup on Skype or something and do a Q/A session =)
I've been doing some of the ground work prepping to add another section to the back office. In a nutshell, we wanted to get Merchello into it's own angular module and clean some things up before adding a bunch of new code =)
I'm trying to implement discounts on the site i'm building but i'm struggling to work out how to add the discount items to the basket. I have tried the following:
But that just errors when I come to save the basket as modifying the items collection directly doesn't put it into the cache. I can't seem to spot an override to Basket.AddItem that will allow me to specify a LineItemType. I have also tried using Basket.SalePreparation().AddItem(moneyOffItem) but that doesn't seem to work for me either.
That works much better! In case anyone else comes to do this in the future I've discovered that the discount amounts have to be positive numbers to get them to be removed from the invoice total. This does however, cause the Basket.TotalBasketPrice to be calculated with them added on but that can be got around fairly easily!
EDIT:
Actually, I have found now that adding them with positive numbers causes the tax to be calculated incorrectly if you want your discounts taxable (This particular site wants tax calculated on the subtotal after discounts) so I have had to put them in with minus amounts and compiled my own version of merchello with line 89 of invoicebuilderchain.cs changed from
Applying discounts
How is this handled in Merchello? If the store is giving out coupons that can be use for discounts, should the coupons be created as contents? Then the price-off in the coupon will be inserted as a line item? If yes, at what point can I add the discount as a line item? And where should it be done?
Hey Von,
Great timing on this actually as I'm tasked to implement coupons for a client in the next few weeks.
Merchello has a line item type of "Discount" which is intended to be used for this purpose among other things. In our scenario it makes more sense to apply the coupons during the checkout process (probably after quoting the shipping) but you could certainly wire something up to directly apply the discounted price on the product line item if that fits your requirements more appropriately.
Other ways:
Merchello also has essentially the same event model as Umbraco, so in some situations it may be useful to add discounts either in response to a Saving or Saved event.
There are several builders that are based off of definable "Task Chains". Essentially this is a linked list of Umbraco Attempts which sequentially execute until either the end of the chain is reached or a failure occurs. Adding a new task is pretty straight forward but not well documented. Checkout the /App_Plugins/Merchello/Config/Merchello.config file and if this is a direction you want to go, lets hookup on Skype or something and do a Q/A session =)
Hi Von / Rusty
Could either of you update me as to any progress thats been made on this subject?
Cheers Paul
Hi Paul,
I've been doing some of the ground work prepping to add another section to the back office. In a nutshell, we wanted to get Merchello into it's own angular module and clean some things up before adding a bunch of new code =)
Hi Rusty,
I'm trying to implement discounts on the site i'm building but i'm struggling to work out how to add the discount items to the basket. I have tried the following:
But that just errors when I come to save the basket as modifying the items collection directly doesn't put it into the cache. I can't seem to spot an override to Basket.AddItem that will allow me to specify a LineItemType. I have also tried using Basket.SalePreparation().AddItem(moneyOffItem) but that doesn't seem to work for me either.
What have I missed?
Thanks
Chris
Hi Chris,
A basket line item is an ItemCacheLineItem. Try
ILineItem moneyOffItem = new ItemCacheLineItem(LineItemType.Discount, "Test Discount", "discount123", 1, -discountAmount);
Hi Rusty,
That works much better! In case anyone else comes to do this in the future I've discovered that the discount amounts have to be positive numbers to get them to be removed from the invoice total. This does however, cause the Basket.TotalBasketPrice to be calculated with them added on but that can be got around fairly easily!
EDIT: Actually, I have found now that adding them with positive numbers causes the tax to be calculated incorrectly if you want your discounts taxable (This particular site wants tax calculated on the subtotal after discounts) so I have had to put them in with minus amounts and compiled my own version of merchello with line 89 of invoicebuilderchain.cs changed from
to
Rusty, is this approach likely to break anything else?
Thanks for your help
Chris
is working on a reply...