Hello,
This tip is inspired from this post:
http://forum.virtuemart.net/index.php?topic=21242.0I decided to repost it because with a little mod (suggested in the topic as well), it works on VM 1.1.2,
i tried it as well, and it works in vm 1.1.5
if you want randomprod to fetch its items from many categories at once
or,
(in my case)if a parent category does not have products directly,
but its children categories have products,
and we want to show these in the random prod, (i filled them manually one by one using this hack,by the way. but it would be still better than nothing!)
then:
go to this file:
/modules/mod_virtuemart_randomprod/mod_virtuemart_randomprod.php
line 33,
and remove the "(int)" (without blockquotes)from the following:
$category_id = (int)$params->get( 'category_id', 0 );
it should be on line 33.
then
find the line:
$q .= "AND #__{vm}_category.category_id='$category_id'";
and replace with
$category_id_mod = "'".str_replace(",","','", $category_id)."'";
$q .= "AND #__{vm}_category.category_id IN ($category_id_mod)";
In the Random Product Module, be sure to separate your category IDs with commas for example:
Code:
1,2
so here's what this hack does:
instead of considering the "category id" as 1 number,
it retrieves it as a text,
and picks the categories from the text (provided you have already separated them with commas)
and makes the module choose the randproduct -->IN<-- those numbers
many thanks to canreo and zdjl505 for the hack
Regards