Map BasketItemID to OrderItemId

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
User avatar
deverill
Lieutenant (LT)
Lieutenant (LT)
Posts: 64
Joined: Tue Jan 06, 2009 11:58 am
Location: Key West, FL
Contact:

Map BasketItemID to OrderItemId

Post by deverill » Thu Jun 16, 2011 7:06 am

Hi,
We are using 7.0.6 and have a need to map the BasketItemID for each product purchased to the corresponding OrderItemID.

Items are placed into the basket and each has a BasketItemID number. When the order is purchased and basket.Checkout is called it returns only the OrderID and I can find no link between BasketItemID and OrderItemId. Is there none or am I missing something?

The reason for needing this is involved and goes outside AbleCommerce to a reservation system we are trying to link with so I'm leaving the why's out.

Thanks!
Jim
Jim Sewell - Web Programmer
Trusted Tours & Attractions

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

Re: Map BasketItemID to OrderItemId

Post by AbleMods » Fri Jun 17, 2011 7:59 am

BasketItemId will be lost once the basket is checked out - the basket is cleared and the data in ac_BasketItems is deleted. That's why no reference is kept post checkout - the originating data is deleted upon checkout.

You could tie it together (manually) by setting the _BasketItem.LineMessage field to the _BasketItem.BasketItemId value when checkout is first loaded. The LineMessage field for each line item is passed through checkout to the corresponding OrderItem object LineMessage field.
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

User avatar
deverill
Lieutenant (LT)
Lieutenant (LT)
Posts: 64
Joined: Tue Jan 06, 2009 11:58 am
Location: Key West, FL
Contact:

Re: Map BasketItemID to OrderItemId

Post by deverill » Fri Jun 17, 2011 9:09 am

I'm sorry, Joe and others, I'm not explaining myself very well. Let me try again:

With our tour ticket sales, we already have a customization that puts ticket use date information into the LineMessage field in the basket which then passes to the order where we need to read it. That works great.

We have another piece of data (reservation number) that needs to go across and I thought GiftMessage would be a good holder for it, but I'm having trouble getting it to even write to the table, much less pass to the order table.

Code: Select all

basketItem.LineMessage = reservationDate.ToShortDateString(); // works already
basketItem.GiftMessage = "xyzzy";  // doesn't work
In fact, not only does it not survive Basket.Checkout, I can't even see it go into the ac_BasketItems table with my DB viewer. It's as if my request is totally ignored.

At the end of the sale/checkout when our back-office code needs to know the reservation number linked with each line-item we currently have no working way for this to happen. If I could just write the reservation number into a field in the basket and have it survive checkout so I can read it from the orderitems table I could make this work.

How can I add this reservation number to a product in the basket and have it readable for that same product after checkout from the order table?
Jim Sewell - Web Programmer
Trusted Tours & Attractions

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

Re: Map BasketItemID to OrderItemId

Post by AbleMods » Fri Jun 17, 2011 9:27 am

Ok wasn't aware you were already using the line message.

You could code it with a separator and still use the same field for both purposes. Often I'll use the vertical bar (|) to parse various parameters in the same single field. Then it's a simple matter of parsing it back out on the other side.

Doesn't the basketitem class have a customfields sub-class? I believe it's a dictionary string/string pair. You could use that IF it's passed through checkout - not sure if it is or not.
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

User avatar
deverill
Lieutenant (LT)
Lieutenant (LT)
Posts: 64
Joined: Tue Jan 06, 2009 11:58 am
Location: Key West, FL
Contact:

Re: Map BasketItemID to OrderItemId

Post by deverill » Fri Jun 17, 2011 9:45 am

The customfields did survive the checkout! I must have done something wrong when I tested it yesterday but it does work and I'm on my way.

Thanks, Joe!
Jim Sewell - Web Programmer
Trusted Tours & Attractions

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

Re: Map BasketItemID to OrderItemId

Post by AbleMods » Fri Jun 17, 2011 10:00 am

Glad to help !
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