示例#1
0
 public function products()
 {
     $products_m = new Products();
     $product = $products_m->getProducts();
     $product_data = array();
     $d_product = $products_m->getDayProduct();
     $d_product_data = array();
     $d_product_data['id'] = $d_product->getId();
     $d_product_data['name'] = $d_product->getName();
     $d_product_data['img'] = $d_product->getImage();
     $d_product_data['price'] = $d_product->getPrice();
     $s_products = $products_m->getSliderProducts();
     $s_products_data = array();
     if (!empty($s_products)) {
         foreach ($s_products as $key => $p) {
             $s_product_data[$key]['id'] = $p->getId();
             $s_product_data[$key]['name'] = $p->getName();
             $s_product_data[$key]['img'] = $p->getImage();
             $s_product_data[$key]['price'] = $p->getPrice();
         }
     }
     if (!empty($product)) {
         foreach ($product as $key => $p) {
             $product_data[$key]['id'] = $p->getId();
             $product_data[$key]['name'] = $p->getName();
             $product_data[$key]['img'] = $p->getImage();
             $product_data[$key]['quantity'] = $p->getQuantity();
             $product_data[$key]['price'] = $p->getPrice();
         }
     }
     $cats_array = array();
     $sub_cats_array = array();
     $categories_m = new Categories();
     $cats = $categories_m->getCategories();
     $sub_categories = new SubCategories();
     $sub_cats = $sub_categories->getSubCategories();
     $cats_array = array();
     if (!empty($cats)) {
         foreach ($cats as $key => $c) {
             $cats_array[$key]['name'] = $c->getCategoryName();
             $cats_array[$key]['id'] = $c->getCategoryId();
         }
     }
     $sub_cats_array = array();
     if (!empty($sub_cats)) {
         foreach ($sub_cats as $key => $c) {
             $sub_cats_array[$key]['name'] = $c->getSubCategoryName();
             $sub_cats_array[$key]['id'] = $c->getSubCategoryId();
         }
     }
     echo $this->render('adminproducts', array('products' => $product_data, 'day_product' => $d_product_data, 'slider_products' => $s_product_data, 'cats' => $cats_array, 'sub_cats' => $sub_cats_array));
 }
示例#2
0
 protected function productlist($arg = null)
 {
     $tab = $this->checkArg($arg);
     $http = new Http();
     if ($http->isActive('sub_cat')) {
         $arg[2] = $http->get('sub_cat');
         $arg[3] = $http->get('sort');
         Location::To(URL . 'product/productlist/' . $arg[0] . '/' . $arg[1] . '/' . $arg[2] . '/' . $arg[3] . '/0');
     }
     $pagination = $this->sort($arg);
     $pag = $pagination['pagination'];
     $sub_categories_m = new SubCategories();
     $sub_cats = $sub_categories_m->getSubCategories();
     $sub_cats_array = array();
     if (!empty($sub_cats)) {
         foreach ($sub_cats as $key => $c) {
             $sub_cats_array[$key]['name'] = $c->getSubCategoryName();
             $sub_cats_array[$key]['id'] = $c->getSubCategoryId();
         }
     }
     $products = $pagination['products'];
     $next = $pag->next();
     $prev = $pag->prev();
     $this->render('products', array('categories' => $this->categories, 'products' => $products, 'ids' => $this->category_ids, 'slider' => $this->slider, 'd_product' => $this->d_product, 'next' => $next, 'prev' => $prev, 'action' => $this->action, 'promo' => true, 'sub_categories' => $sub_cats_array, 'category' => $arg[1], 'sub_category' => $arg[2], 'order' => $arg[3], 'page' => $arg[4], 'tab' => $tab));
 }