Page 1 of 1

unable to delete a coupon on an order

Posted: Wed Oct 02, 2013 7:05 am
by meulrajput
I found an issue in Ablecommerce r5.
unable to delete a coupon on an order. I put a test order through with a coupon code they have registered and this prompts shows when I click ok the screen does not refresh it just sits there. The system seems to be capable of removing a discount and replacing it with a different one but do you know what is causing the system to not respond?

https://www.dropbox.com/sh/mges9y7bjtmzje1/c_ykQhs1Ne

Re: unable to delete a coupon on an order

Posted: Fri Oct 04, 2013 8:53 am
by Katie
Hi,

I was able to reproduce this myself. It's strange that there is no error. I even enabled script debugging in my browser, but nothing happens when you try to remove the coupon. I have reported this to the dev team, and will update here when I see a response.

Thanks for letting us know.

Katie

Re: unable to delete a coupon on an order

Posted: Mon Oct 07, 2013 2:45 am
by meulrajput
Hi,

Can i solve it i found that in which problem is occurred.?

Re: unable to delete a coupon on an order

Posted: Tue Oct 08, 2013 9:21 am
by mazhar
This is happening due to combining the order coupons. When order coupon is applied we calculate discount for each product being bought and then create a respective coupon discount item for it. It means if your coupon is applying on two products then you will have tow coupon order items each with discount you are saving on respective product. This looked odd on retail side considreing if you have many items you will see many coupon discounts so in order to simplify we combined the coupons for display only. Somehow this made its way into Admin Edit Order items page as well so you see a display only entry in as coupon item which doesn't exist in database hence can't be deleted. In order to fix it you need to apply following change

Edit your Website/Admin/Orders/Edit/EditOrderItems.aspx.cs file and locate following method

Code: Select all

protected IList<OrderItem> GetShipmentItems(int shipmentId)
        {
            return _Order.Items.GetDisplayItems(shipmentId);
        }
and replace it with

Code: Select all

protected IList<OrderItem> GetShipmentItems(int shipmentId)
        {
            IList<OrderItem> newCollection = new List<OrderItem>();
            foreach (OrderItem item in _Order.Items)
            {
                if (item.OrderShipmentId == shipmentId)
                {
                    newCollection.Add(item);
                }
            }

            newCollection.Sort(new OrderItemComparer());
            return newCollection;
        }
save the change and try to edit/delete coupons items.

Re: unable to delete a coupon on an order

Posted: Wed Oct 09, 2013 7:58 am
by Humannature
I tried using this code and got this error.

CS1061: 'System.Collections.Generic.IList<CommerceBuilder.Orders.OrderItem>' does not contain a definition for 'Sort' and no extension method 'Sort' accepting a first argument of type 'System.Collections.Generic.IList<CommerceBuilder.Orders.OrderItem>' could be found (are you missing a using directive or an assembly reference?)

Thanks

Re: unable to delete a coupon on an order

Posted: Wed Oct 09, 2013 8:39 am
by mazhar
My mistake :( I missed the using statement required. Please edit the code file and locate following code

Code: Select all

using CommerceBuilder.Utility;
and update it like

Code: Select all

using CommerceBuilder.Utility;
using CommerceBuilder.Common;

Re: unable to delete a coupon on an order

Posted: Wed Oct 09, 2013 11:04 am
by Humannature
Works fine now.

Thanks

Re: unable to delete a coupon on an order

Posted: Thu Oct 10, 2013 5:02 am
by jmestep
Mazhar- that's good to know on the IList. I was using List in places where I needed to sort a list.