VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: GuidoS on January 03, 2014, 21:46:07 PM

Title: JRequest::getInt can't have value false
Post by: GuidoS on January 03, 2014, 21:46:07 PM
com_virtuemart\views\category\view.html.php

The variabele on row 75 will never be a boolean with the code below, the value will be 0.

$categoryId = JRequest::getInt('virtuemart_category_id', false);


So the code from row 78 will always go wrong when the variabele isn't set. So the result of setting the canonical url will go wrong in certain circumstances, like viewing all products of a manufacturer.

A solution could be to change the getInt to getVar.

Joomla 2.5.17
Virtuemart 2.0.26a
Title: Re: JRequest::getInt can't have value false
Post by: Milbo on January 03, 2014, 22:43:52 PM
no, that not correct. If not virtuemart_category_id is set, then you get back the set default, which is false
Title: Re: JRequest::getInt can't have value false
Post by: GuidoS on January 03, 2014, 23:41:50 PM
Oke, but when I echo gettype($categoryId) I get back an Integer and not a boolean. So when you are going to compare it with === false you will get a wrong comparison. I have also looked at the site http://demo.virtuemart.com/index.php/component/virtuemart/manufacturer/apple and there you also have a wrong canonical url. It points to the frontpage of virtuemart.
Title: Re: JRequest::getInt can't have value false
Post by: Milbo on January 04, 2014, 12:10:43 PM
Does the attached file work for you? (add it tothe category view)

[attachment cleanup by admin]
Title: Re: JRequest::getInt can't have value false
Post by: GuidoS on January 05, 2014, 20:50:48 PM
Quote from: Milbo on January 04, 2014, 12:10:43 PM
Does the attached file work for you? (add it tothe category view)

Looks like the canonical url is right now but it doesn't show any products.
Title: Re: JRequest::getInt can't have value false
Post by: GuidoS on January 07, 2014, 13:47:38 PM
Is it useful to change my files with the changes you made or are you going to change everything in a new version. I can't use you're attached file because it doesn't show the products anymore when I choose a manufacturer.
Title: Re: JRequest::getInt can't have value false
Post by: Milbo on January 07, 2014, 20:58:22 PM
Please use the vm2.0.26b http://dev.virtuemart.net/attachments/download/671/com_virtuemart.2.0.26b_extract_first.zip