Welcome Guest, Not a member yet? Register   Sign In
Cart library in Codeigniter
#1

[eluser]fatangel26[/eluser]
- Hello everybody, today, i have a problem. I have two website use Cart library in Codeigniter. When I add a product in the first website, the cart in second website appear this product, althought this product don't have in the second website. How to fix problem ?. Sorry for my English. Thanks
#2

[eluser]WanWizard[/eluser]
The two websites share the session? Cart data is stored in the user session, so if the session is shared, so is the cart.

You can work around that by extending the Cart class to MY_Cart, search for the methods that use $this->CI->session->userdata('cart_contents'), and overload these methods replacing this with a variable name instead of the hard-coded 'cart_contents'.
#3

[eluser]fatangel26[/eluser]
- Thanks for reply, but i don't understand.I want to have a solution to fix the issue.
#4

[eluser]WanWizard[/eluser]
You first have to understand the problem before you can have a solution. And I think I described the problem.

So, do these two sites share the same session? If so, then fix it by making sure both sites have their own session, or or fix the cart library as I described if you require the session to be shared.

If you want me to fix it, fine, send me a PM and we'll discuss my hourly rate...
#5

[eluser]fatangel26[/eluser]
- Thanks Wizard, i resolved this problem. As i think, cart library use the session has name 'cart_contents' and two website are used the name. To fix this problem, i change the name of the cart session. But, i think CI should have a mechanism to create unique cart session name.




Theme © iAndrew 2016 - Forum software by © MyBB