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.

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, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba, simon_w

How to extend info stored in the Cart?


5 Posts   673 Views


1 September 2010 at 8:22pm Community Member, 48 Posts

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


2 September 2010 at 12:54pm Community Member, 254 Posts

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


2 September 2010 at 7:05pm Community Member, 48 Posts

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?


2 September 2010 at 7:23pm Community Member, 48 Posts

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


2 September 2010 at 8:02pm Community Member, 48 Posts

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