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.
E.g.
var shippingDiscount = order.Discounts.ShippingDiscount // 100% or 0%
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.
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:
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
Accessing Marketing Rules in Code
Hello!
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.
E.g.
Many thanks! Laurence
Hi 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.
Kind regards
Anders
Hey Anders,
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:
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.
Kind regards
Anders
Comment author was deleted
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
https://github.com/TeaCommerce/Starter-kit-for-Umbraco/blob/master/Source/Website/Views/CartStep1.cshtml
Does that do the job?
Comment author was deleted
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.
Comment author was deleted
Thanks Anders! :)
is working on a reply...