Example #1
0
 public function product_list($category_id = NULL, $page = 1)
 {
     //set the title of the page
     $this->template->title(lang('web_list_product'));
     //set the pagination configuration array and initialize the pagination
     $config = $this->set_paginate_options('product_list', $category_id);
     //Initialize the pagination class
     $this->pagination->initialize($config);
     //control of number page
     $page = $this->uri->segment(5) ? $this->uri->segment(5) : 1;
     //find all the categories with paginate and save it in array to past to the view
     $this->template->set("products", Product::paginate($category_id, $config["per_page"], $page));
     $this->template->set('category_id', $category_id);
     $this->template->set('page', $page);
     $this->template->set('control', TRUE);
     if (!is_null(Category::find($category_id)->category)) {
         $this->template->set('parent_category', Category::find($category_id)->category->id);
     } else {
         $this->template->set('parent_category', "");
     }
     //create paginate´s links
     $this->template->set("links", $this->pagination->create_links());
     //load the view
     $this->template->build('products/list');
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     // get all the nerds
     $items = Product::paginate(10);
     // load the view and pass the nerds
     return View::make('product.index')->with('items', $items);
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Collection
  */
 public function all()
 {
     $collection = Product::paginate();
     if ($collection) {
         return $collection;
     }
     throw new Exception('Something went wrong!', 500);
 }
 public function getAll()
 {
     $sortColumn = Input::get('sortColumn');
     $sortDirection = Input::get('sortDirection');
     $pageIndex = Input::get('pageIndex');
     $pageSize = Input::get('pageSize');
     $includes = Input::get('includes');
     $criteria = Input::get('criteria');
     $result = array("sortColumn" => Input::get('sortColumn'), "sortDirection" => $sortDirection, "pageIndex" => $pageIndex, "pageSize" => $pageSize, "includes" => $includes, "criteria" => $criteria);
     if ($pageIndex == NULL) {
         $pageIndex = 1;
     }
     if ($pageSize == NULL) {
         $pageSize = 10;
     }
     Paginator::setCurrentPage($pageIndex);
     return Response::json(Product::paginate($pageSize));
 }
Example #5
0
<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
Route::get('/', function () {
    $categories = Category::all();
    $products = Product::paginate(9);
    return View::make('hello')->withCategories($categories)->withProducts($products);
});
##Paypal ROutes
Route::post('/pay', ['as' => 'pay', 'uses' => 'PaypalController@pay']);
Route::get('/payment_status', ['as' => 'paymentStatus', 'uses' => 'PaypalController@paymentStatus']);
Route::get('/login', function () {
    if (Auth::check()) {
        return Redirect::to('/');
    }
    return View::make('login');
});
Route::post('/addToCart/{id}/{qtt}', 'HomeController@addToCart');
Route::get('/myCart', 'HomeController@showCart');
Route::get('/search', array('uses' => 'HomeController@search', 'as' => 'search'));
Route::post('/authenticate', array('uses' => 'HomeController@authenticate', 'as' => 'authenticate'));
Route::get('/category/{id}', array('uses' => 'HomeController@getCategory', 'as' => 'getCategory'));
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $products = Product::paginate($this->perPage);
     return View::make('products.list', ['products' => $products]);
 }
Example #7
0
 public function get_product_edit($id = '', $alias = '')
 {
     $mode = Input::all();
     if ($mode != null) {
         switch ($mode['mode']) {
             case "imagedel":
                 return 'OK';
                 break;
         }
     }
     if ($id == null) {
         $res = Product::paginate(50);
         return View::make('administrator.product')->with('result', $res);
     }
     /*PROD*/
     $productInformation = Product::where('id', '=', $id)->first();
     /*EO PROD*/
     /*BRANDS */
     $brands = Brand::all();
     /* EO BRANDS*/
     /*TAXES*/
     $taxes = Tax::all();
     /*EO TAXES*/
     /*ALL CATEGORIES*/
     $categories = Category::where('top', '=', '1')->get();
     /*EO ALL CATEGORIES*/
     /*ALL TAGS*/
     $tags = DB::table("product_descriptions")->get('tag');
     $_tmpholder = array();
     $_strholder = '';
     foreach ($tags as $tag) {
         $_instance = explode(',', $tag->tag);
         foreach ($_instance as $item) {
             array_push($_tmpholder, $item);
         }
     }
     $_tmpholder = array_unique($_tmpholder);
     $numItems = count($_tmpholder);
     $i = 0;
     foreach ($_tmpholder as $item) {
         $_strholder .= '"' . $item . '"';
         if (++$i !== $numItems) {
             $_strholder .= ',';
         }
     }
     /*EO ALL TAGS*/
     /*ATTRS*/
     $result = Category::with(array("getAttributeListing", "getAttributeListing.getTopGroup"))->where('id', '=', $productInformation->getCategory[0]->id)->first();
     $topGroups = array();
     foreach ($result->getAttributeListing as $item) {
         array_push($topGroups, $item->getTopGroup->id);
     }
     $topGroups = array_unique($topGroups);
     $belongedGroups = array();
     foreach ($result->getAttributeListing as $item) {
         array_push($belongedGroups, $item->id);
     }
     $belongedGroups = array_unique($belongedGroups);
     /*Now we held only top groups($tmp) and Attributes groups($belongedGroups) only related to a category*/
     $attrs = AttributeGroup::with(array('getParentGroup' => function ($query) use($belongedGroups) {
         $query->order_by('sort_order', 'ASC');
         $query->where_in('id', $belongedGroups);
     }, 'getParentGroup.getAttributes'))->where_in('id', $topGroups)->get();
     /*EO ATTRS*/
     return View::make('administrator.product_edit')->with('categories', $categories)->with('product', $productInformation)->with('brands', $brands)->with('tags', $_strholder)->with('taxes', $taxes)->with('attributes', $attrs);
 }
 public function getAllProducts()
 {
     $products = Product::paginate(20);
     return View::make('admin.phones')->with('products', $products);
 }
Example #9
0
 public function index()
 {
     $products = Product::paginate(2);
     return View::make('product.all-products')->with('products', $products);
 }
 public function getAjax()
 {
     $products = Product::paginate(10);
     return View::make('index')->with('products', $products)->render();
 }