Example #1
0
 public function onGetfilters()
 {
     $data = post('filters');
     // $result = Product::leftJoin('fotis_reviews_prod_rates', 'tiipiik_catalog_products.id', '=', 'fotis_reviews_prod_rates.product_id');
     if (isset($data)) {
         //     foreach ($data as $object) {
         //         switch ($object['Name']) {
         //             case "FilterPrice":
         //                 $result = $result->where('price', '<=', $object['Value']);
         //                 break;
         //             case "FilterSI":
         //                 if ($object['Value'] == 0) {
         //                     $result = $result->where('index_rating', '=', null);
         //                 }else{
         //                     $result = $result->where('index_rating', '>=', $object['Value']);
         //                 }
         //                 break;
         //             default:
         //         }
         //     }
         //     $this->products = $result->get();
         $this->stores = Store::orderBy('products_number', 'desc')->take(2)->get();
     } else {
         $this->stores = Store::orderBy('products_number', 'asc')->take(2)->get();
         //     $this->products = Product::leftJoin('fotis_reviews_prod_rates', 'tiipiik_catalog_products.id', '=', 'fotis_reviews_prod_rates.product_id')->orderBy('price', 'desc')->get();
     }
 }
Example #2
0
 public function onGetStorefilters()
 {
     $result = Store::with('customfields')->whereIsActivated(1);
     $mapstores = Store::with('customfields')->whereIsActivated(1);
     $mapstores = $this->StoreFilters($mapstores);
     $this->mapstores = $mapstores->get();
     $result = $this->StoreFilters($result);
     $result = $this->Pagination($result, post('page') - 1);
     $this->stores = $result->orderBy('products_number', 'desc')->get();
 }