Page 1 of 1

Customers cart contents

Posted: Tue May 04, 2021 12:14 am
by st_man
Is there a way to look at what a person has saved in their cart even if they are not registered but are online? Where is that info saved? PHPMYAdmin database or some kind of session variable on their machine?

Re: Customers cart contents

Posted: Tue May 04, 2021 1:57 am
by ADD Creative
What version?

Re: Customers cart contents

Posted: Tue May 04, 2021 6:31 am
by st_man
1.4.6.5

Re: Customers cart contents

Posted: Tue May 04, 2021 9:45 am
by straightlight
Previous generation.

Re: Customers cart contents

Posted: Tue May 04, 2021 4:34 pm
by ADD Creative
It's stored in the session data for guests. For registered customers who are logged in, it's also stored in the cart column of the oc_customer table in the database.

Re: Customers cart contents

Posted: Thu May 06, 2021 8:36 am
by st_man
How can I access the session data. Specifically, I wanted to see the cart contents of a person shopping on my site. They are not registered.
Can you explain as I am not a Opencart expert.
Thanks

Re: Customers cart contents

Posted: Thu May 06, 2021 11:32 pm
by ADD Creative
You would need to look in the session_save_path. You would probably have to deserialize the session data and then find the correct session.

Re: Customers cart contents

Posted: Fri May 07, 2021 9:01 pm
by straightlight
st_man wrote:
Thu May 06, 2021 8:36 am
How can I access the session data. Specifically, I wanted to see the cart contents of a person shopping on my site. They are not registered.
Can you explain as I am not a Opencart expert.
Thanks
Since the session data is converted into an array from the system/library/cart/cart.php file - > getProducts() method, from a controller, you could call the:

Code: Select all

$cart_products = $this->cart->getProducts();
Then, fetch the array and add the required conditions into the loop.