Exemplo n.º 1
0
 /**
  * @param AddToBasketRequest $request
  *
  * @throws \ChingShop\Modules\Sales\Domain\Payment\StockAllocationException
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function addProductOptionAction(AddToBasketRequest $request)
 {
     $productOption = $this->optionRepository->loadById($request->optionId());
     try {
         $this->clerk->addProductOptionToBasket($productOption);
     } catch (StockAllocationException $e) {
         $this->webUi->warningMessage($e->getMessage());
         return $this->webUi->redirectAway($productOption->product->url());
     }
     $this->webUi->successMessage(sprintf('1 &#215; <strong>%s (%s)</strong> was added to your basket.', $productOption->product->name, $productOption->label));
     Analytics::trackEvent('basket', 'add', $productOption->product->sku, $productOption->label);
     return $this->webUi->redirect('sales.customer.basket');
 }
Exemplo n.º 2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param int $id
  *
  * @throws \Exception
  * @throws \Illuminate\Database\Eloquent\ModelNotFoundException
  *
  * @return \Illuminate\Http\Response
  */
 public function destroy(int $id)
 {
     /** @var Offer $offer */
     $offer = $this->offer->findOrFail($id);
     $offer->delete();
     $this->webUi->warningMessage("Deleted offer `{$offer->name}`.");
     return $this->webUi->redirect('offers.index');
 }
Exemplo n.º 3
0
 /**
  * @return RedirectResponse
  */
 public function cancelAction()
 {
     $this->webUi->warningMessage('No worries, your PayPal payment was cancelled.
         Please choose a payment method');
     return $this->webUi->redirect('sales.customer.checkout.choose-payment');
 }