/** * @param EditProductBindingModel $model * @Route("getEdit") */ public function fillEditForm(EditProductBindingModel $model) { $categories = $this->_eshopData->getCategoriesRepository()->all(); $viewModel = new EditProductViewModel(); $viewModel->productOldInformation = $model; $viewModel->categories = $categories; $viewModel->render(); }
/** * @param $categoryId * @Route("products") */ public function getProducts($categoryId) { $userId = $this->getCurrentUserId(); $userCartId = $this->_eshopData->getCartsRepository()->getCartForCurrentUser($userId); $products = $this->_eshopData->getCategoriesRepository()->getAllProducts($userId, $userCartId, $categoryId); if ($products) { $viewModel = new CategoryProductsViewModel(); $viewModel->productViewModel = $products; $viewModel->currentCategoryId = $categoryId; $viewModel->render(); } }
public function removeCategoryDiscount($categoryId) { $isRemoved = $this->_eshopData->getCategoriesRepository()->removeDiscountOnCategory($categoryId); if ($isRemoved) { RouteService::redirect('admin/admin', 'adminPanel', true); } echo 'Error during remove from promotion.'; }