From 481dc3d3079856936c408c8ac5bbf951a0bf7773 Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Thu, 12 Sep 2013 16:03:29 +0200 Subject: [PATCH] // Dashboard is almost complete --- modules/dashactivity/dashactivity.php | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/modules/dashactivity/dashactivity.php b/modules/dashactivity/dashactivity.php index 90a3a75d5..53e240d2b 100644 --- a/modules/dashactivity/dashactivity.php +++ b/modules/dashactivity/dashactivity.php @@ -121,6 +121,13 @@ class Dashactivity extends Module FROM `'._DB_PREFIX_.'orders` WHERE `invoice_date` BETWEEN "'.pSQL($params['date_from']).'" AND "'.pSQL($params['date_to']).'" '.Shop::addSqlRestriction(Shop::SHARE_ORDER)); + + $pending_orders = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' + SELECT COUNT(*) + FROM `'._DB_PREFIX_.'orders` o + LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (o.current_state = os.id_order_state) + WHERE os.paid = 1 AND os.shipped = 0 + '.Shop::addSqlRestriction(Shop::SHARE_ORDER)); $abandoned_cart = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' SELECT COUNT(*) @@ -187,17 +194,30 @@ class Dashactivity extends Module WHERE active = 1 '.Shop::addSqlRestriction(Shop::SHARE_ORDER)); } + + $product_reviews = 0; + if (Module::isInstalled('productcomments')) + { + $new_registrations += Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' + SELECT COUNT(*) + FROM `'._DB_PREFIX_.'product_comment` pc + LEFT JOIN `'._DB_PREFIX_.'product` p ON (pc.id_product = p.id_product) + '.Shop::addSqlAssociation('product', 'p').' + WHERE pc.deleted = 0 + AND pc.`date_add` BETWEEN "'.pSQL($params['date_from']).'" AND "'.pSQL($params['date_to']).'" + '.Shop::addSqlRestriction(Shop::SHARE_ORDER)); + } return array( 'data_value' => array( 'order_nbr' => $order_nbr, - 'pending_orders' => 42, + 'pending_orders' => $pending_orders, 'return_exchanges' => $return_exchanges, 'abandoned_cart' => $abandoned_cart, 'products_out_of_stock' => $products_out_of_stock, 'new_messages' => $new_messages, 'order_inquires' => 42, - 'product_reviews' => 42, + 'product_reviews' => $product_reviews, 'new_customers' => $new_customers, 'online_visitor' => $online_visitor, 'active_shopping_cart' => $active_shopping_cart,