I think you need to add js method on close window event and call server code like this:
public void ClearBasket()
{
// Get rid of the lines
foreach (var orderLineId in PurchaseOrder.OrderLines.Select(x => x.OrderLineId).ToList())
{
UpdateLineItem(orderLineId, 0);
}
// Remove all the discounts
while (PurchaseOrder.Discounts.Any())
{
PurchaseOrder.RemoveDiscount(PurchaseOrder.Discounts.FirstOrDefault());
}
// Vouchers are also represented as properties, and if not removed from properties they
// will be re-generated on the order via the pipeline
var prop = PurchaseOrder.OrderProperties.FirstOrDefault(v => v.Key == "voucherCodes");
if (prop != null)
{
prop.Value = string.Empty;
prop.Save();
}
PurchaseOrder.Save();
ExecuteBasketPipeline();
}
Clear Basket when browser closed
Hi
i want to remove items in basket when ever browser closed or set some specific time for items stay in basket and after time over set basket clear.
thanks.
Hi Deeppatel
What basket are you talking about?
Thanks,
Alex
i mean shopping bag
i want to clear shopping bag after specified time period.
thanks
What e-commerce system are you using?
Can you show the code of your basket?
i am using uCommerce system
I think you need to add js method on close window event and call server code like this:
thanks Alex Skrypnyk
in which page i need to add ClearBasket() code?
and how too call ClearBasket() from js?
thanks.
try this:
it depends on how your site was built
What are js frameworks you using?
i use only jquery
Deeppatel, I can't show the code exactly - try to ask on ucommerce forum - http://eureka.ucommerce.net/#!/
Maybe there is a ready solution
Thanks,
Alex
is working on a reply...