This is just what my customer needs ... and hopefully it will save me having to do it ;-)
When does the "price breaks" take effect, is it when an item is added to the order (new / updated order line)?
If so, how do I access the price breaks beforehand so that I can display the correct price as the customer changes the required quantity? I need to do this in a User Control (C#).
The code is tied in to the tea commerce event model, so when an order is added / the quantity is updated, the order added event is fired. This is used to change the unit price of the order line.
The user can see this working automatically from the cart contents page / cart summary widget as the unit price will change as the order quantity is increased / decreased. Tea commerce (js code from sample web shop) automatically handles updating the prices in these locations on the front end on the fly.
In terms of listing the prices out on a product page, this would just be a case of formatting the XML that the data type outputs. (a sample of which is included in the package instructions.) you could use xdocument in the code behind of your user control to achieve this.
Does your code always refer to the "standard" price (i.e. productPriceGBP) and calculate the correct price?
The "product" has a base price which can be altered by the selection of a number of options, so the base price might be £1.35 plus £0.25 for option A and £0.10 for option B, making a total product item cost of £1.60. This is the price that I currently insert into the orderline using "orderLine.UnitPrice = ".
The client has confirmed that I need to (or your extension needs to) be altering the base price (£1.35) and then adding the option costs. It sounds like I need to add code to the TeaCommerce "OrderLineChanged" event ... would that interfere with your code?
As it stands, the code looks at the original unit price - which is the unit price at the time the code is first called. I can refactor to get the "standard" price out of the umbraco node if nessecery, but think there will be issues with the following;
The code is called on the OrderLineAdded event which is called both when an order is added, and when the quantity is changed (I think the order line is re-added?).
Where this sits in the event stack i.e. before OrderLineChanged or after would be a question for the Tea Commerce guys. I was supprised that OrderLineAdded was called when the quantity was updated as I originally thought that I would need to call my code on both events,
I suspect that because the price processing is complicated on this website, your component as it stands won't do what we require? Would it be possible to use the configuration User Control and it's processing but without the integration with the TeaCommerce events? I think I will need to code that myself.
Unless, of course, I could ignore / override the processing that you do, with my own? ...
Yes it's looking that way - my component was sort of designed to be a quick plugin for the bog standard Tea Commerce demo webshop style implementation - I imagine the events will conflict and all kinds of crazyness will break loose,
I'd advise installing the package (to get the datatype in without having to do it manually) and then removing the dll from the bin.
I can email you the code which you can then incorporate manually / extend / refactor wherever it needs to be. DM me your email on twitter?
How / when does it work
This is just what my customer needs ... and hopefully it will save me having to do it ;-)
When does the "price breaks" take effect, is it when an item is added to the order (new / updated order line)?
If so, how do I access the price breaks beforehand so that I can display the correct price as the customer changes the required quantity? I need to do this in a User Control (C#).
Hi Gordon,
The code is tied in to the tea commerce event model, so when an order is added / the quantity is updated, the order added event is fired. This is used to change the unit price of the order line.
The user can see this working automatically from the cart contents page / cart summary widget as the unit price will change as the order quantity is increased / decreased. Tea commerce (js code from sample web shop) automatically handles updating the prices in these locations on the front end on the fly.
In terms of listing the prices out on a product page, this would just be a case of formatting the XML that the data type outputs. (a sample of which is included in the package instructions.) you could use xdocument in the code behind of your user control to achieve this.
Hope this helps?
Many thanks,
Tom
Does your code always refer to the "standard" price (i.e. productPriceGBP) and calculate the correct price?
The "product" has a base price which can be altered by the selection of a number of options, so the base price might be £1.35 plus £0.25 for option A and £0.10 for option B, making a total product item cost of £1.60. This is the price that I currently insert into the orderline using "orderLine.UnitPrice = ".
The client has confirmed that I need to (or your extension needs to) be altering the base price (£1.35) and then adding the option costs. It sounds like I need to add code to the TeaCommerce "OrderLineChanged" event ... would that interfere with your code?
Hi Gordon,
As it stands, the code looks at the original unit price - which is the unit price at the time the code is first called. I can refactor to get the "standard" price out of the umbraco node if nessecery, but think there will be issues with the following;
The code is called on the OrderLineAdded event which is called both when an order is added, and when the quantity is changed (I think the order line is re-added?).
Where this sits in the event stack i.e. before OrderLineChanged or after would be a question for the Tea Commerce guys. I was supprised that OrderLineAdded was called when the quantity was updated as I originally thought that I would need to call my code on both events,
Let me know how it goes?
Tom
Hi Tom,
I suspect that because the price processing is complicated on this website, your component as it stands won't do what we require? Would it be possible to use the configuration User Control and it's processing but without the integration with the TeaCommerce events? I think I will need to code that myself.
Unless, of course, I could ignore / override the processing that you do, with my own? ...
Hi Gordon,
Yes it's looking that way - my component was sort of designed to be a quick plugin for the bog standard Tea Commerce demo webshop style implementation - I imagine the events will conflict and all kinds of crazyness will break loose,
I'd advise installing the package (to get the datatype in without having to do it manually) and then removing the dll from the bin.
I can email you the code which you can then incorporate manually / extend / refactor wherever it needs to be. DM me your email on twitter?
Many Thanks,
Tom
Doh! Posted twice!
Hi Tom - you need to "follow" me before I can DM you... :-)
Ah yes! Aplogies, Done
is working on a reply...