eCommerce Error Piwik 1.8.2


#1

I have just upgraded from v 1.8.1 to 1.8.2 and am receiving an error when clicking on a SKU # in any ecommerce report.
Anything that can be done to help me resolve this would be extremely appreciated.
The error is as follows:


There is an error. Please report the message (Piwik 1.8.2) and full backtrace in the Piwik forums (please do a Search first as it might have been reported already!).

Notice: Undefined offset: 0 in /opt/mercury/apps/piwik/htdocs/core/DataTable.php on line 470 

Backtrace -->
#0 Piwik_ErrorHandler(...) called at [/opt/mercury/apps/piwik/htdocs/core/DataTable.php:470]#1 Piwik_DataTable->getRowFromLabel(...) called at [/opt/mercury/apps/piwik/htdocs/core/DataTable.php:513]#2 Piwik_DataTable->getFilteredTableFromLabel(...) called at [/opt/mercury/apps/piwik/htdocs/core/DataTable/Array.php:252]#3 Piwik_DataTable_Array->getFilteredTableFromLabel(...) called at [/opt/mercury/apps/piwik/htdocs/core/API/DataTableManipulator/LabelFilter.php:72]#4 Piwik_API_DataTableManipulator_LabelFilter->filter(...) called at [/opt/mercury/apps/piwik/htdocs/core/API/ResponseBuilder.php:323]#5 Piwik_API_ResponseBuilder->handleDataTable(...) called at [/opt/mercury/apps/piwik/htdocs/core/API/ResponseBuilder.php:79]#6 Piwik_API_ResponseBuilder->getResponse(...) called at [/opt/mercury/apps/piwik/htdocs/core/API/Request.php:130]#7 Piwik_API_Request->process(...) called at [/opt/mercury/apps/piwik/htdocs/plugins/API/API.php:1195]#8 Piwik_API_API->loadRowEvolutionDataFromAPI(...) called at [/opt/mercury/apps/piwik/htdocs/plugins/API/API.php:1092]#9 Piwik_API_API->getSingleRowEvolution(...) called at [/opt/mercury/apps/piwik/htdocs/plugins/API/API.php:1078]#10 Piwik_API_API->getRowEvolution(...) called at [:]#11 call_user_func_array(...) called at [/opt/mercury/apps/piwik/htdocs/core/API/Proxy.php:190]#12 Piwik_API_Proxy->call(...) called at [/opt/mercury/apps/piwik/htdocs/core/API/Request.php:128]#13 Piwik_API_Request->process(...) called at [/opt/mercury/apps/piwik/htdocs/plugins/CoreHome/DataTableRowAction/RowEvolution.php:162]#14 Piwik_CoreHome_DataTableRowAction_RowEvolution->loadEvolutionReport(...) called at [/opt/mercury/apps/piwik/htdocs/plugins/CoreHome/DataTableRowAction/RowEvolution.php:99]#15 Piwik_CoreHome_DataTableRowAction_RowEvolution->__construct(...) called at [/opt/mercury/apps/piwik/htdocs/plugins/CoreHome/Controller.php:138]#16 Piwik_CoreHome_Controller->getRowEvolutionPopover(...) called at [:]#17 call_user_func_array(...) called at [/opt/mercury/apps/piwik/htdocs/core/FrontController.php:138]#18 Piwik_FrontController->dispatch(...) called at [/opt/mercury/apps/piwik/htdocs/index.php:53]


There is an error. Please report the message (Piwik 1.8.2) and full backtrace in the Piwik forums (please do a Search first as it might have been reported already!).

Recoverable Error: Argument 1 passed to Piwik_DataTable::addRow() must be an instance of Piwik_DataTable_Row, null given, called in /opt/mercury/apps/piwik/htdocs/core/DataTable.php on line 516 and defined in /opt/mercury/apps/piwik/htdocs/core/DataTable.php on line 593 

