Inserting same order products in different line

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
1 ano atrás
Hi All

I have a situation where I am ordering same product Item in multiple and it is showing one entry with Quantity field Number of Item (2 in this case) purchased but when it entered into the order list in Shop admin , it insert as 2 items in 1 of each and other details are the same. it also happening for different total number too.

find the attached screenshot

https://i.postimg.cc/y6ntXtcW/Shppingcart.jpg

https://i.postimg.cc/L4jGYh6k/Same-order-in-different-line.jpg
https://postimg.cc/QVxfv87V

any help would be appreciated
1 ano atrás
prabirchoudhury wrote:
Hi All

I have a situation where I am ordering same product Item in multiple and it is showing one entry with Quantity field Number of Item (2 in this case) purchased but when it entered into the order list in Shop admin , it insert as 2 items in 1 of each and other details are the same. it also happening for different total number too.

find the attached screenshot

https://i.postimg.cc/y6ntXtcW/Shppingcart.jpg

https://i.postimg.cc/L4jGYh6k/Same-order-in-different-line.jpg
https://postimg.cc/QVxfv87V

any help would be appreciated



Hello there,

You need to chagne in \Presentation\Nop.Web\Areas\Admin\Controllers\Ordercontrolller.

You can add following code :


if (quantity > 0)
            {
                var qtyDifference = orderItem.Quantity - quantity;

                if (!_orderSettings.AutoUpdateOrderTotalsOnEditingOrder)
                {
                    orderItem.UnitPriceInclTax = unitPriceInclTax;
                    orderItem.UnitPriceExclTax = unitPriceExclTax;
                    orderItem.Quantity = quantity;
                    orderItem.DiscountAmountInclTax = discountInclTax;
                    orderItem.DiscountAmountExclTax = discountExclTax;
                    orderItem.PriceInclTax = priceInclTax;
                    orderItem.PriceExclTax = priceExclTax;
                    await _orderService.UpdateOrderItemAsync(orderItem);
                }

                //adjust inventory
                await _productService.AdjustInventoryAsync(product, qtyDifference, orderItem.AttributesXml,
                    string.Format(await _localizationService.GetResourceAsync("Admin.StockQuantityHistory.Messages.EditOrder"), order.Id));
            }


Your admin side oders will look like this.
1 ano atrás
Have you made any customisation or have any third party pluign installed ?
1 ano atrás
Hi anisha2205

Thanks for your response ,  I hope you are referring this code section to EditOrderItem() Method in /Admin/Controllers/OrderController.cs
 public virtual ActionResult EditOrderItem(int id, FormCollection form)

but I already have this section of code in this method and only difference is as because my NOP version 3.9  so NOT using async method, so await is missing from my code
      

// Nop version 3.9 EditOrderItem()
            if (quantity > 0)
            {
                int qtyDifference = orderItem.Quantity - quantity;

                if (!_orderSettings.AutoUpdateOrderTotalsOnEditingOrder)
                {
                    orderItem.UnitPriceInclTax = unitPriceInclTax;
                    orderItem.UnitPriceExclTax = unitPriceExclTax;
                    orderItem.Quantity = quantity;
                    orderItem.DiscountAmountInclTax = discountInclTax;
                    orderItem.DiscountAmountExclTax = discountExclTax;
                    orderItem.PriceInclTax = priceInclTax;
                    orderItem.PriceExclTax = priceExclTax;
                    _orderService.UpdateOrder(order);
                  
                }

                //adjust inventory
                _productService.AdjustInventory(orderItem.Product, qtyDifference, orderItem.AttributesXml,
                    string.Format(_localizationService.GetResource("Admin.StockQuantityHistory.Messages.EditOrder"), order.Id));

            }
            else{}


any advise thanks
1 ano atrás
Hi Yidna

Thanks for your response , This Nop application is heavily customised and I have done some of this including adding plugin and i am also learning
Thanks

much appreciated
1 ano atrás
I don't think nopC would split the line items like that.  3.90 is old; maybe it used to? Or, maybe your custom code?
I recommend you set a break point in the code and step through placing an order to see where/why it is done.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.