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?