Passing variable value from module file to template file
Posted: Thu Oct 05, 2023 2:39 am
Hi,
I wanted to add "Order Status" to the order notification email. I achieved that by using the following SQL query in the template file <<tpl_n_checkout.php>>:
I think making the SQL query in the template file is not the right thing to do. But how do I do the query in the main module file <<n_checkout.php>> and then pass the value of $order_status to the template file?
Any assistance would be highly appreciated.
Phoenix = v1.0.8.20
PHP = 7.4
Thanks, Eddy
I wanted to add "Order Status" to the order notification email. I achieved that by using the following SQL query in the template file <<tpl_n_checkout.php>>:
Code: Select all
$q = $GLOBALS['db']->query( "SELECT orders_status_name FROM orders_status INNER JOIN orders ON orders_status.orders_status_id = orders.orders_status WHERE orders.orders_id = {$order->get_id()};" );
$statuses = $q->fetch_assoc();
foreach ($statuses as $status) {
$order_status = $status;
}
Any assistance would be highly appreciated.
Phoenix = v1.0.8.20
PHP = 7.4
Thanks, Eddy