Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Ecommerce')
-rw-r--r--plugins/Ecommerce/Categories/EcommerceCategory.php17
-rw-r--r--plugins/Ecommerce/Categories/EcommerceLogSubcategory.php19
-rw-r--r--plugins/Ecommerce/Categories/EcommerceOverviewSubcategory.php19
-rw-r--r--plugins/Ecommerce/Categories/ProductSubcategory.php19
-rw-r--r--plugins/Ecommerce/Categories/SalesSubcategory.php19
-rw-r--r--plugins/Ecommerce/Controller.php117
-rw-r--r--plugins/Ecommerce/Menu.php41
-rw-r--r--plugins/Ecommerce/Reports/Base.php5
-rw-r--r--plugins/Ecommerce/Reports/BaseItem.php45
-rw-r--r--plugins/Ecommerce/Reports/GetItemsCategory.php3
-rw-r--r--plugins/Ecommerce/Reports/GetItemsName.php3
-rw-r--r--plugins/Ecommerce/Reports/GetItemsSku.php3
-rw-r--r--plugins/Ecommerce/Widgets.php35
-rw-r--r--plugins/Ecommerce/Widgets/GetEcommerceLog.php28
-rw-r--r--plugins/Ecommerce/Widgets/ProductsByDimension.php34
-rw-r--r--plugins/Ecommerce/templates/conversionOverview.twig15
-rw-r--r--plugins/Ecommerce/templates/ecommerceLog.twig3
-rw-r--r--plugins/Ecommerce/templates/getSparklines.twig55
18 files changed, 320 insertions, 160 deletions
diff --git a/plugins/Ecommerce/Categories/EcommerceCategory.php b/plugins/Ecommerce/Categories/EcommerceCategory.php
new file mode 100644
index 0000000000..39cd5bb3ea
--- /dev/null
+++ b/plugins/Ecommerce/Categories/EcommerceCategory.php
@@ -0,0 +1,17 @@
+<?php
+/**
+ * Piwik - free/libre analytics platform
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ *
+ */
+namespace Piwik\Plugins\Ecommerce\Categories;
+
+use Piwik\Category\Category;
+
+class EcommerceCategory extends Category
+{
+ protected $id = 'Goals_Ecommerce';
+ protected $order = 20;
+}
diff --git a/plugins/Ecommerce/Categories/EcommerceLogSubcategory.php b/plugins/Ecommerce/Categories/EcommerceLogSubcategory.php
new file mode 100644
index 0000000000..f3999fda02
--- /dev/null
+++ b/plugins/Ecommerce/Categories/EcommerceLogSubcategory.php
@@ -0,0 +1,19 @@
+<?php
+/**
+ * Piwik - free/libre analytics platform
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ *
+ */
+namespace Piwik\Plugins\Ecommerce\Categories;
+
+use Piwik\Category\Subcategory;
+
+class EcommerceLogSubcategory extends Subcategory
+{
+ protected $categoryId = 'Goals_Ecommerce';
+ protected $id = 'Goals_EcommerceLog';
+ protected $order = 5;
+
+}
diff --git a/plugins/Ecommerce/Categories/EcommerceOverviewSubcategory.php b/plugins/Ecommerce/Categories/EcommerceOverviewSubcategory.php
new file mode 100644
index 0000000000..b8560a8072
--- /dev/null
+++ b/plugins/Ecommerce/Categories/EcommerceOverviewSubcategory.php
@@ -0,0 +1,19 @@
+<?php
+/**
+ * Piwik - free/libre analytics platform
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ *
+ */
+namespace Piwik\Plugins\Ecommerce\Categories;
+
+use Piwik\Category\Subcategory;
+
+class EcommerceOverviewSubcategory extends Subcategory
+{
+ protected $categoryId = 'Goals_Ecommerce';
+ protected $id = 'General_Overview';
+ protected $order = 2;
+
+}
diff --git a/plugins/Ecommerce/Categories/ProductSubcategory.php b/plugins/Ecommerce/Categories/ProductSubcategory.php
new file mode 100644
index 0000000000..d7d8e9a810
--- /dev/null
+++ b/plugins/Ecommerce/Categories/ProductSubcategory.php
@@ -0,0 +1,19 @@
+<?php
+/**
+ * Piwik - free/libre analytics platform
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ *
+ */
+namespace Piwik\Plugins\Ecommerce\Categories;
+
+use Piwik\Category\Subcategory;
+
+class ProductSubcategory extends Subcategory
+{
+ protected $categoryId = 'Goals_Ecommerce';
+ protected $id = 'Goals_Products';
+ protected $order = 10;
+
+}
diff --git a/plugins/Ecommerce/Categories/SalesSubcategory.php b/plugins/Ecommerce/Categories/SalesSubcategory.php
new file mode 100644
index 0000000000..0cb68d3d1c
--- /dev/null
+++ b/plugins/Ecommerce/Categories/SalesSubcategory.php
@@ -0,0 +1,19 @@
+<?php
+/**
+ * Piwik - free/libre analytics platform
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ *
+ */
+namespace Piwik\Plugins\Ecommerce\Categories;
+
+use Piwik\Category\Subcategory;
+
+class SalesSubcategory extends Subcategory
+{
+ protected $categoryId = 'Goals_Ecommerce';
+ protected $id = 'Ecommerce_Sales';
+ protected $order = 15;
+
+}
diff --git a/plugins/Ecommerce/Controller.php b/plugins/Ecommerce/Controller.php
index 7cfb955184..780c905c7c 100644
--- a/plugins/Ecommerce/Controller.php
+++ b/plugins/Ecommerce/Controller.php
@@ -8,7 +8,8 @@
*/
namespace Piwik\Plugins\Ecommerce;
-use Exception;
+use Piwik\API\Request;
+use Piwik\Common;
use Piwik\DataTable;
use Piwik\FrontController;
use Piwik\Piwik;
@@ -30,95 +31,75 @@ class Controller extends \Piwik\Plugins\Goals\Controller
parent::__construct($translator, $translationHelper);
}
- public function ecommerceReport()
+ public function getSparklines()
{
- if (!\Piwik\Plugin\Manager::getInstance()->isPluginActivated('CustomVariables')) {
- throw new Exception("Ecommerce Tracking requires that the plugin Custom Variables is enabled. Please enable the plugin CustomVariables (or ask your admin).");
- }
+ $idGoal = Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER;
- $view = $this->getGoalReportView($idGoal = Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER);
- $view->displayFullReport = false;
- $view->headline = $this->translator->translate('General_EvolutionOverPeriod');
+ $view = new View('@Ecommerce/getSparklines');
+ $view->onlyConversionOverview = false;
+ $view->conversionsOverViewEnabled = true;
- return $view->render();
- }
+ if ($idGoal == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER) {
+ $goalDefinition['name'] = $this->translator->translate('Goals_Ecommerce');
+ $goalDefinition['allow_multiple'] = true;
+ } else {
+ if (!isset($this->goals[$idGoal])) {
+ Piwik::redirectToModule('Goals', 'index', array('idGoal' => null));
+ }
+ $goalDefinition = $this->goals[$idGoal];
+ }
- public function ecommerceLogReport($fetch = false)
- {
- $view = new View('@Ecommerce/ecommerceLog');
$this->setGeneralVariablesView($view);
- $view->ecommerceLog = $this->getEcommerceLog($fetch);
-
- return $view->render();
- }
+ $goal = $this->getMetricsForGoal($idGoal);
+ foreach ($goal as $name => $value) {
+ $view->$name = $value;
+ }
- public function getEcommerceLog($fetch = false)
- {
- $saveGET = $_GET;
- $_GET['segment'] = urlencode('visitEcommerceStatus!=none');
- $_GET['widget'] = 1;
- $output = FrontController::getInstance()->dispatch('Live', 'getVisitorLog', array($fetch));
- $_GET = $saveGET;
+ if ($idGoal == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER) {
+ $goal = $this->getMetricsForGoal(Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_CART);
+ foreach ($goal as $name => $value) {
+ $name = 'cart_' . $name;
+ $view->$name = $value;
+ }
+ }
- return $output;
- }
+ $view->idGoal = $idGoal;
+ $view->goalAllowMultipleConversionsPerVisit = $goalDefinition['allow_multiple'];
- public function index()
- {
- return $this->ecommerceReport();
+ return $view->render();
}
- public function products()
+ public function getConversionsOverview()
{
- $goal = $this->getMetricsForGoal(Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER);
- $conversions = 0;
- if (!empty($goal['nb_conversions'])) {
- $conversions = $goal['nb_conversions'];
- }
-
- $goal = $this->getMetricsForGoal(Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_CART);
-
- $cartNbConversions = 0;
- if (!empty($goal) && array_key_exists('nb_conversions', $goal)) {
- $cartNbConversions = $goal['nb_conversions'];
- }
+ $view = new View('@Ecommerce/conversionOverview');
+ $idGoal = Common::getRequestVar('idGoal', null, 'string');
- $preloadAbandonedCart = $cartNbConversions !== false && $conversions == 0;
+ $goalMetrics = Request::processRequest('Goals.get', array('idGoal' => $idGoal));
+ $dataRow = $goalMetrics->getFirstRow();
- $goalReportsByDimension = new View\ReportsByDimension('Goals');
+ $view->idSite = Common::getRequestVar('idSite', null, 'int');
- $ecommerceCustomParams = array();
- if ($preloadAbandonedCart) {
- $ecommerceCustomParams['abandonedCarts'] = '1';
- } else {
- $ecommerceCustomParams['abandonedCarts'] = '0';
+ if ($dataRow) {
+ $view->revenue = $dataRow->getColumn('revenue');
+ $view->revenue_subtotal = $dataRow->getColumn('revenue_subtotal');
+ $view->revenue_tax = $dataRow->getColumn('revenue_tax');
+ $view->revenue_shipping = $dataRow->getColumn('revenue_shipping');
+ $view->revenue_discount = $dataRow->getColumn('revenue_discount');
}
- $goalReportsByDimension->addReport(
- 'Goals_Products', 'Goals_ProductSKU', 'Goals.getItemsSku', $ecommerceCustomParams);
- $goalReportsByDimension->addReport(
- 'Goals_Products', 'Goals_ProductName', 'Goals.getItemsName', $ecommerceCustomParams);
- $goalReportsByDimension->addReport(
- 'Goals_Products', 'Goals_ProductCategory', 'Goals.getItemsCategory', $ecommerceCustomParams);
-
- $view = new View('@Ecommerce/products');
- $this->setGeneralVariablesView($view);
-
- $view->productsByDimension = $goalReportsByDimension->render();
return $view->render();
}
- public function sales()
+ public function getEcommerceLog($fetch = false)
{
- $viewOverview = $this->getGoalReportView(Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER);
- $reportsByDimension = $viewOverview->goalReportsByDimension;
-
- $view = new View('@Ecommerce/sales');
- $this->setGeneralVariablesView($view);
+ $saveGET = $_GET;
+ $_GET['segment'] = urlencode('visitEcommerceStatus!=none');
+ $_GET['widget'] = 1;
+ $output = FrontController::getInstance()->dispatch('Live', 'getVisitorLog', array($fetch));
+ $_GET = $saveGET;
- $view->goalReportsByDimension = $reportsByDimension;
- return $view->render();
+ return $output;
}
}
diff --git a/plugins/Ecommerce/Menu.php b/plugins/Ecommerce/Menu.php
deleted file mode 100644
index 331715be4f..0000000000
--- a/plugins/Ecommerce/Menu.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-/**
- * Piwik - free/libre analytics platform
- *
- * @link http://piwik.org
- * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
- *
- */
-namespace Piwik\Plugins\Ecommerce;
-
-use Piwik\Common;
-use Piwik\Menu\MenuReporting;
-use Piwik\Menu\MenuUser;
-use Piwik\Piwik;
-use Piwik\Site;
-use Piwik\Url;
-
-/**
- */
-class Menu extends \Piwik\Plugin\Menu
-{
-
- public function configureReportingMenu(MenuReporting $menu)
- {
- $idSite = Common::getRequestVar('idSite', null, 'int');
-
- $site = new Site($idSite);
-
- if ($site->isEcommerceEnabled()) {
- $ecommerceParams = array('idGoal' => Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER);
- $ecommerceUrl = $this->urlForAction('ecommerceReport', $ecommerceParams);
-
- $menu->addItem('Goals_Ecommerce', '', $ecommerceUrl, 24);
- $menu->addItem('Goals_Ecommerce', 'General_Overview', $ecommerceUrl, 1);
- $menu->addItem('Goals_Ecommerce', 'Goals_EcommerceLog', $this->urlForAction('ecommerceLogReport'), 2);
- $menu->addItem('Goals_Ecommerce', 'Goals_Products', $this->urlForAction('products', $ecommerceParams), 3);
- $menu->addItem('Goals_Ecommerce', 'Ecommerce_Sales', $this->urlForAction('sales', $ecommerceParams), 4);
- }
-
- }
-}
diff --git a/plugins/Ecommerce/Reports/Base.php b/plugins/Ecommerce/Reports/Base.php
index 08a766792a..28a3a4a36f 100644
--- a/plugins/Ecommerce/Reports/Base.php
+++ b/plugins/Ecommerce/Reports/Base.php
@@ -8,20 +8,17 @@
*/
namespace Piwik\Plugins\Ecommerce\Reports;
-use Piwik\API\Proxy;
use Piwik\Common;
use Piwik\Piwik;
use Piwik\Plugin\Report;
use Piwik\Site;
-use Piwik\ViewDataTable\Factory as ViewDataTableFactory;
-use Piwik\WidgetsList;
abstract class Base extends Report
{
protected function init()
{
$this->module = 'Goals';
- $this->category = 'Goals_Ecommerce';
+ $this->categoryId = 'Goals_Ecommerce';
}
public function isEnabled()
diff --git a/plugins/Ecommerce/Reports/BaseItem.php b/plugins/Ecommerce/Reports/BaseItem.php
index 5caf770a6b..5896710dc2 100644
--- a/plugins/Ecommerce/Reports/BaseItem.php
+++ b/plugins/Ecommerce/Reports/BaseItem.php
@@ -9,15 +9,18 @@
namespace Piwik\Plugins\Ecommerce\Reports;
use Piwik\Common;
+use Piwik\DataTable;
use Piwik\Metrics\Formatter;
use Piwik\Piwik;
-use Piwik\Plugin\Report;
use Piwik\Plugin\ViewDataTable;
use Piwik\Plugins\CoreVisualizations\Visualizations\JqplotGraph\Evolution;
-use Piwik\Plugins\Goals\Goals;
use Piwik\Plugins\Goals\Columns\Metrics\AveragePrice;
use Piwik\Plugins\Goals\Columns\Metrics\AverageQuantity;
use Piwik\Plugins\Goals\Columns\Metrics\ProductConversionRate;
+use Piwik\Plugins\Goals\Conversions;
+use Piwik\Plugins\Goals\Model;
+use Piwik\Report\ReportWidgetFactory;
+use Piwik\Widget\WidgetsList;
abstract class BaseItem extends Base
{
@@ -46,7 +49,8 @@ abstract class BaseItem extends Base
public function getMetricsDocumentation()
{
- if ($this->isAbandonedCart()) {
+ // we do not check whether it is abondon carts if not set re performance improvements
+ if ($this->isAbandonedCart($fetchIfNotSet = false)) {
return array(
'revenue' => Piwik::translate('Goals_ColumnRevenueDocumentation',
Piwik::translate('Goals_DocumentationRevenueGeneratedByProductSales')),
@@ -62,6 +66,11 @@ abstract class BaseItem extends Base
return array();
}
+ public function configureWidgets(WidgetsList $widgetsList, ReportWidgetFactory $factory)
+ {
+ $widgetsList->addToContainerWidget('Products', $factory->createWidget());
+ }
+
public function configureView(ViewDataTable $view)
{
$idSite = Common::getRequestVar('idSite');
@@ -100,7 +109,7 @@ abstract class BaseItem extends Base
$view->config->custom_parameters['viewDataTable'] = 'table';
$abandonedCart = true;
} else {
- $abandonedCart = $this->isAbandonedCart();
+ $abandonedCart = $this->isAbandonedCart($fetchIfNotSet = true);
}
if ($abandonedCart) {
@@ -127,8 +136,32 @@ abstract class BaseItem extends Base
$view->config->columns_to_display = $columnsOrdered;
}
- private function isAbandonedCart()
+ private function isAbandonedCart($fetchIfNotSet)
{
- return Common::getRequestVar('abandonedCarts', '0', 'string') == 1;
+ $abandonedCarts = Common::getRequestVar('abandonedCarts', '', 'string');
+
+ if ($abandonedCarts === '') {
+ if ($fetchIfNotSet) {
+
+ $idSite = Common::getRequestVar('idSite', 0, 'int');
+ $period = Common::getRequestVar('period', '', 'string');
+ $date = Common::getRequestVar('date', '', 'string');
+
+ $conversion = new Conversions();
+ $conversions = $conversion->getConversionForGoal(Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER, $idSite, $period, $date);
+ $cartNbConversions = $conversion->getConversionForGoal(Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_CART, $idSite, $period, $date);
+ $preloadAbandonedCart = $cartNbConversions !== false && $conversions == 0;
+
+ if ($preloadAbandonedCart) {
+ $abandonedCarts = '1';
+ } else {
+ $abandonedCarts = '0';
+ }
+ } else {
+ $abandonedCarts = '0';
+ }
+ }
+
+ return $abandonedCarts == '1';
}
}
diff --git a/plugins/Ecommerce/Reports/GetItemsCategory.php b/plugins/Ecommerce/Reports/GetItemsCategory.php
index bf652ca10d..efd4a9489a 100644
--- a/plugins/Ecommerce/Reports/GetItemsCategory.php
+++ b/plugins/Ecommerce/Reports/GetItemsCategory.php
@@ -20,6 +20,7 @@ class GetItemsCategory extends BaseItem
$this->name = Piwik::translate('Goals_ProductCategory');
$this->dimension = new ProductCategory();
$this->order = 32;
- $this->widgetTitle = 'Goals_ProductCategory';
+
+ $this->subcategoryId = 'Goals_Products';
}
}
diff --git a/plugins/Ecommerce/Reports/GetItemsName.php b/plugins/Ecommerce/Reports/GetItemsName.php
index a320b760e4..db8c7f5d3d 100644
--- a/plugins/Ecommerce/Reports/GetItemsName.php
+++ b/plugins/Ecommerce/Reports/GetItemsName.php
@@ -20,6 +20,7 @@ class GetItemsName extends BaseItem
$this->name = Piwik::translate('Goals_ProductName');
$this->dimension = new ProductName();
$this->order = 31;
- $this->widgetTitle = 'Goals_ProductName';
+
+ $this->subcategoryId = 'Goals_Products';
}
}
diff --git a/plugins/Ecommerce/Reports/GetItemsSku.php b/plugins/Ecommerce/Reports/GetItemsSku.php
index a2b20eb3f9..9056b2ff6c 100644
--- a/plugins/Ecommerce/Reports/GetItemsSku.php
+++ b/plugins/Ecommerce/Reports/GetItemsSku.php
@@ -21,7 +21,8 @@ class GetItemsSku extends BaseItem
$this->name = Piwik::translate('Goals_ProductSKU');
$this->dimension = new ProductSku();
$this->order = 30;
- $this->widgetTitle = 'Goals_ProductSKU';
+
+ $this->subcategoryId = 'Goals_Products';
}
}
diff --git a/plugins/Ecommerce/Widgets.php b/plugins/Ecommerce/Widgets.php
deleted file mode 100644
index e20a73850e..0000000000
--- a/plugins/Ecommerce/Widgets.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-/**
- * Piwik - free/libre analytics platform
- *
- * @link http://piwik.org
- * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
- *
- */
-namespace Piwik\Plugins\Ecommerce;
-
-use Piwik\Common;
-use Piwik\Site;
-use Piwik\Piwik;
-
-class Widgets extends \Piwik\Plugin\Widgets
-{
- protected $category = 'Goals_Ecommerce';
-
- protected function init()
- {
- $idSite = $this->getIdSite();
-
- $site = new Site($idSite);
- if ($site->isEcommerceEnabled()) {
- $this->addWidget('General_Overview', 'widgetGoalReport', array('idGoal' => Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER));
- $this->addWidget('Goals_EcommerceLog', 'getEcommerceLog');
- }
- }
-
- private function getIdSite()
- {
- return Common::getRequestVar('idSite', null, 'int');
- }
-
-}
diff --git a/plugins/Ecommerce/Widgets/GetEcommerceLog.php b/plugins/Ecommerce/Widgets/GetEcommerceLog.php
new file mode 100644
index 0000000000..d1a68a435a
--- /dev/null
+++ b/plugins/Ecommerce/Widgets/GetEcommerceLog.php
@@ -0,0 +1,28 @@
+<?php
+/**
+ * Piwik - free/libre analytics platform
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ *
+ */
+namespace Piwik\Plugins\Ecommerce\Widgets;
+
+use Piwik\Common;
+use Piwik\Widget\WidgetConfig;
+use Piwik\Site;
+
+class GetEcommerceLog extends \Piwik\Widget\Widget
+{
+ public static function configure(WidgetConfig $config)
+ {
+ $config->setCategoryId('Goals_Ecommerce');
+ $config->setSubcategoryId('Goals_EcommerceLog');
+ $config->setName('Goals_EcommerceLog');
+
+ $idSite = Common::getRequestVar('idSite', null, 'int');
+ $site = new Site($idSite);
+ $config->setIsEnabled($site->isEcommerceEnabled());
+ }
+
+}
diff --git a/plugins/Ecommerce/Widgets/ProductsByDimension.php b/plugins/Ecommerce/Widgets/ProductsByDimension.php
new file mode 100644
index 0000000000..2f25e23b76
--- /dev/null
+++ b/plugins/Ecommerce/Widgets/ProductsByDimension.php
@@ -0,0 +1,34 @@
+<?php
+/**
+ * Piwik - free/libre analytics platform
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ *
+ */
+namespace Piwik\Plugins\Ecommerce\Widgets;
+
+use Piwik\Common;
+use Piwik\Plugins\CoreHome\CoreHome;
+use Piwik\Site;
+use Piwik\Widget\WidgetContainerConfig;
+
+class ProductsByDimension extends WidgetContainerConfig
+{
+ protected $layout = CoreHome::WIDGET_CONTAINER_LAYOUT_BY_DIMENSION;
+ protected $id = 'Products';
+ protected $categoryId = 'Goals_Ecommerce';
+ protected $subcategoryId = 'Goals_Products';
+
+ public function isEnabled()
+ {
+ $idSite = Common::getRequestVar('idSite', false, 'int');
+
+ if (empty($idSite)) {
+ return false;
+ }
+
+ $site = new Site($idSite);
+ return $site->isEcommerceEnabled();
+ }
+}
diff --git a/plugins/Ecommerce/templates/conversionOverview.twig b/plugins/Ecommerce/templates/conversionOverview.twig
new file mode 100644
index 0000000000..9b6864c03c
--- /dev/null
+++ b/plugins/Ecommerce/templates/conversionOverview.twig
@@ -0,0 +1,15 @@
+<ul class="ulGoalTopElements">
+ {{ 'General_ColumnRevenue'|translate }}: {{ revenue|money(idSite)|raw -}}
+ {% if revenue_subtotal is not empty %},
+ {{ 'General_Subtotal'|translate }}: {{ revenue_subtotal|money(idSite)|raw -}}
+ {% endif %}
+ {%- if revenue_tax is not empty -%},
+ {{ 'General_Tax'|translate }}: {{ revenue_tax|money(idSite)|raw -}}
+ {% endif %}
+ {%- if revenue_shipping is not empty -%},
+ {{ 'General_Shipping'|translate }}: {{ revenue_shipping|money(idSite)|raw -}}
+ {% endif %}
+ {%- if revenue_discount is not empty -%},
+ {{ 'General_Discount'|translate }}: {{ revenue_discount|money(idSite)|raw -}}
+ {% endif %}
+</ul><br/> \ No newline at end of file
diff --git a/plugins/Ecommerce/templates/ecommerceLog.twig b/plugins/Ecommerce/templates/ecommerceLog.twig
deleted file mode 100644
index 4c40a94d99..0000000000
--- a/plugins/Ecommerce/templates/ecommerceLog.twig
+++ /dev/null
@@ -1,3 +0,0 @@
-<h2 piwik-enriched-headline>{{ 'Goals_EcommerceLog'|translate }}</h2>
-
-{{ ecommerceLog|raw }}
diff --git a/plugins/Ecommerce/templates/getSparklines.twig b/plugins/Ecommerce/templates/getSparklines.twig
new file mode 100644
index 0000000000..0952c081a5
--- /dev/null
+++ b/plugins/Ecommerce/templates/getSparklines.twig
@@ -0,0 +1,55 @@
+<div id='leftcolumn' style="clear:both;{% if not isWidget %}width:33%;'{% endif %}">
+ <div class="sparkline">{{ sparkline(urlSparklineConversions) }}
+ <strong>{{ nb_conversions }}</strong>
+ {{ 'General_EcommerceOrders'|translate }}
+ <img src='plugins/Morpheus/images/ecommerceOrder.gif'>
+
+ {% if goalAllowMultipleConversionsPerVisit is defined and goalAllowMultipleConversionsPerVisit %}
+ ({{ 'General_NVisits'|translate("<strong>"~nb_visits_converted~"</strong>")|raw }})
+ {% endif %}
+ </div>
+
+ <div class="sparkline">
+ {{ sparkline(urlSparklineRevenue) }}
+ {% set revenue=revenue|money(idSite) %}
+ <strong>{{ revenue|raw }}</strong> {{ 'General_TotalRevenue'|translate }}
+ </div>
+
+ <div class="sparkline">{{ sparkline(urlSparklineAverageOrderValue) }}
+ <strong>{{ avg_order_revenue|money(idSite)|raw }}</strong>
+ {{ 'General_AverageOrderValue'|translate }}
+ </div>
+</div>
+<div id='leftcolumn' {% if not isWidget %}style='width:33%;'{% endif %}>
+ <div class="sparkline">{{ sparkline(urlSparklineConversionRate) }}
+ {% set ecommerceOrdersText %}{{ 'General_EcommerceOrders'|translate }}{% endset %}
+ {{ 'Goals_ConversionRate'|translate("<strong>"~conversion_rate~"</strong> "~ecommerceOrdersText)|raw }}
+ </div>
+ <div class="sparkline">{{ sparkline(urlSparklinePurchasedProducts) }}
+ <strong>{{ items }}</strong> {{ 'General_PurchasedProducts'|translate }}</div>
+</div>
+<div id='rightcolumn' {% if not isWidget %}style='width:30%;'{% endif %}>
+ <div>
+ <img src='plugins/Morpheus/images/ecommerceAbandonedCart.gif'> <em>{{ 'General_AbandonedCarts'|translate }}</em>
+ </div>
+
+ <div class="sparkline">
+ {{ sparkline(cart_urlSparklineConversions) }}
+ {% set ecommerceAbandonedCartsText %}{{ 'Goals_AbandonedCart'|translate }}{% endset %}
+ <strong>{{ cart_nb_conversions }}</strong> {{ 'General_VisitsWith'|translate(ecommerceAbandonedCartsText) }}
+ </div>
+
+ <div class="sparkline">
+ {{ sparkline(cart_urlSparklineRevenue) }}
+ {% set revenue %}{{ cart_revenue|money(idSite)|raw }}{% endset %}
+ {% set revenueText %}{{ 'General_ColumnRevenue'|translate }}{% endset %}
+ <strong>{{ revenue }}</strong> {{ 'Goals_LeftInCart'|translate(revenueText) }}
+ </div>
+
+ <div class="sparkline">
+ {{ sparkline(cart_urlSparklineConversionRate) }}
+ <strong>{{ cart_conversion_rate }}</strong>
+ {{ 'General_VisitsWith'|translate(ecommerceAbandonedCartsText) }}
+ </div>
+</div>
+{% include "_sparklineFooter.twig" %}