Hi everyone! In my opinion there is a small bug in administrator/components/com_virtuemart/models/product.php in VM 3.0.9.
I use this part of code
if (!empty($this->searchcustoms)) {
$joinCustom = TRUE;
foreach ($this->searchcustoms as $key => $searchcustom) {
$custom_search[] = '(pf.`virtuemart_custom_id`="' . (int)$key . '" and pf.`customfield_value` like "%' . $db->escape ($searchcustom, TRUE) . '%")';
}
$where[] = " ( " . implode (' OR ', $custom_search) . " ) ";
}
(304-310)
for filtering products in category view. For filtering products my plugin adding to current url params like .....&customfield[virtuemart_customfield_id]=customfield_value.
The variable $this->searchcustoms of VirtueMartModelProduct class receiving value of url option 'customfield[virtuemart_customfield_id]' using static method vRequest::getInt ('customfields') (186. $this->searchcustoms = vRequest::getInt ('customfields');). And the problem is in this static method, it receiving only integer value, if 'customfield[virtuemart_customfield_id]' has a string value, filter does not working. When I changed static method to vRequest::getVar ('customfields'), filter is work.
So, the question is: $this->searchcustoms = vRequest::getInt ('customfields') has error, and instead static method vRequest::getInt ('customfields') should be static method vRequest::getVar ('customfields'). Or it's my mistake, and i understand somethig wrong?
$cid = vRequest::getInt( 'cid', false );
if you use &cid=1, you get 1. If you use &cid[]=1 you get an array $cid[0]=>1