Product list ordering and pagination problem when use custom field search

Started by tnyari, January 25, 2012, 19:23:28 PM

Previous topic - Next topic

tnyari

The problem is with the url params, if you search some custom field value, and after you want order the search list, the customfields params not apply on the search list.
The pagination, orderby and manufacturer select cause the problem, because the url containing an array, when you search some custom field value.
The correct url for searching custom fields look like this:
....customfields[11]=something....
the wrong is:
...customfields=array....

I have an idea to solve this problem and its works fine for me, but need to modify some core files:
/administrator/components/com_virtuemart/helpers/vmmodel.php on row 685:


foreach ($getArray as $key => $value ) $link .= '&'.$key.'='.$value;

change this to:

                        foreach ($getArray as $key => $value ){
if (is_array($value)){
foreach ($value as $k => $v ){
$link .= '&'.$key.'['.$k.']'.'='.$v;
}
} else {
$link .= '&'.$key.'='.$value;
}
}


and
/administrator/components/com_virtuemart/models/product.php on row 1382

foreach ($getArray as $key => $value )
$fieldLink .= '&'.$key.'='.$value;


change to:


foreach ($getArray as $key => $value ){
if (is_array($value)){
foreach ($value as $k => $v ){
$fieldLink .= '&'.$key.'['.$k.']'.'='.$v;
}
} else {
$fieldLink .= '&'.$key.'='.$value;
}
}



This will process array values in url.
I just tested on Joomla 1.7.3 and VM 2, and its works fine..

Sorry for my bad english - if something not clear please ask me...