Skip to content

Commit

Permalink
Refs #4041, removed extra ViewDataTable classes used by Goals Control…
Browse files Browse the repository at this point in the history
…ler.
  • Loading branch information
Benaka Moorthi committed Jul 12, 2013
1 parent 96c3d48 commit 22d7676
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 21 deletions.
4 changes: 3 additions & 1 deletion core/ViewDataTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down
24 changes: 4 additions & 20 deletions plugins/Goals/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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'));
Expand Down Expand Up @@ -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;
}
}

0 comments on commit 22d7676

Please sign in to comment.