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
I'd like to be able to have access to the active marketing rules in my view logic and wondered if this was possible using an existing API?
The use case, is that we offer 2 shipping variants, and also give free shipping for orders for say £100. I'd like to get back the current shipping discount, so when I'm updating totals, this is considered.
var shippingDiscount = order.Discounts.ShippingDiscount // 100% or 0%
Many thanks! Laurence
So you want to see the discounts that has been applied to the order or do you want to show the marketing rules? The order doesnt have any info about how the discounts was applied - only what amount etc that is applied.
The marketing engine is quite complex and its not easy to make a system where all info about how the discounts was applied, how much was applied etc is available. So we have made the info available the is the most basics. Let us know if you need anything else and we can try and see if we can make it available.
Thank's for the reply :-)
Ideally there would be a method on the ShippingPrice that returned the Price including any discounts, or perhaps something that returned the shipping discount within the Order.
If it's not available, I figured I could calculate it by:
bool freeShipping = ((order.TotalPrice.Value.Value - order.SubtotalPrice.Value.Value) == 0);
The shipping price on the order does have the discount so you can print it - BUT you cant print your 3 different shipping methods with their original price and then a price it would have if it was applied to the order and maybe got discounted. I thing the demo.teacommerce.net website already write discounts for the shipping and other things in the cart flow.
Hi Anders, got a similar question, I've created a new marketing rule that checks if the user is logged in (well part of a membergroup), if he is he get's an award (say 50% of subtotal in this case).
Now how do I show this calculated discount on the shopping basket? Since now it looks like this
Might be missing something obvious here, but just want it to display the name of the marketing rule with the calculated award
See line 104 - 111
Does that do the job?
Nice, I now get the following which is good
But to further enhance this I would love to have a line for each marketing rule that is active...
SO I would get
SubTotal without discounts: 55
Award due to rule 1 (rule name): -10%
SubTotal with discounts: 50
Does that make sense?
You can loop the order.SubtotalPrice.Discounts where you have the campaign name and then the value it discounted the subtotal.
Thanks Anders! :)
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted