Kill the googlebot
Posts: 6
40 credits Members referred : 0
« on: Sep 14, 2006, 07:45:37 am »
Hi Olaf,
I'am succesfully using your db_class for my shoppingcart. I have one problem: When a user fills his shopping cart (i use the cart with NO customerstable) and then exits the browser without deleting or bying the order a empty trace exists in the database tables. How ca i resolve that problem ??
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
It's time to use PHP5!
« Reply #1 on: Sep 14, 2006, 07:49:02 am »
the only way to do this is that the user has to login first, without customer information there is no chance. The class is using a database and not cookies...
Kill the googlebot
Posts: 6
40 credits Members referred : 0
« Reply #2 on: Sep 14, 2006, 09:14:19 am »
Yes i know that, but i mean the order tables. Also when i use random customnumbers as if there was a customer the order rows, order and shipment table are left half filled when i exit the browser.
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
Yes i know that, but i mean the order tables. Also when i use random customnumbers as if there was a customer the order rows, order and shipment table are left half filled when i exit the browser.
there is this kind of function (don't see the problem)
Code:
<?php function remove_old_orders($customer, $remove_only_zeros = true) { if (RECOVER_ORDER && $customer > 0) { $sql = sprintf("DELETE FROM %s WHERE open = 'y' AND customer = %d AND order_date < (NOW() - %d)", ORDERS, $customer, VALID_UNTIL * 86400); } else { $sql = sprintf("DELETE FROM %s WHERE open = 'y' AND order_date < (NOW() - %d)", ORDERS, VALID_UNTIL * 86400); } $sql .= ($remove_only_zeros) ? " AND customer = 0" : ""; mysql_query($sql); }
Kill the googlebot
Posts: 6
40 credits Members referred : 0
« Reply #4 on: Sep 14, 2006, 10:26:54 am »
Ok i've seen that function, do suggest i call it on exit of the browser ??
How do you use this class without customers anyway ? i mean how did you designed it. Do you use customer =0 everywhere are something else ??
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
It's time to use PHP5!
« Reply #5 on: Sep 14, 2006, 11:12:11 am »
Quote
Ok i've seen that function, do suggest i call it on exit of the browser ??
you don't need to it's based on the customer ID (zero)
Quote
How do you use this class without customers anyway ? i mean how did you designed it. Do you use customer =0 everywhere are something else ??
if you use a "0" in place of a customer number everything has to work fine...
Kill the googlebot
Posts: 6
40 credits Members referred : 0
« Reply #6 on: Sep 14, 2006, 04:42:29 pm »
Greate, now i discovered my problem. In your class you call remove_old_orders after get_order. Now when i use customer as 0 the remove_old_orders delete's the new order again. Thats also whats leaving the empty records in the database. If i comment out the remove fun tion it works fine.
By the way, is there a good reason why you don't remove the rows and shipment record that belong to the "old" order ??
« Last Edit: Sep 14, 2006, 04:54:02 pm by bavo »
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374