пытаюсь сделать модуль спискка производителей, чтобы под каждым производителем были категории гле есть его товары
$manufactureres = $this->model_catalog_manufacturer->getManufacturers(0);
foreach($manufactureres as $manufacturer)
{
$children = $this->model_catalog_category->getCategories(0);
foreach ($children as $child) {
$data = array(
'filter_category_id' => $child['category_id'],
'filter_manufacturer_id' => $manufacturer['manufacturer_id'],
);
$product_total = $this->model_catalog_product->getTotalProducts($data);
if ($product_total>0) {
$children_data[] = array(
'category_id' => $child['category_id'],
'name' => $child['name'] . ' (' . $product_total . ')',
'href' => $this->url->link('product/category', 'path='. $child['category_id'])
);
}
}
$data = array(
'filter_manufacturer_id' => $manufacturer['manufacturer_id']
);
$this->data['manufactureres'][] = array(
'manufacturer_id' => $manufacturer['manufacturer_id'],
'name' => $manufacturer['name'] ,
'children' => $children_data,
'href' => $this->url->link('product/manufacturer/product', 'manufacturer_id=' . $manufacturer['manufacturer_id'])
//route=product/manufacturer/product&manufacturer_id=6
);
}
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/manufacturer.tpl')) {
$this->template = $this->config->get('config_template') . '/template/module/manufacturer.tpl';
} else {
$this->template = 'default/template/module/manufacturer.tpl';
}
неправильно выводятся категории. например у производителя получается такой массив
[manufacturer_id] => 9
[name] => Canon
[children] => Array
(
[0] => Array
(
[category_id] => 20
[name] => Компьютеры (5)
[href] => http://localhost/pulse/index.php?route=product/category&path=20
)
[1] => Array
(
[category_id] => 18
[name] => Ноутбуки (3)
[href] => http://localhost/pulse/index.php?route=product/category&path=18
)
[2] => Array
(
[category_id] => 24
[name] => Телефоны и PDA (1)
[href] => http://localhost/pulse/index.php?route=product/category&path=24
)
[3] => Array
(
[category_id] => 34
[name] => MP3 Плееры (3)
[href] => http://localhost/pulse/index.php?route=product/category&path=34
)
[4] => Array
(
[category_id] => 20
[name] => Компьютеры (1)
[href] => http://localhost/pulse/index.php?route=product/category&path=20
)
[5] => Array
(
[category_id] => 33
[name] => Камеры (1)
[href] => http://localhost/pulse/index.php?route=product/category&path=33
)
)
[href] => http://localhost/pulse/index.php?route=product/manufacturer/product&manufacturer_id=9
)