Extending Baskets and PurchaseOrders

If I want to add properties to both the Basket and Purchase Order classes, do I have to extend each of them separately? The Documentation says not to extend from OrderForm directly. Also, if the answer is that I indeed need to extend both the PurchaseOrder and Basket classes, how do I map the basket changes since there doesn't appear to be a Basket class for the storage mapping anywhere.

Thanks,

Dave

[423 byte] By [DMAR330] at [2007-12-28]
# 1

Hi Dave,

We ended up extending Basket, PurchaseOrder, and OrderForm classes for our needs.

As for the storage mapping with the basket, it is serialized into the marshalled data field. Because of this you will not need an entry in the OrderObjectMapping.xml file. All fields taken care of by the serialization methods (ctor(SerializationInfo, StreamingContext) and GetObjectData(SerializationInfo, StreamingContext)).

Cheers,
Colin

ColinBowern at 2007-9-3 > top of Msdn Tech,Commerce Server,Commerce Server 2007...
# 2

Colin,

My issue with the basket extensions is that if I have a custom property like "OrderType" that I use to search for baskets/purchase orders by on the front end, and with the orderManageMent context only supporting the basic filtering (equality based search parameters) I'm itching to write my own queries against these tables.

The OrderForm class, while universal to both the basket and PurchaseOrder Class, is too deep down to allow a search, as I would have to pull all baskets/orders back and then filter based on the orderform properties.

I do notice when I create a basket that some of the columns outside of the marshaled_data field are populated. i'd like to add a column and have it populated and I read somewhere that any weak indexer property created in the basket will populate the table automagically if the column and the indexer have the same name. Is there truth to this? I've gotten to the point that I would throw away the entire Order Processing component of CS2007 and only use the catalog piece if I could, but future versions will benefit from this piece so I have to try to stick it :)

I just want to be able to query baskets and orders for custom properties using custom queries I write against the tables, but I need the pertinent information stored in the OrderTemplatesAndBaskets table as well as the PurchaseOrders table and have no idea how to get it there.

Thanks,

Dave

DMAR330 at 2007-9-3 > top of Msdn Tech,Commerce Server,Commerce Server 2007...
# 3
Hey Dave,

Vinod blogged about how to add columns to the OrderTemplatesAndBaskets table.

As for the notion of the automagic with column names it isn't like that anymore with CS2007. The reason being that there was a change in serialization strategy. It's all moving in the right direction towards a full blown entity mapping system. I suspect the next release of ADO.NET and the O/R mapping features will have a heavy influence in where it goes in the next release. I find the extensibility in the order system a whole lot more flexible than the product catalog system.

I would encourage you to extend the classes if you need additional data stored. It's not too crazy if you start simple and slow. You can search various fields using the SearchClause and should be able to add custom fields there as well.

As you experiment feel free to post code snippets as you run into problems. I've extended all of the classes that you are talking about and can offer some help through the particulars.

Cheers,
Colin

ColinBowern at 2007-9-3 > top of Msdn Tech,Commerce Server,Commerce Server 2007...
# 4

Colin,

If you extended PurchaseOrder how did you define the new class since it isn't there by default in the OrderPipelineMappings.xml? Did you just ad a new reference?

Austin Adamson

AustinAdamson at 2007-9-3 > top of Msdn Tech,Commerce Server,Commerce Server 2007...
# 5

Never mind I figured it out.

Thanks

AustinAdamson at 2007-9-3 > top of Msdn Tech,Commerce Server,Commerce Server 2007...