
Originally Posted by
ajmn
...
i’ve placed the following in
PHP Code:
function process_button()
and it caused the button and everything below it (on the 3of3 checkout page) to disappear,
PHP Code:
$last_order_id = $db->Execute("SELECT * FROM " . TABLE_ORDERS . " ORDER BY orders_id DESC limit 1");
$new_order_id = $last_order_id->fields['orders_id'];
$new_order_id = ($new_order_id + 1);
$new_order_id = (string)$new_order_id . '-' . zen_create_random_value(6);
...
Did you remember to declare $db as global in the function? Typically a function using $db looks something like this:
PHP Code:
function getLastOrderId() {
global $db;
$result = $db->Execute(
'SELECT MAX(orders_id) AS `last_id` FROM `' . TABLE_ORDERS . '`';
);
if(!$result->EOF) {
return (int) $result->fields['last_id'];
}
else return -1;
}
When debugging errors the Zen Cart debug logs and your web server's error log are good places to look.
Not sure about the answers to your other questions...