/** * @Vuln\Description("View used: home/home") */ public function action_index() { $mostPopularProductsCount = 3; $bestSellingProductsCount = 3; $specialOffersCount = 3; $otherCustomerProductCount = 4; // Amount of products in the bottom of the page $randomProductsCount = 4; // Count of reviews after each product section. $productSectionReviewCount = 3; $product = new Product($this->pixie); $special_offers = new SpecialOffers($this->pixie); $review = new Review($this->pixie); //$this->view->topViewedProducts = $product->getRandomProducts($this->topViewedCount); $visitedProductIds = $this->request->cookieWrap('visited_products'); $this->view->rnd_products = $product->getRndProduct(self::COUNT_RND_PRODUCTS); $this->view->relatedToVisitedProducts = $product->getVisitedProducts($visitedProductIds); //$product->getRandomProducts($this->relatedToVisitedCount); $this->view->bestChoiceProducts = $product->getRandomProducts($this->bestChoiceCount); $this->view->mostPopularProducts = $product->getRandomProducts($mostPopularProductsCount); $this->view->bestSellingProducts = $product->getRandomProducts($bestSellingProductsCount); $this->view->randomProducts = $product->getRandomProducts($randomProductsCount); $this->view->special_offers = $special_offers->getRandomOffers($specialOffersCount); $this->view->selectedReviews = $review->getRandomReviews($this->reviewsCount); $this->view->otherCustomersProducts = $product->getRandomProducts($otherCustomerProductCount); $this->view->productSections = array('related_to_viewed' => array('title' => 'Related to Visited', 'products' => $this->view->relatedToVisitedProducts, 'reviews' => count($this->view->relatedToVisitedProducts) ? $review->getRandomReviews($productSectionReviewCount) : array()), 'best_choice' => array('title' => 'Best Choice', 'products' => $this->view->bestChoiceProducts, 'reviews' => count($this->view->bestChoiceProducts) ? $review->getRandomReviews($productSectionReviewCount) : array()), 'random' => array('title' => "", 'products' => $this->view->randomProducts)); $this->view->topProductBlocks = array('most_popular' => array('title' => "Top {$bestSellingProductsCount} most popular", 'products' => $this->view->mostPopularProducts), 'best_selling' => array('title' => "Top {$bestSellingProductsCount} best selling", 'products' => $this->view->bestSellingProducts)); $this->view->common_path = $this->common_path; $this->view->subview = 'home/home'; $this->view->message = "Index page"; }
/** * @throws NotFoundException * @Vuln\Description("View: product/product.") */ public function action_view() { $productID = $this->request->getWrap('id'); if (!$productID->getFilteredValue()) { throw new NotFoundException("Missing product id."); } /** @var \App\Model\Product $product */ $product = $this->model->where('productID', '=', $productID)->find(); if (!$product || !$product->loaded()) { throw new NotFoundException("Invalid product id"); //: " . $productID->escapeXSS()); } $this->view->product = $product; $this->view->options = $this->view->product->options->find_all()->as_array(); $this->view->pageTitle = $this->model->getPageTitle($productID); $this->view->breadcrumbs = $this->getBreadcrumbs($product); $offers = new SpecialOffers($this->pixie); $this->view->special_offers = $offers->getRandomOffers(4); $this->view->related = $this->model->getRandomProducts(4); $this->model->checkProductInCookie($productID); $this->view->subview = 'product/product'; }