27 lines
843 B
PHP
Raw Normal View History

<?php
include_once('../../config/config.inc.php');
$data = array();
$data['errors'] = false;
$id_parent = Tools::getValue('id_parent', 0);
$id_lang = 2;
if($id_parent) {
$children = Category::getChildren((int) $id_parent, $id_lang, true);
if ($children) {
$select='<div class="cat-children" style="margin-bottom:10px;margin-top:10px;">
<select class="form-control select-children" name="category_child">
<option value="0">-- Choisir -- </option>';
foreach ($children as $key => $child) {
$select.='<option value="'.$child['id_category'].'">'.$child['name'].'</option>';
}
$select.= '</select>
</div>';
} else {
$data['errors'] = true;
}
} else {
$data['errors'] = true;
}
$data['data'] = $select;
die(json_encode($data));