Perhaps unnecessary loop foreach () to count the number of products

Started by konstantin-shkodskih, January 29, 2013, 06:43:46 AM

Previous topic - Next topic

konstantin-shkodskih

I noticed in your category template file \components\com_virtuemart\views\category\tmpl\default.php following:
$BrowseTotalProducts = 0;
foreach ($this->products as $product) {
$BrowseTotalProducts++;
}


Can I use: $ this-> category-> productcount,
then there is a need for this code? (ibid. appropriate comment from Max Milbers)
(VirtueMart v.2.0.18a)

PRO


Milbo

$BrowseTotalProducts = count($this->products);

should work, but not productcount,imho. totalproducts is the amount of products which you see, productcount is the value of all products in the category.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/