News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

JRequest::getInt can't have value false

Started by GuidoS, January 03, 2014, 21:46:07 PM

Previous topic - Next topic

GuidoS

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

Milbo

no, that not correct. If not virtuemart_category_id is set, then you get back the set default, which is false
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

GuidoS

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.

Milbo

Does the attached file work for you? (add it tothe category view)

[attachment cleanup by admin]
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

GuidoS

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.

GuidoS

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.

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/