From 4ef7bd0b7735ed8d280dba6928514dba2eaec2a9 Mon Sep 17 00:00:00 2001 From: Sarah Lorenzini Date: Mon, 16 Sep 2013 17:49:57 +0200 Subject: [PATCH] // update stats tab --- modules/statsproduct/statsproduct.php | 232 +++++++++++------- .../statsregistrations/statsregistrations.php | 82 +++---- modules/statssales/statssales.php | 44 ++-- 3 files changed, 200 insertions(+), 158 deletions(-) diff --git a/modules/statsproduct/statsproduct.php b/modules/statsproduct/statsproduct.php index 6a138ec77..903506852 100644 --- a/modules/statsproduct/statsproduct.php +++ b/modules/statsproduct/statsproduct.php @@ -155,7 +155,23 @@ class StatsProduct extends ModuleGraph if (!Tools::getValue('exportType')) $this->csvExport(array('layers' => 2, 'type' => 'line', 'option' => '42')); - $this->html = '

'.$this->displayName.'

'; + $this->html = ' +
+ '.$this->displayName.' +
+

'.$this->l('Guide').'

+
+

'.$this->l('Number of purchases compared to number of views.').'

+

+ '.$this->l('After choosing a category and selecting a product, informational graphs will appear.').' +

    +
  • '.$this->l('If you notice that a product is often purchased but viewed infrequently, you should display it more prominently in your Front Office. ').'
  • +
  • '.$this->l('On the other hand, if a product has many viewings but is not often purchased, + we advise you to check or modify this product\'s information, description and photography again.').' +
  • +
+

+
'; if ($id_product = (int)Tools::getValue('id_product')) { if (Tools::getValue('export')) @@ -167,71 +183,107 @@ class StatsProduct extends ModuleGraph $totalBought = $this->getTotalBought($product->id); $totalSales = $this->getTotalSales($product->id); $totalViewed = $this->getTotalViewed($product->id); - $this->html .= '

'.$product->name.' - '.$this->l('Details').'

-

'.$this->l('Total bought:').' '.$totalBought.'

-

'.$this->l('Sales ( Figure does not include tax):').' '.Tools::displayprice($totalSales, $currency).'

-

'.$this->l('Total viewed:').' '.$totalViewed.'

-

'.$this->l('Conversion rate:').' '.number_format($totalViewed ? $totalBought / $totalViewed : 0, 2).'

-
'.$this->engine(array('layers' => 2, 'type' => 'line', 'option' => '1-'.$id_product)).'
-
-

'.$this->l('CSV Export').'

'; + $this->html .= '

'.$product->name.' - '.$this->l('Details').'

+
+
+
+ '.$this->engine(array('layers' => 2, 'type' => 'line', 'option' => '1-'.$id_product)).' +
+
+
    +
  • '.$this->l('Total bought:').' '.$totalBought.'
  • +
  • '.$this->l('Sales ( Figure does not include tax):').' '.Tools::displayprice($totalSales, $currency).'
  • +
  • '.$this->l('Total viewed:').' '.$totalViewed.'
  • +
  • '.$this->l('Conversion rate:').' '.number_format($totalViewed ? $totalBought / $totalViewed : 0, 2).'
  • +
+ + '.$this->l('CSV Export').' + +
+
+
'; if ($hasAttribute = $product->hasAttributes() && $totalBought) $this->html .= '

'.$this->l('Attribute sales distribution').'

'.$this->engine(array('type' => 'pie', 'option' => '3-'.$id_product)).'

-

'.$this->l('CSV Export').'


