Ejemplo n.º 1
0
 /**
  * @param int    $productId
  * @param string $slug
  *
  * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
  *
  * @return \Illuminate\Contracts\View\View|\Illuminate\Http\Response
  */
 public function viewAction(int $productId, string $slug)
 {
     $product = $this->productRepository->loadAlone($productId);
     if (!$product->id) {
         throw new NotFoundHttpException();
     }
     if ($product->slug !== $slug) {
         return $this->responseFactory->redirectToRoute('product::view', ['id' => $product->id, 'slug' => $product->slug], 301);
     }
     return $this->view->make('customer.product.view', ['product' => $this->view->getProduct($product), 'meta' => $this->view->productMeta($product), 'similar' => $this->view->similarProducts($product)]);
 }
Ejemplo n.º 2
0
 /**
  * @throws \BadMethodCallException
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function clearProductCache()
 {
     $this->view->clearAll();
     $this->webUi->successMessage('Product cache was cleared.');
     return $this->webUi->redirect('products.index');
 }
Ejemplo n.º 3
0
 /**
  * @throws \BadMethodCallException
  *
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function getIndex()
 {
     return $this->view->make('welcome', ['productRows' => $this->view->frontProducts()->chunk(4)]);
 }
Ejemplo n.º 4
0
 /**
  * Clean catalogue view of the product on save.
  *
  * @param Product $product
  */
 public function saved(Product $product)
 {
     $this->catalogueView->clearProduct($product->id);
 }