From a3c8a9ed30bf2abd8c37d3c6f9f419365c7d9424 Mon Sep 17 00:00:00 2001 From: diosmosis Date: Tue, 2 Dec 2014 18:20:49 -0800 Subject: [PATCH] Make sure ecommerceOrder/ecommerceAbandonedCart isn't used as viewDataTable anywhere. --- plugins/CoreHome/javascripts/dataTable.js | 7 ++++++- plugins/CoreHome/templates/_dataTableFooter.twig | 2 +- plugins/Goals/Reports/BaseEcommerceItem.php | 11 +++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/plugins/CoreHome/javascripts/dataTable.js b/plugins/CoreHome/javascripts/dataTable.js index b88bb895f2f..5b37493a609 100644 --- a/plugins/CoreHome/javascripts/dataTable.js +++ b/plugins/CoreHome/javascripts/dataTable.js @@ -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); diff --git a/plugins/CoreHome/templates/_dataTableFooter.twig b/plugins/CoreHome/templates/_dataTableFooter.twig index 52a355ee9f6..ec2b9fd21cf 100644 --- a/plugins/CoreHome/templates/_dataTableFooter.twig +++ b/plugins/CoreHome/templates/_dataTableFooter.twig @@ -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)) %} {% if properties.show_active_view_icon and (clientSideParameters.viewDataTable == footerIcon.id or isActiveEcommerceView) %} diff --git a/plugins/Goals/Reports/BaseEcommerceItem.php b/plugins/Goals/Reports/BaseEcommerceItem.php index 84dd8c7fd55..23788abc555 100644 --- a/plugins/Goals/Reports/BaseEcommerceItem.php +++ b/plugins/Goals/Reports/BaseEcommerceItem.php @@ -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()