33 lines
1.0 KiB
PHP
33 lines
1.0 KiB
PHP
<?php
|
|
include_once('../../config/config.inc.php');
|
|
include_once(dirname(__FILE__).'/models/CategoryFamily.php');
|
|
|
|
$data = array();
|
|
$data['errors'] = FALSE;
|
|
|
|
$id_parent = Tools::getValue('id_parent', 1);
|
|
$id_select = Tools::getValue('id_select', 1);;
|
|
$id_lang = 2;
|
|
|
|
$select_upd = (int)$id_select + 1;
|
|
|
|
$childrens = CategoryFamilyCore::getAll($id_lang, $id_parent);
|
|
|
|
if ($childrens) {
|
|
$select='<div class="sub-cat" style="margin-bottom:10px;margin-top:10px;">
|
|
<select class="form-control select-families" name="subfamilies[]" data-id-family="'.$select_upd.'">
|
|
<option value="0">-- Choisir -- </option>';
|
|
foreach ($childrens as $key => $children) {
|
|
$select.='<option value="'.$children['id_category_family'].'">'.$children['name'].'</option>';
|
|
}
|
|
$select.= '</select>
|
|
</div>';
|
|
} else {
|
|
$select = '<input type="hidden" name="subfamilies[]" value="0" />';
|
|
}
|
|
|
|
$data['data'] = $select;
|
|
$data['id_before'] = (int)$id_select;
|
|
$data['id_select'] = (int)$select_upd;
|
|
die(json_encode($data));
|