Author Topic: Probably wrong query for Child Products  (Read 907 times)

vinceferro

  • Beginner
  • *
  • Posts: 1
Probably wrong query for Child Products
« on: February 10, 2012, 14:49:40 pm »
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.'"';
      $this->_db->setQuery($q);

      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?


Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9856
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Probably wrong query for Child Products
« Reply #1 on: February 11, 2012, 15:32:55 pm »
completly deleted as obsolete
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/