Наследование: extends Sonata\Component\Product\PriceComputableInterface
 /**
  * @param BasketElementInterface $basketElement
  * @param BasketInterface        $basket
  *
  * @return Response
  */
 public function renderFinalReviewBasketElementAction(BasketElementInterface $basketElement, BasketInterface $basket)
 {
     $provider = $this->get('sonata.product.pool')->getProvider($basketElement->getProduct());
     return $this->render(sprintf('%s:final_review_basket_element.html.twig', $provider->getBaseControllerName()), array('basketElement' => $basketElement, 'basket' => $basket));
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 public function updateComputationPricesFields(BasketInterface $basket, BasketElementInterface $basketElement, ProductInterface $product)
 {
     $unitPrice = $this->calculatePrice($product, $basket->getCurrency(), $product->isPriceIncludingVat(), 1);
     $price = $this->calculatePrice($product, $basket->getCurrency(), $product->isPriceIncludingVat(), $basketElement->getQuantity());
     $basketElement->setUnitPrice($unitPrice);
     $basketElement->setPrice($price);
     $basketElement->setPriceIncludingVat($product->isPriceIncludingVat());
     $basketElement->setVatRate($product->getVatRate());
 }
Пример #3
0
 /**
  * {@inheritdoc}
  */
 public function removeBasketElement(BasketElementInterface $element)
 {
     $pos = $element->getPosition();
     $this->cptElement--;
     unset($this->positions[$element->getProduct()->getId()], $this->basketElements[$pos]);
     if (!$this->inBuild) {
         $this->buildPrices();
     }
     return $element;
 }
 /**
  * @param BasketElementInterface $basketElement
  * @param BasketInterface        $basket
  *
  * @return Response
  */
 public function renderFinalReviewBasketElementAction(BasketElementInterface $basketElement, BasketInterface $basket)
 {
     $action = sprintf('%s:renderFinalReviewBasketElement', $basketElement->getProductProvider()->getBaseControllerName());
     $response = $this->forward($action, array('basketElement' => $basketElement, 'basket' => $basket));
     if ($this->get('kernel')->isDebug()) {
         $response->setContent(sprintf("\n<!-- [Sonata] Product code: %s, id: %s, action: %s -->\n%s\n<!-- [Sonata] end product -->\n", $basketElement->getProductCode(), $basketElement->getProductId(), $action, $response->getContent()));
     }
     return $response;
 }