InaneCoding / Piwik-OpenCart-Ecommerce-VQMod

A repository for the Piwik Ecommerce mod for Open Cart using VQmod.
22 stars 17 forks source link

Check GET values are set before using #16

Closed kevinb456 closed 10 years ago

kevinb456 commented 10 years ago

Received message from user;

Great extension but I'm getting the following error on my homepage: Notice: Undefined index: route in /home/wwwridem/public_html/catalog/model/tool/piwik.php on line 218 

The GET variable 'route' is used before checking it is set. This only causes a PHP 'notice' so shouldnt affect operation, however would be good coding practice to solve. Also noticed in my logs other places where this is happening, so look at the other places where this may be happening aswell.

kevinb456 commented 10 years ago

Second user reported within a few hours of first, and saying that it stops homepage loading - think opencart may produce an error on loading for PHP 'notices' by default. Can turn off by changing the lines in the php.ini file;

;display_errors = 1;
;error_reporting = E_ALL; 

However not a good fix - better to remove the cause.

kevinb456 commented 10 years ago

Another user has reported.

Previous comment not completely correct as the PHP error handling is overwritten by Opencart. error handling is instead set in the OC admin at system>settings>server>Display Errors: which can be set to 'no'.

Definitely better to fix the root cause though! Priority fix for next release.

kevinb456 commented 10 years ago

Comment on opencart.com ;

@inanecoding: this should fix it edit the file cataolog/model/tool/piwik.php on line 218 and change this

if ($this->request->get['route'] == "product/search") {

to this

if(isset($this->request->get['route']) && $this->request->get['route']=='product/search'){

That should do the trick

kevinb456 commented 10 years ago

Related to issue #15

kevinb456 commented 10 years ago

Another user reported a "Error code: ERR_CONTENT_DECODING_FAILED" error which stops the homepage from loading (other pages okay). After looking at users logs, they have the same PHP notice on line 218 and a google search suggests an opencart bug causes this to appear as a decoding error - so this is probably the same issue.

kevinb456 commented 10 years ago

I will do a new minor release in the next few days including this latest commit which should fix the errors seen.

kevinb456 commented 10 years ago

Fixed in v1.1 release 31348b2c7694cd2e659307a6fcbc354ec20df23c