Hello there, Keep in mind that I'm tracking inventory here.
When you decide to CANCEL an existing Unpaid Order, the Cancel action returns the Qty used by that transaction back to the Product StockQuantity (which is good).
When you decide to DELETE an existing Unpaid Order, the Delete action seems to totally ignore the fact that it is holding product Qty and never updates back value on the Database.
For those Tracking Inventory like me, this could be a problem.
I've just tested it,. Everything works fine. 1. Do you have source code? If yes, please open \Libraries\Nop.Services\Orders\OrderProcessingService.cs file and post its DeleteOrder method here 2. Also got to an appropriate product variant details page (admin area). Is "Manage inventory method" set to "Track inventory"?
pint12 wrote:
i also noticed that when if buy button is disabled because low quantity it is not enabled after canceling an order .
//raise event if (order.PaymentStatus == PaymentStatus.Paid) { _eventPublisher.PublishOrderPaid(order);
//fileds for dropship added by ilanp //send email notifications to vendor var ml = _orderService.GetAllVendors(order.Id);
foreach (Manufacturer vendor in ml.Distinct()) { if (vendor.IsDropShip == true) { int SendOrderPlacedVendorNotificationId = _workflowMessageService.SendOrderPlacedVendorNotification(order, _localizationSettings.DefaultAdminLanguageId, vendor); if (SendOrderPlacedVendorNotificationId > 0) { order.OrderNotes.Add(new OrderNote() { Note = string.Format("\"Order placed\" email (to vendor) has been queued. Queued email identifier: {0}.", SendOrderPlacedVendorNotificationId), DisplayToCustomer = false, CreatedOnUtc = DateTime.UtcNow }); _orderService.UpdateOrder(order); } } }
}
and then there is the Deletes an order
/// <summary> /// Deletes an order /// </summary> /// <param name="order">The order</param> public virtual void DeleteOrder(Order order) { if (order == null) throw new ArgumentNullException("order");
//add a note order.OrderNotes.Add(new OrderNote() { Note = "Order has been deleted", DisplayToCustomer = false, CreatedOnUtc = DateTime.UtcNow }); _orderService.UpdateOrder(order);
//cancel recurring payments //var recurringPayments = _orderService.SearchRecurringPayments(0, order.Id, null); //foreach (var rp in recurringPayments) //{ // var errors = CancelRecurringPayment(rp); //}
The source code looks good. As I've written above everything works fine out of the box. Please set breakpoint in ProductService.AdjustInventory() method and see what happens there and why inventory is not adjusted.