i have a module that shows categories of virtuemart products in front page. I dont want the products that are not in stock available to be shown.
there is a function in the module code to select the products:
public static function _CountProduct($catids, $params)
{
if ($catids == '*') {
$_catids = $params->get('catid');
$catids = self::_getChildCategories($_catids, $params);
$catids = self::_getPublishCategories($catids);
}
if (empty($catids)) return;
$limitation = 999;
$source_group = null;
$ordering_direction = $params->get('product_ordering_direction');
$source_order = $params->get('source_order', 'group.featured');
$p_special = $params->get('show_front');
$categoryModel = VmModel::getModel('Category');
$categoryModel->_noLimit = true;
$list = array();
if (!empty($catids)) {
$productModel = VmModel::getModel('Product');
$productModel = new VirtuemartModelProductExtend();
$productModel->filter_order = $source_order;
$productModel->specail_product = $p_special;
$productModel->ordering_direction = $ordering_direction;
$desc_maxlength = $params->get('item_des_maxlength');
$items = $productModel->getProductListing($source_group, $limitation, true, true, false, true, $catids);
$productModel->addImages($items);
$ratingModel = VmModel::getModel('ratings');
foreach ($items as $item) {
$item->title = $item->product_name;
$item->id = $item->virtuemart_product_id;
$item->description = $item->product_desc;
self::getVmImages($item, $params);
$item->short_desc = self::_cleanText($item->product_s_desc);
$item->_description = self::_cleanText($item->description);
$item->_description = ($item->_description != '') ? self::truncate($item->_description, $desc_maxlength) : self::truncate($item->short_desc, $desc_maxlength);
$item->vote = $ratingModel->getVoteByProduct($item->virtuemart_product_id);
$item->rating = $ratingModel->getRatingByProduct($item->virtuemart_product_id);
$list[] = $item;
}
}
return count($list);
}
how should i change this function to do so? I'm using the last version of joomla and virtuemart.
any help would be appreciated. thanks