diff options
author | mattpiwik <matthieu.aubry@gmail.com> | 2011-09-19 11:56:23 +0400 |
---|---|---|
committer | mattpiwik <matthieu.aubry@gmail.com> | 2011-09-19 11:56:23 +0400 |
commit | 635f05698f4407b864dc39f435a226558dc6f871 (patch) | |
tree | f4a6fc2b55e3905638a5f3a4931fe16b30212ac1 /plugins/CustomVariables/API.php | |
parent | d3c082277fffbdeced912b15bfaebe79a5f3dd6c (diff) |
Fixes #2660
* Adding price tracking on Ecommerce pages, via JS or PHP api.
* Displaying price in API field avg_price ONLY IF the product was NOT purchased. If a product was purchased, the "display price" tracked is not displayed and purchased price is used instead.
* Price tracked with this feature will ONLY be displayed as "Avg_price" in Product Names, and Product SKUs ONLY WHEN the products havent been bought.
* Hacking around tracking price for ecommerce items, using a custom variable and small custom hacks to the SQL to get the average price for each custom var.
Similar to doing basic version of custom variables co variation
* Allow custom variables values to be integer (previously would fail to record the custom variable)
TODO: Update Doc
git-svn-id: http://dev.piwik.org/svn/trunk@5191 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'plugins/CustomVariables/API.php')
-rw-r--r-- | plugins/CustomVariables/API.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/plugins/CustomVariables/API.php b/plugins/CustomVariables/API.php index 3969d53d84..eecfd7a2d5 100644 --- a/plugins/CustomVariables/API.php +++ b/plugins/CustomVariables/API.php @@ -56,6 +56,7 @@ class Piwik_CustomVariables_API '_pks' => Piwik_Translate('Goals_ProductSKU'), '_pkn' => Piwik_Translate('Goals_ProductName'), '_pkc' => Piwik_Translate('Goals_ProductCategory'), + '_pkp' => 'do not display price values in UI' ); foreach($mapping as $core => $friendly) { @@ -63,6 +64,10 @@ class Piwik_CustomVariables_API if($row) { $row->setColumn('label', $friendly); + if($core == '_pkp') + { + $dataTable->deleteRow($dataTable->getRowIdFromLabel($core)); + } } } } @@ -75,6 +80,9 @@ class Piwik_CustomVariables_API public function getCustomVariablesValuesFromNameId($idSite, $period, $date, $idSubtable, $segment = false) { $dataTable = $this->getDataTable($idSite, $period, $date, $segment, $expanded = false, $idSubtable); + + // Hack Ecommerce product price tracking to display correctly + $dataTable->renameColumn('price_viewed', 'price'); return $dataTable; } } |