I'm using opencart 1.5.6 and what I'm trying to do is add a simple select with all the categories and children categories as option on product_form.tpl.
I tried add to the follow code at admin/controler/catalog/product.php:
$this->load->model('catalog/category');
$results = $this->model_catalog_category->getCategories(0);
foreach ($results as $result) {
$this->data['categories'][] = array(
'category_id' => $result['category_id'],
'name' => $result['name']
);
}
and for the view admin/view/catalog/product_form.tpl:
<tr>
<td>Categories</td>
<td><select>
<option value="">All Categories</option>
<?php foreach ($categories as $category) { ?>
<option value="<?php echo $category['name']; ?>"><?php echo $category['name']; ?></option>
<?php } ?>
</select>
</td>
</tr>
but it's not working. It returns nothing.
I wish someone could help me and tell me what I'm missing.