MNT Posted September 6, 2011 Share Posted September 6, 2011 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? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now