Post by RJonesUSC » Thu Mar 10, 2011 4:52 am

Initially, from reading other threads, I thought that items, qty cart data was being saved in a cookie. Is this correct or is it being stored in the database somewhere? Just today I logged into a computer that I hadn't used before and logged in and there were already items in my cart - items that I had added when using another workstation.

Is the cart info located in the database somewhere and if so, what table?

Thanks in advance.

New member

Posts

Joined
Tue Feb 15, 2011 4:03 am

Post by RJonesUSC » Fri Mar 11, 2011 5:32 am

OK, I see where it's stored in the db - duh. Can someone decode the syntax of how the data is stored in the field? Here are a couple examples of cart records:

Code: Select all

a:1:{i:69;i:20;}

Code: Select all

a:3:{i:49;i:100;i:55;i:10;i:59;i:10;}
the a I have no idea. The 1 and 3 at the beginning looks to be the number of cart items. It looks like in the top cart there's qty 20 of item #69. The second cart looks to have 100xitem#49, 10xitem#55 and 10xitem#59.

None of those use options but they all use discount pricing. Is that info stored in there or somewhere else or is the db being queried every time to display the correct pricing information?

What are the i's for?

New member

Posts

Joined
Tue Feb 15, 2011 4:03 am

Post by Qphoria » Fri Mar 11, 2011 6:17 am

php has a function called "serialize"
It basically takes an array and combines it into 1 line... kinda like a zip file
Similarly, you can unzip or "unserialize" that

But still even when unserialized it probably won't make much sense to you.

It is basically the product id, the options, and the qty

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by RJonesUSC » Fri Mar 11, 2011 6:32 am

Qphoria wrote:php has a function called "serialize"
It basically takes an array and combines it into 1 line... kinda like a zip file
Similarly, you can unzip or "unserialize" that

But still even when unserialized it probably won't make much sense to you.

It is basically the product id, the options, and the qty
Qphoria, thanks for the reply. It could make sense to me. I figured out the qty and product id, didn't I? ;)

Is discount in there anywhere? In my setup, all prices are using a discount of some sort. Or is the DB queried every time to check to a discount whenever the cart prices are displayed?

I'm really looking to display the cart contents on a page outside of the OC system. I've gotten as far as getting the customer and their cart contents and qty but not prices. I could always just query the db to get the info but I was hoping the prices were stored elsewhere, possibly in the cart record. But it doesn't look like that's the case. Is that correct?

New member

Posts

Joined
Tue Feb 15, 2011 4:03 am

Post by Xsecrets » Fri Mar 11, 2011 7:00 am

RJonesUSC wrote:
Qphoria wrote:php has a function called "serialize"
It basically takes an array and combines it into 1 line... kinda like a zip file
Similarly, you can unzip or "unserialize" that

But still even when unserialized it probably won't make much sense to you.

It is basically the product id, the options, and the qty
Qphoria, thanks for the reply. It could make sense to me. I figured out the qty and product id, didn't I? ;)

Is discount in there anywhere? In my setup, all prices are using a discount of some sort. Or is the DB queried every time to check to a discount whenever the cart prices are displayed?

I'm really looking to display the cart contents on a page outside of the OC system. I've gotten as far as getting the customer and their cart contents and qty but not prices. I could always just query the db to get the info but I was hoping the prices were stored elsewhere, possibly in the cart record. But it doesn't look like that's the case. Is that correct?
no prices are not stored anywhere for the cart. only the product id the qty and the options. everything else is queried each time.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by RJonesUSC » Fri Mar 11, 2011 7:03 am

Xsecrets, thanks for the clarification. Now I know how I need to proceed.

New member

Posts

Joined
Tue Feb 15, 2011 4:03 am

Post by armadillocreative » Thu Apr 21, 2011 5:13 pm

i'm obviously blind but what table stores the cart info?


Posts

Joined
Thu Apr 21, 2011 4:28 pm

Post by RJonesUSC » Thu Apr 21, 2011 10:14 pm

armadillocreative wrote:i'm obviously blind but what table stores the cart info?
In the "customer" table there is a field named "cart".

New member

Posts

Joined
Tue Feb 15, 2011 4:03 am

Post by oyuka » Wed Sep 18, 2013 11:31 pm

I am new to opencart and I want to know in which table the cart items are stored wen an user is not logged in and before the checkout? ???

Newbie

Posts

Joined
Wed Sep 18, 2013 11:29 pm

Post by RJonesUSC » Thu Sep 19, 2013 12:47 am

oyuka wrote:I am new to opencart and I want to know in which table the cart items are stored wen an user is not logged in and before the checkout? ???
Check out the post right above yours. :o

New member

Posts

Joined
Tue Feb 15, 2011 4:03 am

Post by Qphoria » Thu Sep 19, 2013 1:23 am

Just to note, the data in the "cart" field is serialized so you'll have to unserialize it first

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by adriankoooo » Thu Mar 24, 2016 4:29 am

A quick question: how long is stored the cart data in 1.5.x?

Active Member

Posts

Joined
Thu Mar 03, 2011 6:52 am


Post by Qphoria » Thu Mar 24, 2016 10:10 pm

adriankoooo wrote:A quick question: how long is stored the cart data in 1.5.x?

1.x-2.0.x the cart is serialized and stored indefinitely in the customer table under the "cart" column
2.1.x+ the cart has its own table now but is still stored indefinitely.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am
Who is online

Users browsing this forum: No registered users and 209 guests