
Originally Posted by
JohnH
I'm trying to access the temporary basket data, but I can't seem to find it anywhere. I'd expect it to be in the customers_basket table, but it remains empty no matter what I add to my cart (I'm assuming that's an obsolete table). I've also tried a session dump, but there's nothing there. I've even checked query logs.
Where's the data go?
Thanks in advance for any help you can give. I'm using version 1.5.4
No, the customers_basket table is not obsolete, but it doesn't hold the data that you think it does anyway.
As I/we have no idea what you are actually trying to do, or which part of the process you are trying to do it, it is difficult to tell you where to find what it is you are seeking.
One place to start is $_SESSION['cart']
Something like this should work
Code:
$products = $_SESSION['cart']->get_products();
if(is_array($products)) {
foreach ($products as $item) {
Do stuff
}
}
However, depending on where you are in the code, and what you are trying to achieve, the
$_SESSION['order_summary'] may be more suitable, and if the order has been completed you'll need to read the data from the orders_x tables.
I'm pretty sure that there are even other array variables in various pieces of the code that will also be holding the data you need. - The code snippet above, for example is using a somewhat arbitrary named variable called $products that can be 'reused' without having to repopulate it via the $_SESSION['cart']->get_products();
So, although the question appear quite simple, the answers are many and varied.
This should be enough to get you on you way though.
Cheers
RodG