Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Extending the ShoppingCartInfo Class? View modes: 
User avatar
Member
Member
matt-awg - 1/3/2013 11:36:04 AM
   
Extending the ShoppingCartInfo Class?
I am doing some custom shipping calculations using a custom ShippingOptionInfoProvider. I am overriding the CalculateShippingInternal method which accepts a ShoppingCartInfo object as a parameter. I have it working except for one problem, I need to pass some additional information into this function but I don't want to change the function definition since then I have to touch everywhere that calls this. I am thinking the ideal way to do this is to extend the ShoppingCartInfo class and add a custom property so I can add the value for that property in the custom shopping cart code I have added and then I can access this property on the shoppingCartInfo object being passed in to the CalculateShippingInternal method already. At least, I think this could work. Is this possible and if so, how do I go about doing it? If not, do you have any other suggestion as to how I can pass data into this custom ShippingOptionInfoProvider from the custom cart step I created?

User avatar
Member
Member
Accepted solutionAccepted solution
matt-awg - 1/4/2013 11:50:34 AM
   
RE:Extending the ShoppingCartInfo Class?
I spoke with Support about this, so just in case anyone else is curious, the solution they suggested was to use the ShoppingCartCustomData of the ShoppingCartInfo object. The only reason I did not try that originally is that I wanted to pass in a DataTable and I did not think that would work. But then I thought about converting the DataTable into XML and storing that in the ShoppingCartCustomData and then in the CalculateShippingInternal I can access the XML string from the ShoppingCartCustomData and then convert the XML back into a DataTable. It required putting the DataTable inside a data set and then serializing the dataset.