public function get_categorii_options($categorii, $parent_name = null, $curent = null) { $ci = get_instance(); $ci->load->model('mysql'); $result = ""; foreach ($categorii as $key => $item) { $active = $item['id'] == $curent ? 'selected' : ''; $name = ($parent_name != "" ? $parent_name . " > " : "") . $item['name_ro']; $childs = $ci->mysql->get_All('catalog', array('parent' => $item['id'])); if (!empty($childs)) { $result .= get_categorii_options($childs, $name, $curent); } else { if ($item['parent'] != 0) { $result .= "<option value='{$item['id']}' {$active}>{$name}</option>"; } } } return $result; }
?> </option> <?php } ?> </select> </label> <label class="small-4 madeium-4 large-4 columns"> <select name="categorii"> <option value="">Toate categoriile</option> <?php $this->benchmark->mark('benc'); ?> <?php echo get_categorii_options($categorii, null, !empty($curent_cat) ? $curent_cat['id'] : null); ?> <?php $this->benchmark->mark('bencw'); ?> </select> </label> <label class="small-12 madeium-12 large-12 columns"> <input type="search" name="word" value="<?php echo isset($_GET['word']) ? $_GET['word'] : ""; ?> " placeholder="Caută după cuvîntul cheie" /> </label> <input type="submit" value="Caută" /> </form> </div>
</li> <?php } ?> </ul> </div> <table class="form"> <tr> <td>Categorie</td> <td> <select name="page[1][parent]"> <option value="0">-- selecteaza --</option> <?php echo get_categorii_options($categorii, null, isset($page) ? $page['parent'] : null); ?> </select> </td> </tr> <tr> <td>Producator</td> <td> <select name="page[1][brand_id]"> <option value="0">-- selecteaza --</option> <?php foreach ($producatori as $key => $produca) { ?> <option value="<?php echo $produca['id']; ?>