33 lines
990 B
PHP
33 lines
990 B
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 id="select_'.$select_upd.'" style="margin-bottom:10px">
|
||
|
<select id="family_'.$select_upd.'" style="width:150px" name="family['.$select_upd.']" 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 = '';
|
||
|
}
|
||
|
|
||
|
$data['data'] = $select;
|
||
|
$data['id_before'] = (int)$id_select;
|
||
|
$data['id_select'] = (int)$select_upd;
|
||
|
die(json_encode($data));
|