Sublime directory Surf the web anonymous Pagerank Monitor


Empty rows on EXIT

bavo
Thu 14 September 2006, 08:45 am GMT +0300
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 ??

olaf
Thu 14 September 2006, 08:49 am GMT +0300
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...

bavo
Thu 14 September 2006, 10:14 am GMT +0300
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.

olaf
Thu 14 September 2006, 11:00 am GMT +0300
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$customerVALID_UNTIL 86400);
} else {
$sql sprintf("DELETE FROM %s WHERE open = 'y' AND order_date < (NOW() - %d)"ORDERSVALID_UNTIL 86400);
}
$sql .= ($remove_only_zeros) ? " AND customer = 0" "";
mysql_query($sql);
}


bavo
Thu 14 September 2006, 11:26 am GMT +0300
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 ??

olaf
Thu 14 September 2006, 12:12 pm GMT +0300
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...

bavo
Thu 14 September 2006, 05:42 pm GMT +0300
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 ??

olaf
Thu 14 September 2006, 10:55 pm GMT +0300

By the way, is there a good reason why you don't remove the rows and shipment record that belong to the "old" order ??

yes I saw this today, normally they have to be removed too...Will change this (soon)

bavo
Thu 14 September 2006, 11:06 pm GMT +0300
OK that good news.

Everything works fine now. Good site and wel though of solutions for problems we all have.

Thank you

olaf
Thu 14 September 2006, 11:23 pm GMT +0300
OK that good news.

Everything works fine now. Good site and wel though of solutions for problems we all have.

Thank you

You're welcome, the reason why I started my own projects was: having some easy to use tools!

bavo
Thu 14 September 2006, 11:25 pm GMT +0300
And they are ... :)

Archive for SMF v1.00 by N.P. Valid XHTML 1.0 Transitional