Where does the Basket Convert to an Order?

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
TheChris
Ensign (ENS)
Ensign (ENS)
Posts: 11
Joined: Mon Nov 03, 2008 10:55 am

Where does the Basket Convert to an Order?

Post by TheChris » Fri Jun 19, 2009 12:13 pm

The Situation:

We have a client using the Able Commerce Store. They wish to allow the user to attach notes to each individual item in their basket. This functionality was added with relatively few issues. We have an additional table that ties the note to a BasketItemId.

My Assumption:

I could be wrong, but through several hours of reading code and checking the DB tables I'm under the impression that when a user checks out their basket is destroyed, and a new order is created from the basket.

The Problem:

I have not been able to figure out when the basket is destroyed and the order is created. This is preventing me from figuring out what OrderItemId to tie the notes to after the checkout occurs. If I could tie into the event, or method that destroys the basket and creates the order I could easily migrate the notes from the BasketItemId to the OrderItemId.

Notable Info:

We did find event handlers for a CheckingOut event, and a CheckedOut event in the onepagecheckout files. However, our initial attempt to tie into this has failed. These handlers never seemed to fire through multiple tests.

If anyone can help with this, it would be appreciated very much. If more info is required I can certainly provide it

ZLA
Commodore (COMO)
Commodore (COMO)
Posts: 496
Joined: Fri Mar 13, 2009 2:55 pm

Re: Where does the Basket Convert to an Order?

Post by ZLA » Fri Jun 19, 2009 12:31 pm

I don't know if there are other places that might have the same action but I know it happens when you go to checkout. For example, in Conlib/Basket.ascx, CheckoutButton_Click, there is a call to App_Code\BasketHelper.cs SaveBasket method. It loops through the basket checking quantities and such and then calls item.Save(). I believe that is what transfers from basket to order.

In my case, I had a bug that made quantity zero which deleted it from the basket and never added it to the order. item.save was the code that caused that to happen.

Hope that helps.

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Where does the Basket Convert to an Order?

Post by jmestep » Fri Jun 19, 2009 1:08 pm

In Able 5, there was a LineMessage field that you could have showing on each product page. It's still in the basket item and order item tables and in the sourc code class, but I don't remember seeing it on the product display page and it isn't in the product table.
If you put it on the basket page, the input should be saved when the basket items and basket are saved.
B
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

ZLA
Commodore (COMO)
Commodore (COMO)
Posts: 496
Joined: Fri Mar 13, 2009 2:55 pm

Re: Where does the Basket Convert to an Order?

Post by ZLA » Fri Jun 19, 2009 1:49 pm

Before you decide to use LineMessage, you may want to review this thread, viewtopic.php?f=42&t=11123 since linemessage is used for some other system functions, one of which is GoogleCheckout, if I remember correctly.

TheChris
Ensign (ENS)
Ensign (ENS)
Posts: 11
Joined: Mon Nov 03, 2008 10:55 am

Re: Where does the Basket Convert to an Order?

Post by TheChris » Fri Jun 19, 2009 2:56 pm

First let me say thanks for the prompt, and obviously informed, responses.

Ok, it sounds like this LineMessage field may be the answer to the problem. But it could also cause potential issues as some third party functions make use of the LineMessage field. If this is the case then we should be fine, as we're not using any third party features like GoogleCheckout or CertiTax.

So my next question is:

Is the LineMessage field used for anything within the AC store itself?

It doesn't sound like it, but I'd hate to spend a bunch of time to make use of the LineMessage, only to find out I've broken something else.

Thanks Again

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Where does the Basket Convert to an Order?

Post by jmestep » Fri Jun 19, 2009 3:50 pm

I didn't realize that, I must be behind times. You can use a template field and that data stays with the order item.
Here is an example of a site that collects info for flower delivery using template fields.
http://www.gravesitemasters.com/Small-O ... 96C14.aspx
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

ZLA
Commodore (COMO)
Commodore (COMO)
Posts: 496
Joined: Fri Mar 13, 2009 2:55 pm

Re: Where does the Basket Convert to an Order?

Post by ZLA » Fri Jun 19, 2009 4:18 pm

That's what I did in the post I referenced. I used a product template field that was populated by a SQL trigger. Since I already had custom code to hide other system template fields for required textboxes and regular expression validators, it wasn't a stretch to exclude an additional set of fields and display my custom template field differently.

TheChris
Ensign (ENS)
Ensign (ENS)
Posts: 11
Joined: Mon Nov 03, 2008 10:55 am

Re: Where does the Basket Convert to an Order?

Post by TheChris » Tue Jun 23, 2009 9:37 am

I guess I had misinterpreted the initial reply. After looking into the template field suggestion some more it seems that this is the best course to take.

We're having to undo some of the initial changes, but this new method of storing item notes seems much cleaner than our original idea.

Thanks again for the replies. I will reply again with the results of our efforts.

User avatar
Logan Rhodehamel
Developer
Developer
Posts: 4116
Joined: Wed Dec 10, 2003 5:26 pm

Re: Where does the Basket Convert to an Order?

Post by Logan Rhodehamel » Tue Jun 23, 2009 10:56 am

If you are working with 7.0.3 or later, there is a new ability to set custom fields on a basket item and these will be carried over to the order item.

Code: Select all

basketItem.CustomFields["UNIQUE_FIELD_NAME"] = "VALUE";
Provided you use a unique name for your custom field it will not get overwritten.

I did a search... I can't see LineMessage as being used for anything but CertiTAX and that's not even published with our build. So I believe it's safe to use for custom purposes in 7.0.2 and below. For 7.0.3 and above prefer the custom fields notation since it can hold more than one dataitem without being stepped on by others. If you have SQL 2005 or higher the field is nvarchar(max) so there is no real limit to how much data you can track.
Cheers,
Logan
Image.com

If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.

TheChris
Ensign (ENS)
Ensign (ENS)
Posts: 11
Joined: Mon Nov 03, 2008 10:55 am

Re: Where does the Basket Convert to an Order?

Post by TheChris » Fri Jun 26, 2009 8:17 am

Good news!

We were able to use the product templates and everything worked out great.

The custom fields method sounds like it would have worked just as well, however we are using 7.0.2 so it wasn't an option.

Thank you all for your help.

Post Reply