I'm migrating an older Able 7.x install that was heavily customized. It makes use of OrderSearchCriteria.
But in Gold R12, we also have the OrderFilter class.
So, is one better than the other? Should I be migrating the customizations to the newer class?
The code looks pretty similar, I couldn't really see much difference aside from OrderFilter uses a different technique for the keyword search.
Should I be using OrderFilter?
OrderSearchCriteria versus OrderFilter classes
OrderSearchCriteria versus OrderFilter classes
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
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
Re: OrderSearchCriteria versus OrderFilter classes
I think OrderFilter was introduced for data export criteria. Considering you are porting customization you should be using OrderSearchCriteria.
Re: OrderSearchCriteria versus OrderFilter classes
Ok apparently you guys aren't using OrderSearchCriteria at all
I found a few issues migrating my code:
At the end of ICriteria GetSearchCriteria(OrderSearchCriteria searchCriteria, string sortExpression, bool count), you're testing to see if some child tables need to be joined:
The only problem is there is no child class called 'OrderShipments' on the Order class. It got renamed to 'Shipments' when Gold was built. Same thing for OrderNotes. Now it's called 'Notes'.
Easy fix, but necessary if you ever want to use the Search() method with OrderSearchCriteria. Thought you'd want to know.

I found a few issues migrating my code:
At the end of ICriteria GetSearchCriteria(OrderSearchCriteria searchCriteria, string sortExpression, bool count), you're testing to see if some child tables need to be joined:
Code: Select all
if (joinOrderShipments) criteria.CreateCriteria("O.OrderShipments", "OS", NHibernate.SqlCommand.JoinType.InnerJoin);
if (joinOrderNotes) criteria.CreateCriteria("O.OrderNotes", "ON", NHibernate.SqlCommand.JoinType.InnerJoin);
Easy fix, but necessary if you ever want to use the Search() method with OrderSearchCriteria. Thought you'd want to know.
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
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
Re: OrderSearchCriteria versus OrderFilter classes
Nice catch! I just reported this in our logs though I am surprised why no one came across this so far.
Re: OrderSearchCriteria versus OrderFilter classes
Thanks, I must be the last guy still using it 
In the end I found it easier to customize than OrderFilter. My changes involve adding some additional search fields for a few new fields in order shipments. In OrderFilter, this is much harder because you're only bringing in ac_OrderShipments if a keyword is specified. But in OrderSearchCriteria it's designed differently so the optional join is easier to implement.

In the end I found it easier to customize than OrderFilter. My changes involve adding some additional search fields for a few new fields in order shipments. In OrderFilter, this is much harder because you're only bringing in ac_OrderShipments if a keyword is specified. But in OrderSearchCriteria it's designed differently so the optional join is easier to implement.
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
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