tantosoft.com

Display all products of virtuemart subcategories

After the setKeyWord function in \administrator\components\com_virtuemart\models\product.php place:

Code:
function untreeCat($vm_catid, &$ccont){
$db = JFactory::getDBO();
$query = 'SELECT `category_child_id` FROM `#__virtuemart_category_categories`
WHERE `category_parent_id`="'.$vm_catid.'"';
$db->setQuery($query);
$db->query();

$rows = $db->loadRowList();
if (empty($rows)){
return;
} else {
foreach($rows as $row) {
array_push($ccont, $row[0]);
$kat = $row[0];
$this->untreeCat($kat, $ccont);
}
}
}


Then search for this:

Code:
if ($virtuemart_category_id > 0) {
$joinCategory = TRUE;
$where[] = ' `pc`.`virtuemart_category_id` = ' . $virtuemart_category_id;
}


... and replace it with following:

Code:
if ($virtuemart_category_id > 0){
$joinCategory = TRUE ;
$catscont = array();
$this->untreeCat($virtuemart_category_id, $catscont);
$qkat = ' `pc`.`virtuemart_category_id` IN('.$virtuemart_category_id;
foreach ($catscont as &$kat){
$qkat .= ', '.$kat;
}
$qkat .= ')';
$where[] = $qkat;
}


Best regards,

Article from http://forum.virtuemart.net/index.php?topic=97874.15

Quiere contactar con nosotros?

Envíenos un Esta dirección de correo electrónico está siendo protegida contra los robots de spam. Necesita tener JavaScript habilitado para poder verlo. o llámenos a (+34) 698 259 856