You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Probably wrong query for Child Products

Started by vinceferro, February 10, 2012, 14:49:40 PM

Previous topic - Next topic


Hi there!
Looking in VirtueMart source code i've founded this function in: "administrator/components/com_virtuemart/models/product.php"

    * Check if the product has any children
    * @author RolandD
    * @author MaxMilbers
    * @param int $virtuemart_product_id Product ID
    * @return bool True if there are child products, false if there are no child products
   public function checkChildProducts($virtuemart_product_id) {

      $q  = 'SELECT IF(COUNT(virtuemart_product_id) > 0, "0", "1") FROM `#__virtuemart_products` WHERE `product_parent_id` = "'.(int)$virtuemart_product_id.'"';

      return $this->_db->loadResult();

I think the return value is incorrect, in fact it is 0 if the children count is higher than 0.
Is it an expected behavior?


Should I fix your bug, please support the VirtueMart project and become a member
Extensions approved by the core team: