diff options
author | Thomas Steur <thomas.steur@gmail.com> | 2015-01-06 01:06:54 +0300 |
---|---|---|
committer | Thomas Steur <thomas.steur@gmail.com> | 2015-01-07 06:35:34 +0300 |
commit | 67055650e1ea7c3bc51a687e92652d8d16b201f8 (patch) | |
tree | 269be1aac53d5f62b3fa09f9f56015ddef93ea91 /plugins/Ecommerce/Controller.php | |
parent | f8ef2532e1ebcc5c00c9492f504875022eee4f9a (diff) |
refs #6022 separate goals and ecommerce menu items, added goals management menu item
Diffstat (limited to 'plugins/Ecommerce/Controller.php')
-rw-r--r-- | plugins/Ecommerce/Controller.php | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/plugins/Ecommerce/Controller.php b/plugins/Ecommerce/Controller.php new file mode 100644 index 0000000000..322756eda4 --- /dev/null +++ b/plugins/Ecommerce/Controller.php @@ -0,0 +1,58 @@ +<?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 Exception; +use Piwik\DataTable; +use Piwik\FrontController; +use Piwik\Piwik; +use Piwik\View; + +class Controller extends \Piwik\Plugins\Goals\Controller +{ + public function ecommerceReport() + { + 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)."); + } + + $view = $this->getGoalReportView($idGoal = Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER); + $view->displayFullReport = false; + $view->showHeadline = true; + return $view->render(); + } + + 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; + return $output; + } + + public function index() + { + return $this->ecommerceReport(); + } + + public function ecommerceProducts() + { + $viewOverview = $this->getGoalReportView(Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER); + $reportsByDimension = $viewOverview->goalReportsByDimension; + + $view = new View('@Ecommerce/ecommerceProducts'); + $this->setGeneralVariablesView($view); + + $view->goalReportsByDimension = $reportsByDimension; + return $view->render(); + } + +} |