MNT Posted September 5, 2011 Share Posted September 5, 2011 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. 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