
Originally Posted by
limelites
Thanks for posting this fix, works like a charm for me. I'm so glad to have my bailed carts and single user tracking back that I couldn't carre less about the time checks. Thank you!
After running without the time test for a while.... its is needed.
I went back and started testing to see what or how to do time... and I think its a difference in MySQL database time and server or scripting time.... anyway, inshort, found that using the standard NOW() in the SQL statement to store the time was setting the clock different then the server time. (I changed the time in php.ini not the PC) Put the checks back in as they was and add this line above them.. line in red.
Code:
$arrived_time = date('Y-m-d H:i:s', time());
$thirty_mins_ago = date('Y-m-d H:i:s', (time() - (30*60)));
Then down near the bottom make the changes to the SQL statements that are in red..
Code:
$db->Execute("UPDATE " . TABLE_SUPERTRACKER . "
SET last_click = '" . $arrived_time . "',
exit_page='" . zen_db_input(zen_db_prepare_input(urldecode($_SERVER['REQUEST_URI']))) . "',
exit_page_name='" . $page_title . "',
num_clicks=num_clicks+1,
added_cart='" . zen_db_input($tracking_data->fields['added_cart']) . "',
categories_viewed='" . zen_db_input($categories_viewed) . "',
products_viewed='" . zen_db_input($tracking_data->fields['products_viewed']) . "',
customer_id='" . (int)$customer_id . "',
completed_purchase='" . zen_db_input($completed_purchase) . "',
cart_contents='" . zen_db_input($cart_contents) . "',
cart_total = '" . zen_db_input($cart_total) . "',
order_id = '" . (int)$order_id . "'
WHERE tracking_id='" . (int)$tracking_data->fields['tracking_id'] . "'");
and in the next set below the last one...
Code:
$db->Execute("INSERT INTO " . TABLE_SUPERTRACKER . "
(ip_address,
browser_string,
country_code,
customer_id,
referrer,
referrer_query_string,
landing_page,
landing_page_name,
exit_page,
exit_page_name,
time_arrived,
last_click,
products_viewed)
VALUES ('" . zen_db_input($_SERVER['REMOTE_ADDR']) . "',
'" . zen_db_input($user_agent) . "',
'" . $country_code . "',
'" . (int)$_SESSION['customer_id'] . "',
'" . zen_db_input($referrer) . "',
'" . zen_db_input($referrer_query_string) . "',
'" . $this_page . "',
'" . $page_title . "',
'" . $this_page . "',
'" . $page_title . "',
'" . $arrived_time . "',
'" . $arrived_time . "',
'" . zen_db_input($products_viewed) . "')");
This is working for me so far.... you can test this on a testing server by setting the php.ini timezone to something other then your PC timezone....
What you see in the code above may be different then what you have in your file..... Please edit and not copy&paste.... then backup your database before running the code....