News:

Support the VirtueMart project and become a member

Main Menu

ONLY parent products in latest products Front page

Started by natax, October 29, 2012, 14:48:05 PM

Previous topic - Next topic

natax

Hi !
I am using Joomla 2.5.7 , VM 2.0.10 (use of custom plugin, VM-custom stockable variants) and I would like to have in the front page only the parent products at the latest and at the top 10 products.
Now I am getting a list with all the products, including children (the same product with many colors and sizes !)
Please advise me how can I manage that ?

Thanks in advance

anisimow

#1
it's possible.
add $where[] = 'p.`product_parent_id` = "0"';
to \administrator\components\com_virtuemart\models\product.php
line 416 instead $where[] = 'p.`' . $latest_products_orderBy . '` > "' . $dateSql . '" ';
it will loks like
case 'latest':
$date = JFactory::getDate (time () - (60 * 60 * 24 * $latest_products_days));
$dateSql = $date->toMySQL ();
//$where[] = 'p.`' . $latest_products_orderBy . '` > "' . $dateSql . '" ';
                                                $where[] = 'p.`product_parent_id` = "0"';
$orderBy = 'ORDER BY p.`' . $latest_products_orderBy . '`';
$this->filter_order_Dir = 'DESC';
break;
case 'random':
$orderBy = ' ORDER BY RAND() '; //LIMIT 0, '.(int)$nbrReturnProducts ; //TODO set limit LIMIT 0, '.(int)$nbrReturnProducts;
                                                $where[] = 'p.`product_parent_id` = "0"';
                                            break;

I also added for random case