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?
|
|
|
|
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;
}
|
|
|
|
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;
}
|
|
|
|
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 :)
|
|
|
|
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.
Important Information:
The AbleCommerce Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close