Search the Community
Showing results for tags 'Total orders'.
-
Hello, I want to show the total orders for the current month for the current customer. I create a file: FrontController.php saved in: /override/classes/ with the following content: <?php class FrontController extends FrontControllerCore { public function displayFooter() { global $cookie; $id_customer = $cookie->id_customer; $totalOrders = Db::getInstance()->getValue('SELECT COUNT(*) as total_orders FROM `'._DB_PREFIX_.'orders` WHERE MONTH(`date_add`) = MONTH(NOW()) AND YEAR(`date_add`) = YEAR(NOW()) AND id_customer="'.$id_customer.'"' ); $totalOrderProducts = Db::getInstance()->getValue(' SELECT SUM(total_paid) FROM `' . _DB_PREFIX_ . 'orders` WHERE MONTH(`date_add`) = MONTH(NOW()) AND YEAR(`date_add`) = YEAR(NOW()) AND id_customer="'.$id_customer.'"' ); self::$smarty->assign(array( 'totalOrders' => $totalOrders, 'totalOrderProducts' => $totalOrderProducts)); parent::displayFooter(); } } ?> Then to show the number of order or total current month in header.tpl or footer.tpl I just add: Number of orders: {$totalOrders} Number of order products: {$totalOrderProducts} But to show it in order-address.tpl, it doesn't work, Can somebody help please?
-
Hello, Can you help to get the orders total for a month. I want to show it in the addresses: order.php?step=1 order-address.tpl. I found a solution but it doesn't work!: $totalOrders = Db::getInstance()->executeS('SELECT COUNT(*) as total_orders FROM `'._DB_PREFIX_.'orders` WHERE MONTH(`date_add`) = MONTH(NOW()) AND YEAR(`date_add`) = YEAR(NOW())'); $totalOrderProducts = Db::getInstance()->executeS('SELECT COUNT(*) as total_order_products FROM `'._DB_PREFIX_.'order_detail` WHERE MONTH(`date_add`) = MONTH(NOW()) AND YEAR(`date_add`) = YEAR(NOW())'); $smarty->assign(array('totalOrders' => $totalOrders[0]['total_orders'], 'totalOrderProducts' => $totalOrderProducts[0]['total_order_products'])); and to show the result: Number of orders: {$totalOrders} Number of order products: {$totalOrderProducts} Thanks in advance.
-
Hello, Can you help to get the orders total for a month. I want to show it in the addresses: order.php?step=1 order-address.tpl. I found a solution but it doesn't work!: $totalOrders = Db::getInstance()->executeS('SELECT COUNT(*) as total_orders FROM `'._DB_PREFIX_.'orders` WHERE MONTH(`date_add`) = MONTH(NOW()) AND YEAR(`date_add`) = YEAR(NOW())'); $totalOrderProducts = Db::getInstance()->executeS('SELECT COUNT(*) as total_order_products FROM `'._DB_PREFIX_.'order_detail` WHERE MONTH(`date_add`) = MONTH(NOW()) AND YEAR(`date_add`) = YEAR(NOW())'); $smarty->assign(array('totalOrders' => $totalOrders[0]['total_orders'], 'totalOrderProducts' => $totalOrderProducts[0]['total_order_products'])); and to show the result: Number of orders: {$totalOrders} Number of order products: {$totalOrderProducts} Thanks in advance.