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