Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cart session empty #1

Closed
tavicu opened this issue Feb 16, 2015 · 7 comments
Closed

Cart session empty #1

tavicu opened this issue Feb 16, 2015 · 7 comments

Comments

@tavicu
Copy link

tavicu commented Feb 16, 2015

Hi,

I'm having a problem.

In one route i add an item tot the cart with "Cart::add(455, 'Sample Item', 100.99, 2, array());" and in another route i get the items with "Cart::getContent()".

The problem is that Cart::getContent() always return empty.

I checked the session with Session::get() (and the session id) and the items appear but Cart::getContent always return an empty array.

Can you help me please?

Thanks.

@darryldecode
Copy link
Owner

Hi, it looks like there is a problem with your system when persisting sessions. Have you tried to use the normal Session::put() and then do a Session::get() on another route and check if its working?

@tavicu
Copy link
Author

tavicu commented Feb 17, 2015

HI,

Yes, i tried and it's working. The problem is from Cart construct. When i run Cart::getContent() is rewriting session with a blank array. If i add items to cart and then remove the code that overwrites the session from constructor and run getContent everything works ok.

This is the code:

    $this->session->put(
        $this->sessionKey,
        array()
    );

@darryldecode
Copy link
Owner

yes you are right @tavicu. Thank you for your time. I have tagged a new version of it now.

darryldecode pushed a commit that referenced this issue Aug 6, 2015
Add ::class notation and code formatting.
darryldecode pushed a commit that referenced this issue Mar 8, 2017
Changing share to singleton
@Shahnee
Copy link

Shahnee commented Jan 25, 2019

@tavicu. i am facing the same issue can you help me

darryldecode pushed a commit that referenced this issue May 26, 2020
@kaisirahmed
Copy link

sir I am also facing the same issue. Is anyone can help me?

@kaisirahmed
Copy link

HI,

Yes, i tried and it's working. The problem is from Cart construct. When i run Cart::getContent() is rewriting session with a blank array. If i add items to cart and then remove the code that overwrites the session from constructor and run getContent everything works ok.

This is the code:

    $this->session->put(
        $this->sessionKey,
        array()
    );

can you please tell me where should I change?

@kaisirahmed
Copy link

@tavicu sir can you please help me. I am new to use this.

darryldecode pushed a commit that referenced this issue Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants