Record shipping module
Posted: Fri Mar 10, 2023 4:32 am
Need bit help on session variables.
This is from a really old module.
It is used to record the shipping method used upon checkout.
This is from a really old module.
It is used to record the shipping method used upon checkout.
Code: Select all
public function execute() {
global $PHP_SELF, $customer_id, $order_id, $shipping, $shipping_module;
if ( isset($_SESSION['customer_id']) || isset($_SESSION['customer_is_guest'])) {
switch ( basename($PHP_SELF) ) {
case 'checkout_confirmation.php' :
if (!isset($_SESSION['shipping_module'])) {
$_SESSION['shipping_module'] = $_SESSION['shipping']['id'];
$shipping_module = $shipping['id'];
}
break;
case 'checkout_success.php' :
if ( isset($_SESSION['shipping_module'] )) {
unset($_SESSION['shipping_module']);
$sql_data_array = array('shipping_module' => $shipping_module);
$GLOBALS['db']->perform('orders', $sql_data_array, 'update' , "orders_id = '" . (int)$order_id . "'");
}
} // end switch page
} // endif customer_id registered
}