'; + '.$this->l('CSV Export').''; if ($totalBought) { $sales = $this->getSales($id_product, $this->context->language->id); $this->html .= ' -

'.$this->l('Sales').'

+

'.$this->l('Sales').'

- - - - - - - '.($hasAttribute ? '' : '').' - - - - '; - $tokenOrder = Tools::getAdminToken('AdminOrders'.(int)Tab::getIdFromClassName('AdminOrders').(int)$this->context->employee->id); - $tokenCustomer = Tools::getAdminToken('AdminCustomers'.(int)Tab::getIdFromClassName('AdminCustomers').(int)$this->context->employee->id); - foreach ($sales as $sale) +
'.$this->l('Date').''.$this->l('Order').''.$this->l('Customer').''.$this->l('Attribute').''.$this->l('Quantity').''.$this->l('Price').'
+ + + + + + '.($hasAttribute ? '' : '').' + + + + + '; + $tokenOrder = Tools::getAdminToken('AdminOrders'.(int)Tab::getIdFromClassName('AdminOrders').(int)$this->context->employee->id); + $tokenCustomer = Tools::getAdminToken('AdminCustomers'.(int)Tab::getIdFromClassName('AdminCustomers').(int)$this->context->employee->id); + foreach ($sales as $sale) + $this->html .= ' + + + + + '.($hasAttribute ? '' : '').' + + + '; $this->html .= ' - - - - - '.($hasAttribute ? '' : '').' - - - '; - $this->html .= '
+ '.$this->l('Date').' + + '.$this->l('Order').' + + '.$this->l('Customer').' + '.$this->l('Attribute').' + '.$this->l('Quantity').' + + '.$this->l('Price').' +
'.Tools::displayDate($sale['date_add'],null , false).''.(int)($sale['id_order']).''.(int)($sale['id_customer']).''.$sale['product_name'].''.(int)$sale['product_quantity'].''.Tools::displayprice($sale['total'], $currency).'
'.Tools::displayDate($sale['date_add'],null , false).''.(int)($sale['id_order']).''.(int)($sale['id_customer']).''.$sale['product_name'].''.(int)$sale['product_quantity'].''.Tools::displayprice($sale['total'], $currency).'
'; + + +
'; $crossSelling = $this->getCrossSales($id_product, $this->context->language->id); if (count($crossSelling)) { - $this->html .= '
-

'.$this->l('Cross selling').'

+ $this->html .= ' +

'.$this->l('Cross selling').'

- - - - - - - - '; - $tokenProducts = Tools::getAdminToken('AdminProducts'.(int)Tab::getIdFromClassName('AdminProducts').(int)$this->context->employee->id); - foreach ($crossSelling as $selling) +

'.$this->l('Cross selling').'

+
'.$this->l('Product name').''.$this->l('Quantity sold').''.$this->l('Average price').'
+ + + + + + + + '; + $tokenProducts = Tools::getAdminToken('AdminProducts'.(int)Tab::getIdFromClassName('AdminProducts').(int)$this->context->employee->id); + foreach ($crossSelling as $selling) + $this->html .= ' + + + + + '; $this->html .= ' - - - - - '; - $this->html .= '
+ '.$this->l('Product name').' + + '.$this->l('Quantity sold').' + + '.$this->l('Average price').' +
'.$selling['pname'].''.(int)$selling['pqty'].''.Tools::displayprice($selling['pprice'], $currency).'
'.$selling['pname'].''.(int)$selling['pqty'].''.Tools::displayprice($selling['pprice'], $currency).'
'; + + + '; } } } @@ -239,29 +291,39 @@ class StatsProduct extends ModuleGraph { $categories = Category::getCategories((int)$this->context->language->id, true, false); $this->html .= ' -
-
- - -
-
-

'.$this->l('Click on a product to access its statistics!').'

- -

'.$this->l('Products available').'

-
+
+
+ +
+ +
+
+
+

'.$this->l('Products available').'

- - - - - - - '; + + + + + + + + '; foreach ($this->getProducts($this->context->language->id) as $product) $this->html .= ' @@ -273,23 +335,13 @@ class StatsProduct extends ModuleGraph '; - $this->html .= '
'.$this->l('Ref.').''.$this->l('Name').''.$this->l('Available quantity for sale').'
+ '.$this->l('Ref.').' + + '.$this->l('Name').' + + '.$this->l('Available quantity for sale').' +
'.$product['quantity'].'


- '.$this->l('CSV Export').'
'; + $this->html .= ' + + + + '.$this->l('CSV Export').' + '; } - - $this->html .= '
-

'.$this->l('Guide').'

-

'.$this->l('Number of purchases compared to number of views.').'

-

- '.$this->l('After choosing a category and selecting a product, informational graphs will appear.').' -

-

-
'; return $this->html; } diff --git a/modules/statsregistrations/statsregistrations.php b/modules/statsregistrations/statsregistrations.php index 16408cd42..e3388c7f5 100644 --- a/modules/statsregistrations/statsregistrations.php +++ b/modules/statsregistrations/statsregistrations.php @@ -108,50 +108,46 @@ class StatsRegistrations extends ModuleGraph if (Tools::getValue('export')) $this->csvExport(array('layers' => 0, 'type' => 'line')); $this->_html = ' -
-
- '.$this->l('Guide').' -
-
-

'.$this->l('Number of customer accounts created').'

-

'.$this->l('The total number of accounts created is not in itself important information. However, it is beneficial to analyze the number created over time. This will indicate whether or not things are on the right track. You feel me?').'

-
-
- '.$this->l('How to act on the registrations\' evolution?').' -
-
- '.$this->l('If you let your shop run without changing anything, the number of customer registrations should stay stable or slightly decline.').' - '.$this->l('A significant increase or decrease in customer registration shows that there has probably been a change to your shop.With that in mind, we suggest that you identify the cause, correct the issue and get back in the business of making money!').'
- '.$this->l('Here is a summary of what may affect the creation of customer accounts:').' -
    -
  • '.$this->l('An advertising campaign can attract an increased number of visitors to your online store. This will likely be followed by an increase in customer accounts, and profit margins, which will depend on customer "quality." Well-targeted advertising is typically more effective than large-scale advertising... and it\'s cheaper too!').'
  • -
  • '.$this->l('Specials, sales, promotions and/or contests typically demand a shoppers\' attentions. Offering such things will not only keep your business lively, it will also increase traffic, build customer loyalty and genuine change your current e-commerce philosophy.').'
  • -
  • '.$this->l('Design and user-friendliness are more important than ever in the world of online sales. An ill-chosen or hard-to-follow graphical theme can keep shoppers at bay. This means that you should aspire to find the right balance between beauty and functionality for your online store.').'
  • -
