From 0805e5fde0ce64098fcc6017b77b01463c3620bc Mon Sep 17 00:00:00 2001 From: mattab Date: Thu, 27 Nov 2014 18:17:46 +1300 Subject: Fixes #6713 Ecommerce log will now show the full Log for each visit who converted some ecommerce conversions or abandoned carts. Removed 'filterEcommerce' hack from codebase. --- plugins/Live/Controller.php | 1 - plugins/Live/VisitorLog.php | 26 --- plugins/Live/templates/_actionsList.twig | 177 ++++++++++----------- .../Live/templates/_dataTableViz_visitorLog.twig | 4 +- plugins/Live/templates/getVisitList.twig | 1 - plugins/Live/templates/indexVisitorLog.twig | 2 +- 6 files changed, 90 insertions(+), 121 deletions(-) (limited to 'plugins/Live') diff --git a/plugins/Live/Controller.php b/plugins/Live/Controller.php index 0b540b71d8..9df3e26ff8 100644 --- a/plugins/Live/Controller.php +++ b/plugins/Live/Controller.php @@ -57,7 +57,6 @@ class Controller extends \Piwik\Plugin\Controller public function indexVisitorLog() { $view = new View('@Live/indexVisitorLog.twig'); - $view->filterEcommerce = Common::getRequestVar('filterEcommerce', 0, 'int'); $view->visitorLog = $this->renderReport(new GetLastVisitsDetails()); return $view->render(); } diff --git a/plugins/Live/VisitorLog.php b/plugins/Live/VisitorLog.php index 054b2f50ae..d3d93c2dd4 100644 --- a/plugins/Live/VisitorLog.php +++ b/plugins/Live/VisitorLog.php @@ -67,8 +67,6 @@ class VisitorLog extends Visualization $this->config->documentation = Piwik::translate('Live_VisitorLogDocumentation', array('
', '
')); - $filterEcommerce = Common::getRequestVar('filterEcommerce', 0, 'int'); - if (!is_array($this->config->custom_parameters)) { $this->config->custom_parameters = array(); } @@ -76,7 +74,6 @@ class VisitorLog extends Visualization // set a very high row count so that the next link in the footer of the data table is always shown $this->config->custom_parameters['totalRows'] = 10000000; $this->config->custom_parameters['smallWidth'] = (1 == Common::getRequestVar('small', 0, 'int')); - $this->config->custom_parameters['filterEcommerce'] = $filterEcommerce; $this->config->custom_parameters['pageUrlNotDefined'] = Piwik::translate('General_NotDefined', Piwik::translate('Actions_ColumnPageURL')); $this->config->footer_icons = array( @@ -91,28 +88,5 @@ class VisitorLog extends Visualization ) ) ); - - // determine if each row has ecommerce activity or not - if ($filterEcommerce) { - $this->dataTable->filter( - 'ColumnCallbackAddMetadata', - array( - 'actionDetails', - 'hasEcommerce', - function ($actionDetails) use ($filterEcommerce) { - foreach ($actionDetails as $action) { - $isEcommerceOrder = $action['type'] == 'ecommerceOrder' - && $filterEcommerce == \Piwik\Plugins\Goals\Controller::ECOMMERCE_LOG_SHOW_ORDERS; - $isAbandonedCart = $action['type'] == 'ecommerceAbandonedCart' - && $filterEcommerce == \Piwik\Plugins\Goals\Controller::ECOMMERCE_LOG_SHOW_ABANDONED_CARTS; - if ($isAbandonedCart || $isEcommerceOrder) { - return true; - } - } - return false; - } - ) - ); - } } } diff --git a/plugins/Live/templates/_actionsList.twig b/plugins/Live/templates/_actionsList.twig index cc798f4f6e..0598c2608f 100644 --- a/plugins/Live/templates/_actionsList.twig +++ b/plugins/Live/templates/_actionsList.twig @@ -12,34 +12,34 @@ {% endfor %} {% endif %} {% endset %} - {% if not clientSideParameters.filterEcommerce or action.type == 'ecommerceOrder' or action.type == 'ecommerceAbandonedCart' %} -
  • -
    - {% if action.type == 'ecommerceOrder' or action.type == 'ecommerceAbandonedCart' %} - {# Ecommerce Abandoned Cart / Ecommerce Order #} - - {% if action.type == 'ecommerceOrder' %} - {{ 'Goals_EcommerceOrder'|translate }} - ({{ action.orderId }}) - {% else %} - {{'Goals_AbandonedCart'|translate}} +
    + {% if action.type == 'ecommerceOrder' or action.type == 'ecommerceAbandonedCart' %} + {# Ecommerce Abandoned Cart / Ecommerce Order #} + + {% if action.type == 'ecommerceOrder' %} + {{ 'Goals_EcommerceOrder'|translate }} + ({{ action.orderId }}) + {% else %} + {{'Goals_AbandonedCart'|translate}} - {# TODO: would be nice to have the icons Orders / Cart in the ecommerce log footer #} - {% endif %} -

    - - {% if action.type == 'ecommerceOrder' %} + {# TODO: would be nice to have the icons Orders / Cart in the ecommerce log footer #} + {% endif %} +

    + + {% if action.type == 'ecommerceOrder' %} {# spacing is important for tooltip to look nice #} {% set ecommerceOrderTooltip %}{{ 'General_ColumnRevenue'|translate }}: {{ action.revenue|money(clientSideParameters.idSite)|raw }} {% if action.revenueSubTotal is not empty %} - {{ 'General_Subtotal'|translate }}: {{ action.revenueSubTotal|money(clientSideParameters.idSite)|raw }}{% endif %} @@ -50,83 +50,82 @@ {% if action.revenueDiscount is not empty %} - {{ 'General_Discount'|translate }}: {{ action.revenueDiscount|money(clientSideParameters.idSite)|raw }}{% endif %} {% endset %} - {{ 'General_ColumnRevenue'|translate }}: - {% else %} - {% set revenueLeft %}{{ 'General_ColumnRevenue'|translate }}{% endset %} - {{ 'Goals_LeftInCart'|translate(revenueLeft) }}: - {% endif %} - {{ action.revenue|money(clientSideParameters.idSite)|raw }} - {% if action.type == 'ecommerceOrder' %} - - {% endif %}, {{ 'General_Quantity'|translate }}: {{ action.items }} + {{ 'General_ColumnRevenue'|translate }}: + {% else %} + {% set revenueLeft %}{{ 'General_ColumnRevenue'|translate }}{% endset %} + {{ 'Goals_LeftInCart'|translate(revenueLeft) }}: + {% endif %} + {{ action.revenue|money(clientSideParameters.idSite)|raw }} + {% if action.type == 'ecommerceOrder' %} + + {% endif %}, {{ 'General_Quantity'|translate }}: {{ action.items }} - {# Ecommerce items in Cart/Order #} - {% if action.itemDetails is not empty %} -

      - {% for product in action.itemDetails %} -
    • - {{ product.itemSKU }}{% if product.itemName is not empty %}: {{ product.itemName }}{% endif %} - {% if product.itemCategory is not empty %} ({{ product.itemCategory }}){% endif %} - , - {{ 'General_Quantity'|translate }}: {{ product.quantity }}, - {{ 'General_Price'|translate }}: {{ product.price|money(clientSideParameters.idSite)|raw }} -
    • - {% endfor %} -
    - {% endif %} - -

    - {% elseif action.goalName is not defined%} - {# Page view / Download / Outlink / Event #} - {% if action.pageTitle|default(false) is not empty %} - {{ action.pageTitle|rawSafeDecoded }} + {# Ecommerce items in Cart/Order #} + {% if action.itemDetails is not empty %} +
      + {% for product in action.itemDetails %} +
    • + {{ product.itemSKU }}{% if product.itemName is not empty %}: {{ product.itemName }}{% endif %} + {% if product.itemCategory is not empty %} ({{ product.itemCategory }}){% endif %} + , + {{ 'General_Quantity'|translate }}: {{ product.quantity }}, + {{ 'General_Price'|translate }}: {{ product.price|money(clientSideParameters.idSite)|raw }} +
    • + {% endfor %} +
    {% endif %} - {% if action.siteSearchKeyword is defined %} - {% if action.type == 'search' %} - - {% endif %} - {{ action.siteSearchKeyword }} + +

    + {% elseif action.goalName is not defined%} + {# Page view / Download / Outlink / Event #} + {% if action.pageTitle|default(false) is not empty %} + {{ action.pageTitle|rawSafeDecoded }} + {% endif %} + {% if action.siteSearchKeyword is defined %} + {% if action.type == 'search' %} + {% endif %} - {% if action.eventCategory|default(false) is not empty %} - - {{ action.eventCategory|rawSafeDecoded }} - {{ action.eventAction|rawSafeDecoded }} {% if action.eventName is defined %}- {{ action.eventName|rawSafeDecoded }}{% endif %} {% if action.eventValue is defined %}[{{ action.eventValue }}]{% endif %} + {{ action.siteSearchKeyword }} + {% endif %} + {% if action.eventCategory|default(false) is not empty %} + + {{ action.eventCategory|rawSafeDecoded }} - {{ action.eventAction|rawSafeDecoded }} {% if action.eventName is defined %}- {{ action.eventName|rawSafeDecoded }}{% endif %} {% if action.eventValue is defined %}[{{ action.eventValue }}]{% endif %} + {% endif %} + {% if action.url is not empty %} + {% if action.type == 'action' and action.pageTitle|default(false) is not empty %}

    {% endif %} + {% if action.type == 'download' or action.type == 'outlink' %} + {% endif %} - {% if action.url is not empty %} - {% if action.type == 'action' and action.pageTitle|default(false) is not empty %}

    {% endif %} - {% if action.type == 'download' or action.type == 'outlink' %} - - {% endif %} - {% if action.eventCategory|default(false) is not empty - and previousAction.url|default(false) == action.url %} - {# For events, do not show (url) if the Event URL is the same as the URL last displayed #} - {% else %} - - {% if action.eventCategory|default(false) is not empty %} - (url) - {% else %} - {{ action.url }} - {% endif %} - - {% endif %} - {% if action.type == 'action' and action.pageTitle|default(false) is not empty %}

    {% endif %} - {% elseif action.type != 'search' and action.type != 'event' %} -

    - {{ clientSideParameters.pageUrlNotDefined }} -

    - {% endif %} - {% else %} - {# Goal conversion #} - - {{ action.goalName }} - {% if action.revenue > 0 %}, {{ 'General_ColumnRevenue'|translate }}: - {{ action.revenue|money(clientSideParameters.idSite)|raw }} + {% if action.eventCategory|default(false) is not empty + and previousAction.url|default(false) == action.url %} + {# For events, do not show (url) if the Event URL is the same as the URL last displayed #} + {% else %} + + {% if action.eventCategory|default(false) is not empty %} + (url) + {% else %} + {{ action.url }} + {% endif %} + {% endif %} + {% if action.type == 'action' and action.pageTitle|default(false) is not empty %}

    {% endif %} + {% elseif action.type != 'search' and action.type != 'event' %} +

    + {{ clientSideParameters.pageUrlNotDefined }} +

    + {% endif %} + {% else %} + {# Goal conversion #} + + {{ action.goalName }} + {% if action.revenue > 0 %}, {{ 'General_ColumnRevenue'|translate }}: + {{ action.revenue|money(clientSideParameters.idSite)|raw }} {% endif %} -
    -
  • - {% endif %} + {% endif %} + + {% set previousAction = action %} {% endfor %} \ No newline at end of file diff --git a/plugins/Live/templates/_dataTableViz_visitorLog.twig b/plugins/Live/templates/_dataTableViz_visitorLog.twig index 922ed2057b..cf0460501a 100644 --- a/plugins/Live/templates/_dataTableViz_visitorLog.twig +++ b/plugins/Live/templates/_dataTableViz_visitorLog.twig @@ -198,9 +198,7 @@ GPS (lat/long): {{ visitor.getColumn('latitude') }},{{ visitor.getColumn('longit {% endset %} - {% if not clientSideParameters.filterEcommerce or visitor.getMetadata('hasEcommerce') %} - {{ visitorRow }} - {% endif %} + {{ visitorRow }} {% endfor %} diff --git a/plugins/Live/templates/getVisitList.twig b/plugins/Live/templates/getVisitList.twig index 478219748b..b536f2f36f 100644 --- a/plugins/Live/templates/getVisitList.twig +++ b/plugins/Live/templates/getVisitList.twig @@ -15,7 +15,6 @@
      {% include "@Live/_actionsList.twig" with {'actionDetails': visitInfo.getColumn('actionDetails'), 'clientSideParameters': { - 'filterEcommerce': false, 'idSite': idSite, 'pageUrlNotDefined': 'General_NotDefined'|translate('Actions_ColumnPageURL'|translate) }, diff --git a/plugins/Live/templates/indexVisitorLog.twig b/plugins/Live/templates/indexVisitorLog.twig index c856fa72e8..3e3460c072 100644 --- a/plugins/Live/templates/indexVisitorLog.twig +++ b/plugins/Live/templates/indexVisitorLog.twig @@ -1,3 +1,3 @@ -

      {% if filterEcommerce %}{{ 'Goals_EcommerceLog'|translate }}{% else %}{{ 'Live_VisitorLog'|translate }}{% endif %}

      +

      {% if currentAction == 'indexVisitorLog' %}{{ 'Goals_EcommerceLog'|translate }}{% else %}{{ 'Live_VisitorLog'|translate }}{% endif %}

      {{ visitorLog|raw }} -- cgit v1.2.3