Using the OrderLineAdded event I have created my custom shipping calculations based on the product property.
This is working for adding one orderline. It populates the amount properly for a quantity of that same orderline (if I order 2 of the same exact product it calculates correctly). But if I add an entire new product to the order, it clears out the shipping and only totals for the last item added. Thoughts?
Here's the main lines of the method I have hooked into OrderLineAdded:
Custom Shipping Per Product
Trying to clean up post on this so starting a new thread. Previous thread here: http://our.umbraco.org/projects/website-utilities/tea-commerce/tea-commerce-support/34699-Shipping-Method-per-Product
Using the OrderLineAdded event I have created my custom shipping calculations based on the product property.
This is working for adding one orderline. It populates the amount properly for a quantity of that same orderline (if I order 2 of the same exact product it calculates correctly). But if I add an entire new product to the order, it clears out the shipping and only totals for the last item added. Thoughts?
Here's the main lines of the method I have hooked into OrderLineAdded:
If (order.ShippingMethodId != intShipDefault)
{
order.ShippingMethodId = inShipDefault;
}
foreach (var property in orderLine.Properties)
{
if (property.Value.ToString().ToUpper() == "HALF")
{
shipFeeHalf = orderLine.Quantity * intShipHalfCost;
}
if (property.Value.ToString().ToUpper() == "FULL")
{
shipFeeFull = orderLine.Quantity * intShipFullCost;
}
}
order.ShippingFeeWithoutVAT += shipFeeFull + shipFeeHalf;
Hi Hutch,
You will need to do the foreach part for every orderline you have. So run a foreach on your order.OrderLines.
One little thing though. You don't need to loop your orderLine properties. You can use Linq to object to get the ones you want:
orderLine.Properties.FirstOrDefault( p => p.Alias.ToUpperInvariant() == "HALF" );
Hope that helps
/Rune
Oh, nice! Will try that and post results shortly.
is working on a reply...