Just to get you up to speed, ive created a discount button that gives the customer an option to put a discount upon an order.
I do this through Teacommerce's .net API by doing so :
Order o = Order.GetOrder(OrderId);
OrderLine ol = o.CreateUniqueOrderLine(DiscountNodeId, 1);
ol.UnitPrice -= Discount;
o.Save();
And as soon as i hit .save it adds a line to the order but its not saving an orderline with discount but an orderline with a unitprice of "0".
Ive just spend an hour on the phone with Anders from Teacommerce and we been through all of the code, and we figured out that by deleting your dll it works.
So when we hit save some event your subscribing to in the pricebreak package is being hit and return an order value of zero.
Ah, this is a bigger issue, and one I have no idea how to get around.
Basically, I subscribe to the WebshopEvents.OrderLineAdded event which is fired whenever the quantity on an order line is changed. (And therefore when an order line is added - as the quantity is updated to 1 etc etc)
In order to work out how to update the unit price, I need to have some idea of what the original unit price was - before it was modified by applying a price break. This way - if the user reduces their quantity, the correct price break continues to be applied, until the original price is applied below the first price break threshold.
The only place where the unmodified unit price exists is in the product umbraco node. So this is where I'm getting it from.
As your DiscountProductNode has (im guessing) a price of 0 in the umbraco backoffice, this is being returned.
Not sure how to fix this one. Perhaps a line in the config that will enable the user to exclude certain product node type aliases or product node ids from the logic?
Or even simpler - rather than a list of ids to exclude - what about a checkbox on the product node called excludeFromPriceBreaks (with a config line for the property alias of course).
In the install instructions I will mention that users need to add this property to their product doctype if they want to use it.
I'm still going to add the ability to exclude certain NodeTypeAlias's and individual nodes (via the checkbox) as I think it's a useful feature - so this will solve the issue without you having to change your logic,
A bug when I Save an orderline through teacommerces API
Hey Tom :)
Ive encountered a bug when i was doing this :
http://our.umbraco.org/projects/website-utilities/tea-commerce/tea-commerce-support/35328-Is-it-possible-to-reduce-the-whole-order-price?p=1#comment128986
Just to get you up to speed, ive created a discount button that gives the customer an option to put a discount upon an order.
I do this through Teacommerce's .net API by doing so :
And as soon as i hit .save it adds a line to the order but its not saving an orderline with discount but an orderline with a unitprice of "0".
Ive just spend an hour on the phone with Anders from Teacommerce and we been through all of the code, and we figured out that by deleting your dll it works.
So when we hit save some event your subscribing to in the pricebreak package is being hit and return an order value of zero.
Hi Rasmus,
Ah, this is a bigger issue, and one I have no idea how to get around.
Basically, I subscribe to the WebshopEvents.OrderLineAdded event which is fired whenever the quantity on an order line is changed. (And therefore when an order line is added - as the quantity is updated to 1 etc etc)
In order to work out how to update the unit price, I need to have some idea of what the original unit price was - before it was modified by applying a price break. This way - if the user reduces their quantity, the correct price break continues to be applied, until the original price is applied below the first price break threshold.
The only place where the unmodified unit price exists is in the product umbraco node. So this is where I'm getting it from.
As your DiscountProductNode has (im guessing) a price of 0 in the umbraco backoffice, this is being returned.
Not sure how to fix this one. Perhaps a line in the config that will enable the user to exclude certain product node type aliases or product node ids from the logic?
Tom
Or even simpler - rather than a list of ids to exclude - what about a checkbox on the product node called excludeFromPriceBreaks (with a config line for the property alias of course).
In the install instructions I will mention that users need to add this property to their product doctype if they want to use it.
Tom
Jup your right 0 is the node price
well if you say you *only subscribe to quantity change i could just create a new order line.
save it.
find it again, change price and save it again, or would that also fire the event ?
Maybe Anders can comment/throw a bone ?
Arh Yes
that would actually work !
Yes, that sounds like it would work,
I'm still going to add the ability to exclude certain NodeTypeAlias's and individual nodes (via the checkbox) as I think it's a useful feature - so this will solve the issue without you having to change your logic,
Many Thanks,
Tom
This also works !
Hi Rasmus,
Not sure if you managed to sort this or not, but the updates in the other thread
http://our.umbraco.org/projects/backoffice-extensions/cogworks-price-breaks-for-tea-commerce/bugs-issues-questions/35163-In-need-to-update-the-quantity-after-AddOrderLine
Should help without you having to alter your logic,
Many Thanks,
Tom
is working on a reply...