logo
Welcome to our new AbleCommerce forums. As a guest, you may view the information here. To post to this forum, you must have a registered account with us, either as a new user evaluating AbleCommerce or an existing user of the application. For all questions related to the older version of Gold and earlier, please go to AbleCommerce Gold forum. Please use your AbleCommerce username and password to Login. New Registrations are disabled.

Notification

Icon
Error

Options
Go to last post Go to first unread
sweeperqb  
#1 Posted : Wednesday, June 10, 2020 12:33:53 PM(UTC)
sweeperqb

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 5/30/2020(UTC)
Posts: 125

Thanks: 14 times
Was thanked: 3 time(s) in 3 post(s)
In AC7 and Gold R8, OrderShipment.GetItems() returns all of the items on the order instead of the items associated with the shipment. We recently discovered that this was causing problems in AC7 with the rate calculator when there were multiple shipments on the order. The shipping rates were being calculated on the entire order total and/or weight instead of individual shipments. Is this how it works in AC 9.0.2 as well?

Wanna join the discussion?! Login to your AbleCommerce Forums forum account. New Registrations are disabled.

Joe Payne2  
#2 Posted : Wednesday, June 10, 2020 1:09:52 PM(UTC)
Joe Payne2

Rank: Advanced Member

Groups: HelpDesk, Developers
Joined: 11/9/2018(UTC)
Posts: 564

Thanks: 122 times
Was thanked: 26 time(s) in 25 post(s)
I'm not seeing that issue in either Gold R12 or AC 9.0.2. Both apps use the same identical code in GetItems() and both reference the this.OrderItems child collection. Based on the nHibernate definition file, the only possible result for the child collection would be the orderitems assigned to the specific instance of OrderShipment. Perhaps a customization elsewhere is causing that issue?

Code:

/// <summary>
        /// Gets a collection of items represented by this shipment
        /// </summary>
        /// <returns>A collection of BasketItem objects</returns>
        public virtual IList<BasketItem> GetItems()
        {
            IList<BasketItem> items = new List<BasketItem>();
            if (this.Order != null)
            {
                foreach (OrderItem item in this.OrderItems)
                {
                    items.Add(item.GetBasketItem());
                }
            }
            return items;
        }
sweeperqb  
#3 Posted : Wednesday, June 10, 2020 1:25:41 PM(UTC)
sweeperqb

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 5/30/2020(UTC)
Posts: 125

Thanks: 14 times
Was thanked: 3 time(s) in 3 post(s)
Joe, thanks for responding and posting the source code. Below is the source from CommerceBuilder 7. It was the same for Gold R8. Notice the this.Order.Items.

Looks like it has been fixed in newer versions which is what I was hoping. Appreciate your help!

Code:
/// <summary>
/// Gets a collection of items represented by this shipment
/// </summary>
/// <returns></returns>
public BasketItemCollection GetItems()
{
   BasketItemCollection items = new BasketItemCollection();
   if (this.Order != null)
   {
      foreach (OrderItem item in this.Order.Items)
      {
          items.Add(item.GetBasketItem());
      }
   }
   return items;
}
Joe Payne2  
#4 Posted : Wednesday, June 10, 2020 2:39:07 PM(UTC)
Joe Payne2

Rank: Advanced Member

Groups: HelpDesk, Developers
Joined: 11/9/2018(UTC)
Posts: 564

Thanks: 122 times
Was thanked: 26 time(s) in 25 post(s)
That would certainly do it. Glad we figured it out :)
Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.