Skip to content

Commit

Permalink
Make sure ecommerceOrder/ecommerceAbandonedCart isn't used as viewDat…
Browse files Browse the repository at this point in the history
…aTable anywhere.
  • Loading branch information
diosmosis committed Dec 3, 2014
1 parent 8a8a5e3 commit a3c8a9e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
7 changes: 6 additions & 1 deletion plugins/CoreHome/javascripts/dataTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -1897,7 +1897,12 @@ var switchToEcommerceView = function (dataTable, viewDataTable) {
dataTable.param.abandonedCarts = '1';
}

switchToHtmlTable(dataTable, dataTable.param.viewDataTable);
var viewDataTable = dataTable.param.viewDataTable;
if (viewDataTable == 'ecommerceOrder' || viewDataTable == 'ecommerceAbandonedCart') {
viewDataTable = 'table';
}

switchToHtmlTable(dataTable, viewDataTable);
};

DataTable.registerFooterIconHandler('table', switchToHtmlTable);
Expand Down
2 changes: 1 addition & 1 deletion plugins/CoreHome/templates/_dataTableFooter.twig
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
{% for footerIcon in footerIconGroup.buttons %}
{% set isActiveEcommerceView = clientSideParameters.abandonedCarts is defined and
((footerIcon.id == 'ecommerceOrder' and clientSideParameters.abandonedCarts == 0) or
(footerIcon.id == 'ecommerceAbandonedCart' and clientSideParameters.abandonedCarts == 1)) %}
(footerIcon.id == 'ecommerceAbandonedCart' and clientSideParameters.abandonedCarts == 1)) %}
<span>
{% if properties.show_active_view_icon and (clientSideParameters.viewDataTable == footerIcon.id or isActiveEcommerceView) %}
<img src="plugins/Morpheus/images/data_table_footer_active_item.png" class="dataTableFooterActiveItem"/>
Expand Down
11 changes: 11 additions & 0 deletions plugins/Goals/Reports/BaseEcommerceItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,17 @@ public function configureView(ViewDataTable $view)

$view->config->addTranslations($translations);
$view->config->columns_to_display = $columnsOrdered;

// handle old case where viewDataTable is set to ecommerceOrder/ecommerceAbandonedCart. in this case, we
// set abandonedCarts accordingly and remove the ecommerceOrder/ecommerceAbandonedCart as viewDataTable.
$viewDataTable = Common::getRequestVar('viewDataTable', '');
if ($viewDataTable == 'ecommerceOrder') {
$view->config->custom_parameters['abandonedCarts'] = '0';
$view->config->custom_parameters['viewDataTable'] = 'table';
} else if ($viewDataTable == 'ecommerceAbandonedCart') {
$view->config->custom_parameters['abandonedCarts'] = '1';
$view->config->custom_parameters['viewDataTable'] = 'table';
}
}

private function isAbandonedCart()
Expand Down

0 comments on commit a3c8a9e

Please sign in to comment.