2017-08-04 10:54:05 +02:00

40 lines
1.1 KiB
PHP

<?php
class CategoryController extends CategoryControllerCore
{
public function initContent()
{
parent::initContent();
}
protected function assignSubcategories()
{
$subcategories = $this->category->getSubCategories($this->context->language->id);
foreach($subcategories as $key => $subcategory) {
$context = Context::getContext();
$catsample = new Category($subcategory['id_category'], false, $context->language->id);
$subcategories[$key]['productsList'] = $catsample->getProducts($this->context->language->id, 1, 4, $this->orderBy, $this->orderWay);
}
if(!empty($subcategories))
{
$this->context->smarty->assign('subcategories', $subcategories);
$this->setTemplate(_PS_THEME_DIR_.'category-list.tpl');
}
else
{
$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();
}
}