示例#1
0
 public function lists($current_page = 1, $number = 'all', $sort = 0, $type = 1)
 {
     if (isset($this->session->userdata['user'])) {
         $numbers = array();
         $rows = get_product_rows();
         $total_products = $this->products_model->count();
         if ($total_products > 5 and $total_products < 10) {
             $numbers = array(5, 'all');
         }
         if ($total_products > 10 and $total_products < 20) {
             $numbers = array(5, 10, 'all');
         }
         if ($total_products > 20 and $total_products < 50) {
             $numbers = array(5, 10, 20, 'all');
         }
         if ($total_products > 50 and $total_products < 100) {
             $numbers = array(5, 10, 20, 50, 'all');
         }
         if ($total_products > 100) {
             $numbers = array(5, 10, 20, 50, 100, 'all');
         }
         $unbr = $number;
         if ($number == 'all') {
             $unbr = $total_products;
         }
         $dimensions_text = get_dimensions_text();
         $dimensions_val = get_dimensions_val();
         foreach ($dimensions_val as $key => $dimension) {
             $dimensions[$dimension] = $dimensions_text[$key];
         }
         $page = new class_pagination($total_products, $current_page, $unbr);
         $sort_order = 'ASC';
         if ($type == 0) {
             $sort_order = 'DESC';
         }
         $products = $this->products_model->get_all_page($page->limit, $page->min, $rows[$sort], $sort_order);
         if ($this->session->userdata['lang'] == 'fr') {
             $data['lang'] = 'fr';
         } else {
             $data['lang'] = 'en';
         }
         $data['store_type'] = 'Belron';
         $data['admin'] = 1;
         $data['user'] = 1;
         $data['usertype'] = $this->session->userdata['user_type'];
         $this->load->view('prod_header', $data);
         $this->load->view('products-index', array('products' => $products, 'page' => $page, 'current' => $current_page, 'total' => $page->total(), 'sort' => $sort, 'type' => $type, 'numbers' => $numbers, 'dimensions' => $dimensions, 'number' => $number, 'total_products' => $total_products, 'categories' => $this->get_categories()));
         $this->load->view('footer');
     } else {
         redirect('productsmanager/index');
     }
 }
示例#2
0
                    </select>
                </div>
                <div class="Produit_liste_item"><label><?php 
echo gettext("Description");
?>
 : </label><input type='text' id='description' name='description' value="<?php 
echo $product[0]->description;
?>
" /></div>
                <div class="Produit_liste_item"><label><?php 
echo gettext("Dimension");
?>
 : </label>
                    <select id='dimension' name='dimension'>
                        <?$dimensions = get_dimensions_text();?>
                        <?$dimensions_val = get_dimensions_val();?>
                        <?foreach($dimensions as $key => $dimension) :?>  
                            <?$selected = "";?>
                            <? if ($dimensions_val[$key] == $product[0]->dimension):?>
                                    <?$selected = "selected";?>
                            <?endif?>                          
                            <option value="<?php 
echo $dimensions_val[$key];
?>
" <?php 
echo $selected;
?>
><?php 
echo $dimension;
?>
</option>