From 22d767681a824087e3a228c3e3ba1f842c6272b8 Mon Sep 17 00:00:00 2001 From: Benaka Moorthi Date: Thu, 11 Jul 2013 20:50:16 -0400 Subject: [PATCH] Refs #4041, removed extra ViewDataTable classes used by Goals Controller. --- core/ViewDataTable.php | 4 +++- plugins/Goals/Controller.php | 24 ++++-------------------- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/core/ViewDataTable.php b/core/ViewDataTable.php index 3415c817f5a..021cac985e3 100644 --- a/core/ViewDataTable.php +++ b/core/ViewDataTable.php @@ -697,7 +697,9 @@ protected function getJavascriptVariablesToSet() $javascriptVariablesToSet['module'] = $this->currentControllerName; $javascriptVariablesToSet['action'] = $this->currentControllerAction; - $javascriptVariablesToSet['viewDataTable'] = $this->getViewDataTableId(); + if (!isset($javascriptVariablesToSet['viewDataTable'])) { + $javascriptVariablesToSet['viewDataTable'] = $this->getViewDataTableId(); + } $javascriptVariablesToSet['controllerActionCalledWhenRequestSubTable'] = $this->controllerActionCalledWhenRequestSubTable; if ($this->dataTable && diff --git a/plugins/Goals/Controller.php b/plugins/Goals/Controller.php index ee4c39454b6..9ac2b3fd777 100644 --- a/plugins/Goals/Controller.php +++ b/plugins/Goals/Controller.php @@ -90,7 +90,8 @@ protected function getItemsView($fetch, $type, $function, $api, $abandonedCart = // Products in Ecommerce Orders if ($abandonedCart === false) { - $view = new Piwik_ViewDataTable_HtmlTable_EcommerceOrder(); + $view = new Piwik_ViewDataTable_HtmlTable(); + $view->setCustomParameter('viewDataTable', Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER); $columns = Piwik_Goals::getProductReportColumns(); $view->setMetricDocumentation('revenue', Piwik_Translate('Goals_ColumnRevenueDocumentation', Piwik_Translate('Goals_DocumentationRevenueGeneratedByProductSales'))); $view->setMetricDocumentation('quantity', Piwik_Translate('Goals_ColumnQuantityDocumentation', $label)); @@ -101,7 +102,8 @@ protected function getItemsView($fetch, $type, $function, $api, $abandonedCart = $view->setMetricDocumentation('conversion_rate', Piwik_Translate('Goals_ColumnConversionRateProductDocumentation', $label)); } // Products in Abandoned Carts else { - $view = new Piwik_ViewDataTable_HtmlTable_EcommerceAbandonedCart(); + $view = new Piwik_ViewDataTable_HtmlTable(); + $view->setCustomParameter('viewDataTable', Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_CART); $columns = Piwik_Goals::getProductReportColumns(); $columns['abandoned_carts'] = Piwik_Translate('General_AbandonedCarts'); $columns['revenue'] = Piwik_Translate('Goals_LeftInCart', Piwik_Translate('General_ProductRevenue')); @@ -555,21 +557,3 @@ private function getGoalReportsByDimensionTable($conversions, $ecommerce = false return $goalReportsByDimension->render(); } } - - -// Used so that the template knows which datatable is being currently viewed -class Piwik_ViewDataTable_HtmlTable_EcommerceOrder extends Piwik_ViewDataTable_HtmlTable -{ - protected function getViewDataTableId() - { - return Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER; - } -} - -class Piwik_ViewDataTable_HtmlTable_EcommerceAbandonedCart extends Piwik_ViewDataTable_HtmlTable -{ - protected function getViewDataTableId() - { - return Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_CART; - } -}