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

Datatypes of router's queries

Started by balai, October 06, 2016, 14:04:47 PM

Previous topic - Next topic

balai

It could happen that another extension is using the same variable names in it's server requests.
Also it is possible that these variables have different format.

In that case, if there is a virtuemart module published in the output page, the VM router produces some notices like (Type x to string conversion).

Checking the router i found out that the query variables are submitted as they are in other functions with out any type validation or conversion.
Some examples:
$categoryRoute = $helper->getCategoryRoute($query['virtuemart_category_id']);
could become:
$virtuemart_category_id=$query['virtuemart_category_id'];
if(is_array($virtuemart_category_id)) {
        $virtuemart_category_id=reset($query['virtuemart_category_id']);
}
$virtuemart_category_id=(int)$virtuemart_category_id;
$categoryRoute = $helper->getCategoryRoute($virtuemart_category_id);


Something similar happens with the manufacturers.

It's up to you how you will implement this but i suggest either not going further or changing the data format in these cases

Milbo

But to use the first option would be also just a guess, or?
I think it is better to disable SEF for this link in this cases, on the other hand, without SEF it may not work as expected also, because the SEF does more than just making the link nice. Hmmm, but interesting problem, indeed.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

balai

QuoteBut to use the first option would be also just a guess, or?
Partially yes. But through the url you can pass either a scalar variable or an array. Hence this covers all the cases i suppose.