You cant change the total price as it is calced from orderlines + shipping fees + payment fees. So you would loop the orderlines and set the orderLine.UnitPrice -= discount. Or the order.ShippingFee or order.PaymentFee.
It does work if I apply it against an orderline, but the discount we need the discount to be applied against an order, not a orderline - it would not look right.
Is it possible to add the discount of a minus value as a new orderline?
Also would I be able to add a discount section to TeaCommerce admin within the Umbraco backend?
What is you senario - when do you apply the discount?
Yes you could add the discount as an orderline where is doesnt have a price and you calculate its price. So just have a product node named "Discount" and add it and assign the price in .NET code. You could then in your xslt/razor go ahead and show that orderline in a special design in your cart flow.
You would be able to add a discount tree in the Tea Commerce custom section. Just like a normal custom section and you just specify that it belongs to the Tea Commerce application.
We are applying the discount on the Cart Summary/Accept screen (last screen before going to the Payment Provider). The customer can add a discount code into a input text field then click 'add to basket'.
At this point I am looking to apply the discount ideally against the order total on the Cart Summary screen and show this to the customer. Is it possible to have a product with a negative price without assign it in .NET code?
I've not done a custom section before but it would be a better solution for the end-user. Will have to watch the Umbraco videos.
Yes you can have a product with a negative amount I think. The only thing you would have to do is to secure so you cant add that product multiple times and that it cant be added by using TeaCommerce.addOrderLine in the javascript api.
As I said before I've not built a custom section so some guidance would be greatly appreciated.
For adding a discount tree to the Tea Commerce section, can I open the Tea Commerce package that I downloaded in Visual Studio and add the additional functionality, then add the updated files to the relevant site folders (bin, usercontrols, etc)?
Or do I create a separate project and add the necessary references and functionality in here instead?
Attempts at applying discount so far have not been successful. Considering I can't change the total price as it is calculated (orderlines + shipping fees + payment fees), would it be possible to override the TeaCommerce total price calculation and create a custom total price calculation?
For example, on the Cart Summary/Accept screen, a custom total price function would include orderlines + shipping fees + payments + discount (custom order property)
If this is possible, how then could I pass this custom total into the (TeaCommerce) payment provider?
Tea Commerce dont have a price calculation provider you can override - but we have thought about it for the Umbraco 5 version. But we try to keep Tea Commerce as simple yet flexible as possible - everybody has to be able to create a Tea Commerce solution. Isnt it possible for you to hook into the OrderPropertiesUpdated event in the .NET API and see if the discount code is good - if so - add the dicsount product?
Hooking into the OrderPropertiesUpdated event is a possibility. As a quick test, is placing some code in the App_Code a possibility?
The question would still remain of how to apply the discount value to the order.
Attempts of trying to apply it against the PaymentFee or ShippingFee is not working so far - and I think this would be confusing for the user anyway.
Applying it against an orderline would be mis-leading for a user, as it would look like a discount against an orderline, not an order. Also I would have to consider which orderline to apply the discount against - not an ideal solution.
Adding a new discount orderline is a possibility, and as you mentioned before I would have to make sure it was secure so that it could not be added multiple times and also so that it can't be added via the javascript api. This is looking like the best possibility.
Is there no possible way of implementing our own order total calculation and passing that through to the payment provider in Tea Commerce? Guessing I could implement our own submit button to deal with the submitting the order through to the payment provider.
I never use App_Code so I dont know - but you could try and let me know :)
We dont have a provider model for the total calculation in the current version of Tea Commerce and it would be in near future we have that. So the best way at the moment for you is to add a discount orderline when the "discountCode" property is added to the order. Then you would just have to make some changes in the presentation layer of your shop. You could in the step4 xslt - only loop out orderlines that isnt of type discount. Then at the bottom of your cart flow you could loop the discounts and that would make total sense for the customer. Its an orderline but you dont have to render it like an orderline :)
Wonder if you could point me in the right direction?
I have implemented a discount functionality which is being applied on the Accept/Summary screen. The customer enters a discount code, clicks 'Redeem discount' and on the postback checks if the discount code is valid.
The following error message is returned from SagePay after clicking 'Accept & Go To Payment'
Tea Commerce - SagePay - Error in GenerateForm - Status: MALFORMED - Status details: 4002 : An active transaction with this VendorTxCode has been found but the Amount is different.
If I don't enter a discount code, the payment goes through SagePay.
Any ideas why applying the discount on the 'Accept/Summary' screen causes this issue?
This is a combination of how Tea Commerce works and how Sage Pay behaves. When you go to the "Accept" page the XLST extension GetPaymentForm is invoked to generate the right form object for payment - this is done to support non javascript setup. When this method is invoked our Sage Pay provider needs to generate the form. Because of the way Sage Pay works - this means that we contact the Sage Pay system to generate a payment continue URL and other info and they "save" the order info you we send. So when you on postback submits the discount code and change the amount - the two orders are different - so you will have to do it before the GetPaymentForm is invoked - so you might have to move it to another step. Makes sense?
When I set an order line's UnitPrice in this way it is assuming the price is inclusive of VAT.
Is there a simple way to set the price without VAT or am I going to have to look up the VAT group for the product, get the rate and calcluate it before adding it?
Amending Order.TotalPriceWithoutFees
Looking to apply a discount on the total price (without fees) of an order. For example,
order.TotalPriceWithoutFees -= Decimal.Parse(item.DiscountAmount);
The following message appears
Property or indexer 'TeaCommerce.Data.Order.TotalPriceWithoutFees' cannot be assigned to -- it is read only.
Any ideas of how I can apply a discount to the 'TotalPriceWithoutFees'?
Hi Sean
You cant change the total price as it is calced from orderlines + shipping fees + payment fees. So you would loop the orderlines and set the orderLine.UnitPrice -= discount. Or the order.ShippingFee or order.PaymentFee.
Kind regards
Anders
Hi Anders
Trying to apply the discount to the order.ShippingFee or order.PaymentFee as shown below, is not being applied.
decimal discount = Decimal.Parse(order.GetPropertyValue("discount"));
order.PaymentFee -= discount;
order.Save();
It does work if I apply it against an orderline, but the discount we need the discount to be applied against an order, not a orderline - it would not look right.
Is it possible to add the discount of a minus value as a new orderline?
Also would I be able to add a discount section to TeaCommerce admin within the Umbraco backend?
Hi Sean
What is you senario - when do you apply the discount?
Yes you could add the discount as an orderline where is doesnt have a price and you calculate its price. So just have a product node named "Discount" and add it and assign the price in .NET code. You could then in your xslt/razor go ahead and show that orderline in a special design in your cart flow.
You would be able to add a discount tree in the Tea Commerce custom section. Just like a normal custom section and you just specify that it belongs to the Tea Commerce application.
Hi Anders
We are applying the discount on the Cart Summary/Accept screen (last screen before going to the Payment Provider). The customer can add a discount code into a input text field then click 'add to basket'.
At this point I am looking to apply the discount ideally against the order total on the Cart Summary screen and show this to the customer. Is it possible to have a product with a negative price without assign it in .NET code?
I've not done a custom section before but it would be a better solution for the end-user. Will have to watch the Umbraco videos.
Yes you can have a product with a negative amount I think. The only thing you would have to do is to secure so you cant add that product multiple times and that it cant be added by using TeaCommerce.addOrderLine in the javascript api.
Anders
As I said before I've not built a custom section so some guidance would be greatly appreciated.
For adding a discount tree to the Tea Commerce section, can I open the Tea Commerce package that I downloaded in Visual Studio and add the additional functionality, then add the updated files to the relevant site folders (bin, usercontrols, etc)?
Or do I create a separate project and add the necessary references and functionality in here instead?
Hi Anders
Attempts at applying discount so far have not been successful. Considering I can't change the total price as it is calculated (orderlines + shipping fees + payment fees), would it be possible to override the TeaCommerce total price calculation and create a custom total price calculation?
For example, on the Cart Summary/Accept screen, a custom total price function would include orderlines + shipping fees + payments + discount (custom order property)
If this is possible, how then could I pass this custom total into the (TeaCommerce) payment provider?
Hi Sean
For the custom tree part - the umbraco videos are a great way to learn it - or just google "umbraco custom tree" - You will have to built your own trre in your own Visual Studio Project and then copy that dll, usercontrols etc into your website.
http://umbraco.com/help-and-support/video-tutorials/developing-with-umbraco.aspx?page=3
Tea Commerce dont have a price calculation provider you can override - but we have thought about it for the Umbraco 5 version. But we try to keep Tea Commerce as simple yet flexible as possible - everybody has to be able to create a Tea Commerce solution. Isnt it possible for you to hook into the OrderPropertiesUpdated event in the .NET API and see if the discount code is good - if so - add the dicsount product?
Kind regards
Anders
Hooking into the OrderPropertiesUpdated event is a possibility. As a quick test, is placing some code in the App_Code a possibility?
The question would still remain of how to apply the discount value to the order.
Attempts of trying to apply it against the PaymentFee or ShippingFee is not working so far - and I think this would be confusing for the user anyway.
Applying it against an orderline would be mis-leading for a user, as it would look like a discount against an orderline, not an order. Also I would have to consider which orderline to apply the discount against - not an ideal solution.
Adding a new discount orderline is a possibility, and as you mentioned before I would have to make sure it was secure so that it could not be added multiple times and also so that it can't be added via the javascript api. This is looking like the best possibility.
Is there no possible way of implementing our own order total calculation and passing that through to the payment provider in Tea Commerce? Guessing I could implement our own submit button to deal with the submitting the order through to the payment provider.
Hi Sean
I never use App_Code so I dont know - but you could try and let me know :)
We dont have a provider model for the total calculation in the current version of Tea Commerce and it would be in near future we have that. So the best way at the moment for you is to add a discount orderline when the "discountCode" property is added to the order. Then you would just have to make some changes in the presentation layer of your shop. You could in the step4 xslt - only loop out orderlines that isnt of type discount. Then at the bottom of your cart flow you could loop the discounts and that would make total sense for the customer. Its an orderline but you dont have to render it like an orderline :)
Hi Anders
Wonder if you could point me in the right direction?
I have implemented a discount functionality which is being applied on the Accept/Summary screen. The customer enters a discount code, clicks 'Redeem discount' and on the postback checks if the discount code is valid.
The following error message is returned from SagePay after clicking 'Accept & Go To Payment'
Tea Commerce - SagePay - Error in GenerateForm - Status: MALFORMED - Status details: 4002 : An active transaction with this VendorTxCode has been found but the Amount is different.
If I don't enter a discount code, the payment goes through SagePay.
Any ideas why applying the discount on the 'Accept/Summary' screen causes this issue?
Hi Sean
This is a combination of how Tea Commerce works and how Sage Pay behaves. When you go to the "Accept" page the XLST extension GetPaymentForm is invoked to generate the right form object for payment - this is done to support non javascript setup. When this method is invoked our Sage Pay provider needs to generate the form. Because of the way Sage Pay works - this means that we contact the Sage Pay system to generate a payment continue URL and other info and they "save" the order info you we send. So when you on postback submits the discount code and change the amount - the two orders are different - so you will have to do it before the GetPaymentForm is invoked - so you might have to move it to another step. Makes sense?
Kind regards
Anders
Hi Anders
Thanks for the information, makes plenty of sense. I have moved the discount functionality to another step.
Just looking how best to override the price of a product in TC 1.4.
Is setting the UnitPrice for the orderline driectly the thing to do in that version?
Regards,
Matt
Hi Matt
In v1 I think that is the way to go
Thanks, seems to work.
Where is all the v1 documentation? Runes blog?
Matt
Yes I think it is still his blog that has it.
Hi Anders,
All my prices are stored in Umbraco without VAT.
When I set an order line's UnitPrice in this way it is assuming the price is inclusive of VAT.
Is there a simple way to set the price without VAT or am I going to have to look up the VAT group for the product, get the rate and calcluate it before adding it?
Cheers, Matt
is working on a reply...