Update current users basket from Database

For general questions and discussions specific to the AbleCommerce GOLD ASP.Net shopping cart software.
Post Reply
Odettes
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 102
Joined: Wed Apr 02, 2008 11:00 am
Location: Stockholm, Sweden
Contact:

Update current users basket from Database

Post by Odettes » Sat Sep 02, 2017 9:04 am

Hi!

I manually add some custom rows to the database table "db_owner.ac_BasketItems" for my current users basket.
How can I force the basket to reload and read my updated rows from database?
Sincerely,
Thomas Berglund

https://traileronline.se
AbleCommerce Gold R11 Custom

jguengerich
Commodore (COMO)
Commodore (COMO)
Posts: 434
Joined: Tue May 07, 2013 1:59 pm

Re: Update current users basket from Database

Post by jguengerich » Tue Sep 05, 2017 3:37 am

You could create BasketItem objects and add them to the collection:

Code: Select all

user.Basket.Items.Add(new BasketItem(...))
// more adds as needed
user.Basket.Save()
instead of adding rows directly to the database. Then recalculate:

Code: Select all

IBasketService preCheckoutService = AbleContext.Resolve<IBasketService>();
preCheckoutService.Recalculate(basket);
Jay

Post Reply