Files
sterivein/documentation/api/files/Model/Folder.php.txt
Etienne Roudeix 86b11096ba Merge branch 'master' into loops
Conflicts:
	core/lib/Thelia/Core/Template/Loop/Category.php
	core/lib/Thelia/Core/Template/Loop/FeatureValue.php
	core/lib/Thelia/Core/Template/Loop/Folder.php
	core/lib/Thelia/Core/Template/Loop/Product.php
	core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php
	install/faker.php
2013-08-21 09:19:56 +02:00

42 lines
795 B
Plaintext
Executable File

<?php
namespace Thelia\Model;
use Thelia\Model\Base\Folder as BaseFolder;
class Folder extends BaseFolder
{
/**
* @return int number of contents for the folder
*/
public function countChild()
{
return FolderQuery::countChild($this->getId());
}
/**
*
* count all products for current category and sub categories
*
* @return int
*/
public function countAllContents()
{
$children = FolderQuery::findAllChild($this->getId());
array_push($children, $this);
$contentsCount = 0;
foreach($children as $child)
{
$contentsCount += ProductQuery::create()
->filterByCategory($child)
->count();
}
return $contentsCount;
}
}