unable to delete a coupon on an order

Questions about how to use the forum and suggestions for new forum topics.


** HOW TO POST HTML CODE SAMPLES.
Post Reply
meulrajput
Ensign (ENS)
Ensign (ENS)
Posts: 16
Joined: Wed Oct 02, 2013 5:48 am

unable to delete a coupon on an order

Post by meulrajput » Wed Oct 02, 2013 7:05 am

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

User avatar
Katie
AbleCommerce Admin
AbleCommerce Admin
Posts: 2651
Joined: Tue Dec 02, 2003 1:54 am
Contact:

Re: unable to delete a coupon on an order

Post by Katie » Fri Oct 04, 2013 8:53 am

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
Thank you for choosing AbleCommerce!

http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support

meulrajput
Ensign (ENS)
Ensign (ENS)
Posts: 16
Joined: Wed Oct 02, 2013 5:48 am

Re: unable to delete a coupon on an order

Post by meulrajput » Mon Oct 07, 2013 2:45 am

Hi,

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

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: unable to delete a coupon on an order

Post by mazhar » Tue Oct 08, 2013 9:21 am

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.

User avatar
Humannature
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 31
Joined: Thu Mar 12, 2009 10:47 pm

Re: unable to delete a coupon on an order

Post by Humannature » Wed Oct 09, 2013 7:58 am

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

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: unable to delete a coupon on an order

Post by mazhar » Wed Oct 09, 2013 8:39 am

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;

User avatar
Humannature
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 31
Joined: Thu Mar 12, 2009 10:47 pm

Re: unable to delete a coupon on an order

Post by Humannature » Wed Oct 09, 2013 11:04 am

Works fine now.

Thanks

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: unable to delete a coupon on an order

Post by jmestep » Thu Oct 10, 2013 5:02 am

Mazhar- that's good to know on the IList. I was using List in places where I needed to sort a list.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

Post Reply