Пример #1
0
 protected function setCustomData()
 {
     // If there is a customer, insert its basket into the response data.
     $currentCustomer = Customers::getCurrent();
     if ($currentCustomer instanceof Customer) {
         $this->setData('basket', $this->getBasketContents($currentCustomer));
     }
 }
Пример #2
0
 /**
  * Empties the basket.
  */
 private function getBasketClearedResponse()
 {
     $response = NULL;
     try {
         // Remove all products from the current customer's basket.
         Customers::getCurrent()->getBasket()->clear();
         $response = new RedirectionResponse($this->getRequest());
         $response->setNextUrl('/cistella');
     } catch (\Exception $exception) {
         $response = $this->getViewPageResponse();
         $customerId = Customers::getCurrent()->getId();
         Logger::get()->error("Failed to clear customer {$customerId}'s basket.");
         $response->addErrorMessage(_('The basket could not be cleared.'));
     }
     return $response;
 }