Hi all,
can be override VM core module function by my own (for example by vmcustom or system plugin)? I dont want to modify core file after each update.
I need modify function "sortSearchListQuery" from file "/administrator/com_virtuemart/modules/product.php" (add some own product sorting items).
thx for advice
you can add your own myproducts.php in the models folder and extend so
class VirtueMartModelMyproduct extends VirtueMartModelProduct {
public function getProductListing ($group = FALSE, $nbrReturnProducts = FALSE, $withCalc = TRUE, $onlyPublished = TRUE, $single = FALSE, $filterCategory = TRUE, $category_id = 0, $filterManufacturer = TRUE, $manufacturer_id = 0) {
//blah blah
$ids = $this->sortSearchListQuery ($onlyPublished, $this->virtuemart_category_id, $group, $nbrReturnProducts);
return ids;
}
function sortSearchListQuery ($onlyPublished = TRUE, $virtuemart_category_id = FALSE, $group = FALSE, $nbrReturnProducts = FALSE, $instock = 0) {
/* my code*/
return $product_ids;
}
}
and call it by
$myproductModel = VmModel::getModel('Myproduct');
$products = $myproductModel->getProductListing(false,$pnumber, true, true, true, false, $catids, false, 0, $instock);
you get the idea
ou, nice. thx you very much
Or you can do your own function, eg if you need to get ordered product by user or cart products ...