-
-
- '.$this->displayName.' -
-
-
    -
  • - '.$this->l('Number of visitors who stopped at the registering step:').' '.(int)($totalBlocked).($totalRegistrations ? ' ('.number_format(100*$totalBlocked/($totalRegistrations+$totalBlocked), 2).'%)' : '').'
  • - '.$this->l('Number of visitors who placed an order directly after registration:').' '.(int)($totalBuyers).($totalRegistrations ? ' ('.number_format(100*$totalBuyers/($totalRegistrations), 2).'%)' : '').' -
  • '.$this->l('Total customer accounts:').' '.$totalRegistrations.'
  • -
-
-
-
-
- '.$this->engine(array('type' => 'line')).' -
- +
+ '.$this->displayName.' +
+
+
    +
  • + '.$this->l('Number of visitors who stopped at the registering step:').' '.(int)($totalBlocked).($totalRegistrations ? ' ('.number_format(100*$totalBlocked/($totalRegistrations+$totalBlocked), 2).'%)' : '').'
  • + '.$this->l('Number of visitors who placed an order directly after registration:').' '.(int)($totalBuyers).($totalRegistrations ? ' ('.number_format(100*$totalBuyers/($totalRegistrations), 2).'%)' : '').' +
  • '.$this->l('Total customer accounts:').' '.$totalRegistrations.'
  • +
+
+

'.$this->l('Guide').'

+
+

'.$this->l('Number of customer accounts created').'

