Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
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.
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?
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:
ILineItem moneyOffItem = new OrderLineItem(LineItemType.Discount, "Test Discount", "discount123", 1, -discountAmount);
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?
A basket line item is an ItemCacheLineItem. Try
ILineItem moneyOffItem = new ItemCacheLineItem(LineItemType.Discount, "Test Discount", "discount123", 1, -discountAmount);
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!
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
attempt.Result.Total = Math.Round(decimal.TryParse((charges - discounts).ToString(CultureInfo.InvariantCulture), NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture.NumberFormat, out converted) ? converted : 0, 2);
attempt.Result.Total = Math.Round(decimal.TryParse((charges + discounts).ToString(CultureInfo.InvariantCulture), NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture.NumberFormat, out converted) ? converted : 0, 2);
Rusty, is this approach likely to break anything else?
Thanks for your help
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted