public function filterIndex($category_id = false, $brand_id = false, $provider_id = false) { if ($category_id or $provider_id or $brand_id) { if ($category_id === '0') { $ids = false; } else { $categoryModel = new Category(); $ids = $categoryModel->getChild($category_id); } if ($provider_id === '0') { $provider_id = false; } if ($brand_id === '0') { $brand_id = false; } $arParams = array('categories' => $ids, 'brand' => $brand_id, 'provider' => $provider_id); return $this->buildIndex('filter', $arParams); } }
public function getExistInCategoryProvedrsList($category_id) { $categoryModel = new Category(); $category_ids = $categoryModel->getChild($category_id); return $this->select('providers.id', 'providers.name')->leftJoin('purchase as pur', 'providers.id', '=', 'pur.vendor_id')->leftJoin('products as prod', 'pur.product_id', '=', 'prod.id')->leftJoin('product_categories as cat', 'prod.category_id', '=', 'cat.id')->whereIn('cat.id', $category_ids)->distinct()->get(); }
public function categoryIndex(Category $categoryModel, $id) { $ids = $categoryModel->getChild($id); $chain = $categoryModel->getParents($id); return $this->buildIndex('category', $ids, $chain); }
public function flag($category_id, Category $categoryModel, Product $productModel) { $childs = $categoryModel->getChild($category_id); $products = $productModel->getIdByCategoryId($childs); $productModel->setFlagsByProductsId($products); Session::flash('message', GetMessages("SUCCESS_ADD_FLAG")); return redirect($_SERVER['HTTP_REFERER']); }