CodeIgniter Forums

Full Version: 2 or More Different Cart
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
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' );

$this->product_orders->...
$this->product_returns->... 
Hi,

"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,

Paul.