Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

E-Commerce Modules /

Discuss about the various e-commerce modules available:
Ecommerce, SS Shop, SilverCart and SwipeStripe
Alternatively, have a look the shared mailinglist.

Moderators: martimiz, Nicolaas, Sean, Ed, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba

How to extend info stored in the Cart?


Go to End


5 Posts   970 Views

Avatar
mattconfusion

Community Member, 48 Posts

1 September 2010 at 8:22pm

How can I store additional data in the cart, by an extension or somthing? I looked at the module trying to figure out the data model (using also an old graph by the previous releases of e-commerce) but could not come up with anything. I'm using the 0.61 beta

Avatar
Bambii7

Community Member, 254 Posts

2 September 2010 at 12:54pm

What are you trying to store? I read somewhere on the google code project the cart variables were going to be stored in the database not in sessions....
The current session logic is inside ecommerce/code/model/ShoppingCart.php
you can see the functions add_item() around line 138

Hope that helps

Avatar
mattconfusion

Community Member, 48 Posts

2 September 2010 at 7:05pm

I'm trying to have additional info in the Cart, info i take from my extended product class. For example, storing in a row of the cart the color, dimension and other variablesi have in the extended product, stuff like that. If I' getting this in the right way, I would have to extend something like ProductExtended_OrderItem... but first question: how I have to write all the functions found in classes such as Product_OrderItem?
Having made this, I would have to modify the function addItem at line 407 to have it handle my ProductExtended model. But how I can do it without patching the original code? I could do a custom class like MyShoppigCart and have silverstripe look on it with usecustomclass like Object::useCustomClass('ShoppingCart', 'MyShoppingCart', true);
Would it work? any other ways?

Avatar
mattconfusion

Community Member, 48 Posts

2 September 2010 at 7:23pm

I must add I did not use Product Variations but rather custom classes I made.

Avatar
mattconfusion

Community Member, 48 Posts

2 September 2010 at 8:02pm

changed my ecommerce source to branch "BURNBRIGHT_DBCART", so shopping cart is really different and now IT IS in the database, suggestion again?