From 4cad655824f9d5bf2b667ec522f78f499cd59bf0 Mon Sep 17 00:00:00 2001
From: mattab <matthieu.aubry@gmail.com>
Date: Wed, 5 Jun 2013 16:10:49 +1200
Subject: [PATCH] Adding setting for limiting Custom Variables report in the
 config file, separate from the referrer config. This is especially useful to
 fix an ecommerce bug where "Visits" don't display properly for all products,
 since we used to truncate after 50 rows. Also sets by default to 1000 to
 ensure ecommerce tracking mostly work. Refs #3569

---
 config/global.ini.php                 | 6 +++++-
 plugins/CustomVariables/Archiving.php | 6 ++----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/config/global.ini.php b/config/global.ini.php
index 932b50069e..c01f512adb 100644
--- a/config/global.ini.php
+++ b/config/global.ini.php
@@ -228,11 +228,15 @@ feedback_email_address = "hello@piwik.org"
 
 ; during archiving, Piwik will limit the number of results recorded, for performance reasons
 ; maximum number of rows for any of the Referers tables (keywords, search engines, campaigns, etc.)
-; this limit will also be applied to the Custom Variables names and values reports
 datatable_archiving_maximum_rows_referers = 1000
 ; maximum number of rows for any of the Referers subtable (search engines by keyword, keyword by campaign, etc.)
 datatable_archiving_maximum_rows_subtable_referers = 50
 
+; maximum number of rows for the Custom Variables names report
+datatable_archiving_maximum_rows_custom_variables = 1000
+; maximum number of rows for the Custom Variables values reports
+datatable_archiving_maximum_rows_subtable_custom_variables = 1000
+
 ; maximum number of rows for any of the Actions tables (pages, downloads, outlinks)
 datatable_archiving_maximum_rows_actions = 500
 ; maximum number of rows for pages in categories (sub pages, when clicking on the + for a page category)
diff --git a/plugins/CustomVariables/Archiving.php b/plugins/CustomVariables/Archiving.php
index e9ca547707..166d8c9124 100644
--- a/plugins/CustomVariables/Archiving.php
+++ b/plugins/CustomVariables/Archiving.php
@@ -21,9 +21,8 @@ class Piwik_CustomVariables_Archiving
 
     function __construct()
     {
-        //TODO FIX
-        $this->maximumRowsInDataTableLevelZero = Piwik_Config::getInstance()->General['datatable_archiving_maximum_rows_referers'];
-        $this->maximumRowsInSubDataTable = Piwik_Config::getInstance()->General['datatable_archiving_maximum_rows_subtable_referers'];
+        $this->maximumRowsInDataTableLevelZero = Piwik_Config::getInstance()->General['datatable_archiving_maximum_rows_custom_variables'];
+        $this->maximumRowsInSubDataTable = Piwik_Config::getInstance()->General['datatable_archiving_maximum_rows_subtable_custom_variables'];
     }
 
     public function archiveDay(Piwik_ArchiveProcessing_Day $archiveProcessing)
@@ -32,7 +31,6 @@ class Piwik_CustomVariables_Archiving
 
         $table = $archiveProcessing->getDataTableWithSubtablesFromArraysIndexedByLabel($this->metricsByKeyAndValue, $this->metricsByKey);
 
-
         $blob = $table->getSerialized(
             $this->maximumRowsInDataTableLevelZero, $this->maximumRowsInSubDataTable,
             $columnToSort = Piwik_Archive::INDEX_NB_VISITS
-- 
GitLab