Custom Fields on Order

Store UI, layout, design, look and feel; Discussion on the customer facing pages of your online store. Cascading Style Sheets, Themes, Scriptlets, NVelocity and the components in the ConLib directory.
Post Reply
gturner00
Ensign (ENS)
Ensign (ENS)
Posts: 4
Joined: Tue Nov 27, 2007 1:12 pm

Custom Fields on Order

Post by gturner00 » Thu Mar 06, 2008 11:29 am

I would like to know the best way to add custom fields to an Order. I was considering a couple different approaches but both have negatives which I'm trying to avoid.

One of my requirements is to be able to filter an order by a custom field. For example, I need to add a new field to Order called PatientName. When I call OrderDataSource.LoadForCriteria(..) I need to filter by the PatientName field.

One suggestion I saw was to create a second table for the additional fields and use the OrderId as a foreign key on my custom table. The problem here is that I can’t search for an order using criteria from my custom table. It’s also a problem because I can’t show the data in the same result set. This forces me to display order first and then lookup the additional order information in a second query.

A second option is to extend the Order, OrderCollection and OrderDataSource classes. I could add new properties to the Order, and override the OrderDataSource methods. Then instead of using the CommerceBuilder.Orders.Order I could use my custom Order.

The preferred approach for us is to add new properties to the Order class and add the corresponding fields to the Orders table. Without source code, this isn’t possible either. I understand this breaks upgrade support and that's not an issue for us. We're using the API as a platform and starting point for a larger application.

I would appreciate feedback as to the best approach and the ones that adheres the closest to existing AC architecture.

Thanks!

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

Re: Custom Fields on Order

Post by AbleMods » Thu Mar 06, 2008 2:59 pm

I can't modify classes either. My only solution was to create external tables, class them and develop methods. It's important to me keep the future-upgrades-still-compatible scenario alive.

AC7 is brand new - you're going to want at least a few of the future updates. Excluding yourself now from upgrades will most likely have painful repercussions later in life.

What I do is search my custom table first and return a custom data class that includes the AC7 class as part of it. Then I have both my data strongly-typed and all the functionality of the Able class I've included.
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
bha
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 44
Joined: Tue Mar 11, 2008 6:04 pm

Re: Custom Fields on Order

Post by bha » Sat Apr 12, 2008 9:52 am

Hello gturner. Have you or anyone else found a good method to do this?

I am looking for the same feature: to be able to get more control over the custom fields.

In fact I would like to pull up a grid populated with all records matching a particular custom field and sort by another custom field and be able to edit this grid.

Thanks,
Bruce.

User avatar
m_plugables
Commander (CMDR)
Commander (CMDR)
Posts: 149
Joined: Tue Mar 11, 2008 12:44 am
Contact:

Re: Custom Fields on Order

Post by m_plugables » Tue Apr 15, 2008 2:10 am

I can't modify classes either. My only solution was to create external tables, class them and develop methods. It's important to me keep the future-upgrades-still-compatible scenario alive.
Agreed with you. I think Custom table + custom data warper is the best solution in this case for some one who is going to implement this.
Image
Visit the links below to Download Plugins for your AC7 Store
http://www.plugables.com
http://blog.plugables.com

Post Reply