// Removed currently unused table in the dashboard

This commit is contained in:
Damien Metzger
2013-10-16 15:25:53 +02:00
parent e493305c47
commit 8cfdad9def
2 changed files with 20 additions and 19 deletions
+17 -18
View File
@@ -51,26 +51,26 @@ class Dashproducts extends Module
{ {
return $this->display(__FILE__, 'dashboard_zone_two.tpl'); return $this->display(__FILE__, 'dashboard_zone_two.tpl');
} }
public function hookDashboardData($params) public function hookDashboardData($params)
{ {
$table_recent_orders = $this->getTableRecentOrders(); $table_recent_orders = $this->getTableRecentOrders();
$table_best_sellers = $this->getTableBestSellers($params['date_from'], $params['date_to']); $table_best_sellers = $this->getTableBestSellers($params['date_from'], $params['date_to']);
$table_most_viewed = $this->getTableMostViewed($params['date_from'], $params['date_to']); $table_most_viewed = $this->getTableMostViewed($params['date_from'], $params['date_to']);
$table_top_10_most_search = $this->getTableTop10MostSearch($params['date_from'], $params['date_to']); $table_top_10_most_search = $this->getTableTop10MostSearch($params['date_from'], $params['date_to']);
$table_top_5_search = $this->getTableTop5Search(); //$table_top_5_search = $this->getTableTop5Search();
return array( return array(
'data_table' => array( 'data_table' => array(
'table_recent_orders' => $table_recent_orders, 'table_recent_orders' => $table_recent_orders,
'table_best_sellers' => $table_best_sellers, 'table_best_sellers' => $table_best_sellers,
'table_most_viewed' => $table_most_viewed, 'table_most_viewed' => $table_most_viewed,
'table_top_10_most_search' => $table_top_10_most_search, 'table_top_10_most_search' => $table_top_10_most_search,
'table_top_5_search' => $table_top_5_search //'table_top_5_search' => $table_top_5_search
) )
); );
} }
public function getTableRecentOrders() public function getTableRecentOrders()
{ {
$header = array( $header = array(
@@ -80,7 +80,7 @@ class Dashproducts extends Module
array('title' => $this->l('Date'), 'class' => 'text-center'), array('title' => $this->l('Date'), 'class' => 'text-center'),
array('title' => $this->l('Action'), 'class' => 'text-center'), array('title' => $this->l('Action'), 'class' => 'text-center'),
); );
$orders = Order::getOrdersWithInformations(10); $orders = Order::getOrdersWithInformations(10);
$body = array(); $body = array();
@@ -122,10 +122,9 @@ class Dashproducts extends Module
} }
return array('header' => $header, 'body' => $body); return array('header' => $header, 'body' => $body);
} }
public function getTableBestSellers($date_from, $date_to) public function getTableBestSellers($date_from, $date_to)
{ {
$header = array( $header = array(
array( array(
'id' => 'image', 'id' => 'image',
@@ -158,7 +157,7 @@ class Dashproducts extends Module
'class' => 'text-center', 'class' => 'text-center',
) )
); );
$products = Db::getInstance()->ExecuteS(' $products = Db::getInstance()->ExecuteS('
SELECT SELECT
product_id, product_id,
@@ -174,7 +173,7 @@ class Dashproducts extends Module
GROUP BY product_id GROUP BY product_id
ORDER BY total DESC ORDER BY total DESC
LIMIT 10'); LIMIT 10');
$body = array(); $body = array();
foreach ($products as $product) foreach ($products as $product)
{ {
@@ -218,7 +217,7 @@ class Dashproducts extends Module
} }
return array('header' => $header, 'body' => $body); return array('header' => $header, 'body' => $body);
} }
public function getTableMostViewed($date_from, $date_to) public function getTableMostViewed($date_from, $date_to)
{ {
$header = array( $header = array(
@@ -301,7 +300,7 @@ class Dashproducts extends Module
return array('header' => $header, 'body' => $body); return array('header' => $header, 'body' => $body);
} }
public function getTableTop10MostSearch($date_from, $date_to) public function getTableTop10MostSearch($date_from, $date_to)
{ {
$header = array( $header = array(
@@ -321,7 +320,7 @@ class Dashproducts extends Module
'class' => 'text-center' 'class' => 'text-center'
) )
); );
$terms = $this->getMostSearchTerms($date_from, $date_to); $terms = $this->getMostSearchTerms($date_from, $date_to);
$body = array(); $body = array();
if (is_array($terms) && count($terms)) if (is_array($terms) && count($terms))
@@ -348,7 +347,7 @@ class Dashproducts extends Module
return array('header' => $header, 'body' => $body); return array('header' => $header, 'body' => $body);
} }
public function getTableTop5Search() public function getTableTop5Search()
{ {
$header = array( $header = array(
@@ -375,7 +374,7 @@ class Dashproducts extends Module
return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql); return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
} }
public function getTotalProductAddedCart($date_from, $date_to, $id_product) public function getTotalProductAddedCart($date_from, $date_to, $id_product)
{ {
$sql = 'SELECT count(`id_product`) as count $sql = 'SELECT count(`id_product`) as count
@@ -386,7 +385,7 @@ class Dashproducts extends Module
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql); return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
} }
public function getTotalProductPurchased($date_from, $date_to, $id_product) public function getTotalProductPurchased($date_from, $date_to, $id_product)
{ {
$sql = 'SELECT count(`product_id`) as count $sql = 'SELECT count(`product_id`) as count
@@ -399,7 +398,7 @@ class Dashproducts extends Module
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql); return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
} }
public function getTotalViewed($date_from, $date_to) public function getTotalViewed($date_from, $date_to)
{ {
$gapi = Module::isInstalled('gapi') ? Module::getInstanceByName('gapi') : false; $gapi = Module::isInstalled('gapi') ? Module::getInstanceByName('gapi') : false;
@@ -428,7 +427,7 @@ class Dashproducts extends Module
AND dr.`time_start` BETWEEN "'.pSQL($date_from).'" AND "'.pSQL($date_to).'" AND dr.`time_start` BETWEEN "'.pSQL($date_from).'" AND "'.pSQL($date_to).'"
AND dr.`time_end` BETWEEN "'.pSQL($date_from).'" AND "'.pSQL($date_to).'"'); AND dr.`time_end` BETWEEN "'.pSQL($date_from).'" AND "'.pSQL($date_to).'"');
} }
public function getMostSearchTerms($date_from, $date_to, $limit = 10) public function getMostSearchTerms($date_from, $date_to, $limit = 10)
{ {
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
@@ -91,7 +91,7 @@
</div> </div>
<div class="tab-pane" id="dash_top_search"> <div class="tab-pane" id="dash_top_search">
<div class="row"> <div class="row">
<div class="col-lg-7"> <div class="col-lg-12">
<h3>{l s="Top 10 most search terms"}</h3> <h3>{l s="Top 10 most search terms"}</h3>
<table class="table data_table" id="table_top_10_most_search"> <table class="table data_table" id="table_top_10_most_search">
<thead> <thead>
@@ -100,6 +100,7 @@
</tbody> </tbody>
</table> </table>
</div> </div>
{*
<div class="col-lg-5"> <div class="col-lg-5">
<h3>{l s="Coming soon"}</h3> <h3>{l s="Coming soon"}</h3>
<table class="table data_table" id="table_top_5_search"> <table class="table data_table" id="table_top_5_search">
@@ -109,6 +110,7 @@
</tbody> </tbody>
</table> </table>
</div> </div>
*}
</div> </div>
</div> </div>
</div> </div>