<?php
/* ======================================================
# Virtuemart Count Products for Joomla! - v4.1.0 (Free version)
# -------------------------------------------------------
# For Joomla! CMS
# Author: Web357 (Yiannis Christodoulou)
# Copyright (©) 2009-2019 Web357. All rights reserved.
# License: GNU/GPLv3, http://www.gnu.org/licenses/gpl-3.0.html
# Website: https:/www.web357.com/
# Demo: https://demo.web357.com/joomla/vmcountproducts
# Support: support@web357.com
# Last modified: 11 Jun 2019, 13:13:05
========================================================= */

// no direct access 
defined('_JEXEC') or die('Restricted access');

class mod_vmcountproductsHelper{
	function getActiveProducts(){
		$db = JFactory::getDBO();
		$query = "SELECT count(*) as num_rows FROM #__virtuemart_products WHERE published=1";
		$db->setQuery($query);
		$db->execute();
		$yt_active_products = $db->loadResult();
		return $yt_active_products;
	}

 	function getInactiveProducts(){
		$db = JFactory::getDBO();
		$query = "SELECT count(*) as num_rows FROM #__virtuemart_products WHERE published=0";
		$db->setQuery($query);
		$db->execute();
		$yt_inactive_products = $db->loadResult();
		return $yt_inactive_products;
	}
	
	function getSpecialProducts(){
		$db = JFactory::getDBO();
		$query = "SELECT count(*) as num_rows FROM #__virtuemart_products WHERE product_special=1";
		$db->setQuery($query);
		$db->execute();
		$yt_special_products = $db->loadResult();
		return $yt_special_products;
	}	
}