+

'.$this->l('The total number of accounts created is not in itself important information. However, it is beneficial to analyze the number created over time. This will indicate whether or not things are on the right track. You feel me?').'

+
+

'.$this->l('How to act on the registrations\' evolution?').'

+
+ '.$this->l('If you let your shop run without changing anything, the number of customer registrations should stay stable or slightly decline.').' + '.$this->l('A significant increase or decrease in customer registration shows that there has probably been a change to your shop.With that in mind, we suggest that you identify the cause, correct the issue and get back in the business of making money!').'
+ '.$this->l('Here is a summary of what may affect the creation of customer accounts:').' +
    +
  • '.$this->l('An advertising campaign can attract an increased number of visitors to your online store. This will likely be followed by an increase in customer accounts, and profit margins, which will depend on customer "quality." Well-targeted advertising is typically more effective than large-scale advertising... and it\'s cheaper too!').'
  • +
  • '.$this->l('Specials, sales, promotions and/or contests typically demand a shoppers\' attentions. Offering such things will not only keep your business lively, it will also increase traffic, build customer loyalty and genuine change your current e-commerce philosophy.').'
  • +
  • '.$this->l('Design and user-friendliness are more important than ever in the world of online sales. An ill-chosen or hard-to-follow graphical theme can keep shoppers at bay. This means that you should aspire to find the right balance between beauty and functionality for your online store.').'
  • +
+
+ +
+
+
+ '.$this->engine(array('type' => 'line')).'
-
'; + +
+
'; return $this->_html; } diff --git a/modules/statssales/statssales.php b/modules/statssales/statssales.php index af028e141..96ec4cfb9 100644 --- a/modules/statssales/statssales.php +++ b/modules/statssales/statssales.php @@ -66,20 +66,17 @@ class StatsSales extends ModuleGraph $this->csvExport(array('type' => 'pie', 'option' => '3-'.(int)Tools::getValue('id_country'))); $this->_html = ' -
- '.$this->l('Guide').' + '.$this->displayName.'
-
+

'.$this->l('Guide').'

+

'.$this->l('Various order statuses').'

'.$this->l('In your Back Office, you can modify the following order statuses: Awaiting Check Payment, Payment Accepted, Preparation in Progress, Shipping, Delivered, Cancelled, Refund, Payment Error, Out of Stock, and Awaiting Bank Wire Payment.').'
'.$this->l('These order statuses cannot be removed from the Back Office, however you have the option to add more.').'

-
- '.$this->displayName.' -

'.$this->l('The following graphs represent the evolution of your e-store\'s orders and sales turnover for a selected period. This tool is one that you should use often as it allows you to quickly monitor your store\'s viability. This feature also allows you to monitor multiple time periods, and only valid orders are graphically represented.').'

@@ -99,36 +96,34 @@ class StatsSales extends ModuleGraph
-
+
'.$this->engine(array('type' => 'line', 'option' => '1-'.(int)Tools::getValue('id_country'), 'layers' => 2)).'
-
+
  • '.$this->l('Orders placed:').' '.(int)($totals['orderCount']).'
  • '.$this->l('Products bought:').' '.(int)($totals['products']).'
  • -
  • - - '.$this->l('CSV Export').' - -
+
+ + '.$this->l('CSV Export').' +
-
-
'.$this->engine(array('type' => 'line', 'option' => '2-'.(int)Tools::getValue('id_country'))).'
+
+ '.$this->engine(array('type' => 'line', 'option' => '2-'.(int)Tools::getValue('id_country'))).'
-
+
+
+ + '.$this->l('CSV Export').' +
@@ -137,17 +132,16 @@ class StatsSales extends ModuleGraph
-
+
'.($totals['orderCount'] ? $this->engine(array('type' => 'pie', 'option' => '3-'.(int)Tools::getValue('id_country'))) : $this->l('No orders for this period.')).'
- -
-
'; +
'; return $this->_html; }