Backtrace -->
#0 Piwik_ErrorHandler(...) called at [/opt/mercury/apps/piwik/htdocs/core/DataTable.php:593]#1 Piwik_DataTable->addRow(...) called at [/opt/mercury/apps/piwik/htdocs/core/DataTable.php:516]#2 Piwik_DataTable->getFilteredTableFromLabel(...) called at [/opt/mercury/apps/piwik/htdocs/core/DataTable/Array.php:252]#3 Piwik_DataTable_Array->getFilteredTableFromLabel(...) called at [/opt/mercury/apps/piwik/htdocs/core/API/DataTableManipulator/LabelFilter.php:72]#4 Piwik_API_DataTableManipulator_LabelFilter->filter(...) called at [/opt/mercury/apps/piwik/htdocs/core/API/ResponseBuilder.php:323]#5 Piwik_API_ResponseBuilder->handleDataTable(...) called at [/opt/mercury/apps/piwik/htdocs/core/API/ResponseBuilder.php:79]#6 Piwik_API_ResponseBuilder->getResponse(...) called at [/opt/mercury/apps/piwik/htdocs/core/API/Request.php:130]#7 Piwik_API_Request->process(...) called at [/opt/mercury/apps/piwik/htdocs/plugins/API/API.php:1195]#8 Piwik_API_API->loadRowEvolutionDataFromAPI(...) called at [/opt/mercury/apps/piwik/htdocs/plugins/API/API.php:1092]#9 Piwik_API_API->getSingleRowEvolution(...) called at [/opt/mercury/apps/piwik/htdocs/plugins/API/API.php:1078]#10 Piwik_API_API->getRowEvolution(...) called at [:]#11 call_user_func_array(...) called at [/opt/mercury/apps/piwik/htdocs/core/API/Proxy.php:190]#12 Piwik_API_Proxy->call(...) called at [/opt/mercury/apps/piwik/htdocs/core/API/Request.php:128]#13 Piwik_API_Request->process(...) called at [/opt/mercury/apps/piwik/htdocs/plugins/CoreHome/DataTableRowAction/RowEvolution.php:162]#14 Piwik_CoreHome_DataTableRowAction_RowEvolution->loadEvolutionReport(...) called at [/opt/mercury/apps/piwik/htdocs/plugins/CoreHome/DataTableRowAction/RowEvolution.php:99]#15 Piwik_CoreHome_DataTableRowAction_RowEvolution->__construct(...) called at [/opt/mercury/apps/piwik/htdocs/plugins/CoreHome/Controller.php:138]#16 Piwik_CoreHome_Controller->getRowEvolutionPopover(...) called at [:]#17 call_user_func_array(...) called at [/opt/mercury/apps/piwik/htdocs/core/FrontController.php:138]#18 Piwik_FrontController->dispatch(...) called at [/opt/mercury/apps/piwik/htdocs/index.php:53]


(Matthieu Aubry) #2

Thanks for the report. the bug is at: Message: Notice: Undefined offset: 0 in /homeDataTable.php on line 470 · Issue #3180 · matomo-org/matomo · GitHub

Can you please try the following patch?


Index: core/DataTable.php
===================================================================
--- core/DataTable.php	(revision 6463)
+++ core/DataTable.php	(working copy)
@@ -465,7 +465,7 @@
 	public function getRowFromLabel( $label )
 	{
 		$rowId = $this->getRowIdFromLabel($label);
-		if(is_int($rowId))
+		if(is_int($rowId) && isset($this->rows[$rowId]))
 		{
 			return $this->rows[$rowId];
 		}


#3

Thanks Matt,
The patch was semi successful, I had to make a quick similar edit @ line 519.

There is no longer an error, but no graph data is available. I have attached two screenshots. One to demonstrate the lack of data for the graph, and the other one showing the dashboard widget with accurate data for the same sku.

Thank you VERY much for looking at this. It is really appreciated.



public function getFilteredTableFromLabel($label)
	{
		$newTable = $this->getEmptyClone();
		$row = $this->getRowFromLabel($label); 
-                if ($row !== false)   
+		if ($row !== false && isset($this->rows[$row]))
		{
			$newTable->addRow($row);
		}
		return $newTable;
	}


(Matthieu Aubry) #4

do you have the problem on each day or only on some days?
I would like to be able to reproduce the problem to be able to fix it properly… any tip on how to reproduce would be great?