2017-08-03 13:10:18 +02:00

43 lines
1.4 KiB
PHP

<?php
class CategoryController extends CategoryControllerCore
{
public function initContent()
{
parent::initContent();
}
protected function assignSubcategories()
{
// La catégorie parcourue est-elle un enfant direct de Accueil ?
$this->firstLevelCategories = Category::getChildrenIds(Category::CATEGORY_HOME, $this->context->language->id, true);
$subcategories = $this->category->recurseLiteCategTree(3, 0, $this->context->language->id);
foreach($subcategories['children'] as &$subcategory) {
$context = Context::getContext();
$catsample = new Category($subcategory['id'], false, $context->language->id);
$subcategory['productsList'] = $catsample->getProducts($this->context->language->id, (int)$this->p, (int)$this->n, $this->orderBy, $this->orderWay);
}
if(!empty($subcategories['children']))
{
$this->context->smarty->assign('subcategories', $subcategories);
$this->setTemplate(_PS_THEME_DIR_.'category-list.tpl');
}
else
{
$this->context->smarty->assign('subcategories', $subcategories);
$this->setTemplate(_PS_THEME_DIR_.'category.tpl');
}
}
public static function getSiblingscategories($id) {
$context = Context::getContext();
$cat = new Category($id, false, $context->language->id);
return $cat->getChildrenCategories();
}
}