Basket shipment ApplyShipMethod()

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
adamh
Ensign (ENS)
Ensign (ENS)
Posts: 17
Joined: Fri Nov 14, 2008 11:14 am

Basket shipment ApplyShipMethod()

Post by adamh » Thu Jun 25, 2009 2:37 pm

There is a section of our store where we'd like a separate fully functional shopping basket. The basket will need to be able to display the shipping costs associated with an order. If we use Token.Instance.User.Basket, the following code works like a charm:

Code: Select all

Token.Instance.User.Basket.Save();
Token.Instance.User.Basket.Package();
Token.Instance.User.Basket.Recalculate();

foreach (BasketShipment shipment in Token.Instance.User.Basket.Shipments)
{
	shipment.ApplyShipMethod("ShippingMethod1");
}
Token.Instance.User.Basket.Shipments.Save();
However, when we try to create a new basket instance and use that instead of the token user's basket:

Code: Select all

protected Basket _cart
{
	get
	{
		return (Basket)Session["cart"];
	}
	set
	{
		Session["cart"] = value;
	}
}
...
_cart.Save();
_cart.Package();
_cart.Recalculate();

foreach (BasketShipment shipment in _cart.Shipments)
{
	shipment.ApplyShipMethod("ShippingMethod1");
}
_cart.Shipments.Save();
No shipping method is applied. When we check each shipment in the basket, there no items listed. If we place the order, the shipment(s) is correct, but there will not be any shipping method applied.

Is there any reason why items are not being created in each shipment on the Package() or Recalculate() methods? and why ApplyShipMethod() does not work when using a basket in this manner?

Thanks in advance.

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: Basket shipment ApplyShipMethod()

Post by AbleMods » Mon Aug 03, 2009 8:34 pm

Adam, you ever figure this out? I'm seeing the exact same thing with some testing I'm doing. It's like there's something in the Token basket that isn't created/assigned when do a new Basket(); setup.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

Post Reply