CodeIgniter Forums
2 or More Different Cart - Printable Version

+- CodeIgniter Forums (
+-- Forum: Using CodeIgniter (
+--- Forum: General Help (
+--- Thread: 2 or More Different Cart (/thread-62665.html)

2 or More Different Cart - Maaacoooo - 08-11-2015

Can I have 2 different carts in CodeIgniter?
Because I am using cart for Product Orders, and I will be using another cart for Product Returns. I want to specify the different carts so that there will be different sessions. How can I specify the specific each cart?

I don't want the "Return Cart" will show the data of "Orders Cart", since they will definitely have the same session. That is why I wanted to specify the Carts so that the session data will differ.

I hope anyone can help

RE: 2 or More Different Cart - Wouter60 - 08-12-2015

It should work if you create 2 instances of the shopping cart class:

PHP Code:
$this->load->library'cart''''product_orders' );
$this->load->library'cart''''product_returns' );


RE: 2 or More Different Cart - PaulD - 08-15-2015


"The Cart library is DEPRECATED and should not be used. It is currently only kept for backwards compatibility."

Just thought it might help to mention that. If you write your own cart you can easily have two, although I would have one cart per session and use an identifier to distinguish between a sale or a return. You can then use the data however you wish.

I use a temp_cart table linking the session to the cart. A clean up procedure keeps the table small, removing carts with expired sessions if need be.

Best wishes,