I want to implement a discount coupon in teacommerce. For that i've created a node and in the cart 03 xslt the user can add promotion code. This code is passes to appcode class where it tests whether node available if available i created funtion
function
TeaCommerce.Data.Order order = TeaCommerce.Razor.TeaCommerce.GetOrder();
foreach (TeaCommerce.Data.OrderLine ol in order.OrderLines) { ol.UnitPrice -= decimal.Parse(am); }
But the change is not hapening in the cart. when i quick watched the unit prize the following message is seen. "The name 'UnitPrice' does not exist in the current context" . What is the reason?
Sorry for the delay .Not yet found a solution. wrote a class extending ITeaCommerceExtension and tried to override the events and not hapening.Dont know what went wrong.
Tea commerce session not available
Hi Everyone,
I want to implement a discount coupon in teacommerce. For that i've created a node and in the cart 03 xslt the user can add promotion code. This code is passes to appcode class where it tests whether node available if available i created funtion
function
TeaCommerce.Data.Order order = TeaCommerce.Razor.TeaCommerce.GetOrder();
foreach (TeaCommerce.Data.OrderLine ol in order.OrderLines)
{
ol.UnitPrice -= decimal.Parse(am);
}
but got an error whic shows in alert as follows.
any help .....
Hi Sob,
Are you by any chance using the cookies Tea Commerce option? The one under general options.
/Rune
No am not using the cookies
Ok. What version of Tea Commerce are you running?
You can see that on the package in the developer section.
/Rune
version is 1.4.1.1
Oh i updated to latest version..Now that error is not coming. But i cannot change total prize says it is read only. How can i change that.
Fantastic. Bug fixes FTW.
You must change the Unit Price on the orderline. Then the total price will be calculated automatically.
/Rune
Hey Rune,
I used the following code
ol.UnitPrice -= decimal.Parse(am);
order.save();
But the change is not hapening in the cart. when i quick watched the unit prize the following message is seen. "The name 'UnitPrice' does not exist in the current context" . What is the reason?
I'm not quite sure about that context thing. What is your context?
Actually I'm currently working on something similar for at project. I have hooked into the OrderLineChanged event at my code looks a bit like this:
That's working for me.
/Rune
Got this working?
Kind regards
Anders
Sorry for the delay .Not yet found a solution. wrote a class extending ITeaCommerceExtension and tried to override the events and not hapening. Dont know what went wrong.
Followed these posts? Should give you the idea of how to do things
http://rune.gronkjaer.dk/en-US/2011/02/21/tea-commerce-net-api-explained/
http://rune.gronkjaer.dk/en-US/2010/11/26/how-to-use-the-tea-commerce-events/
Kind regards
Anders
is working on a reply...