getCurrency() public méthode

public getCurrency ( ) : Sonata\Component\Currency\CurrencyInterface
Résultat Sonata\Component\Currency\CurrencyInterface
Exemple #1
0
 /**
  * Add the meta information.
  *
  * @param SeoPageInterface $seoPage
  * @param ProductInterface $product
  */
 public function alterPage(SeoPageInterface $seoPage, ProductInterface $product)
 {
     $seoPage->addMeta('name', 'twitter:card', 'product')->addMeta('name', 'twitter:title', $product->getName())->addMeta('name', 'twitter:description', substr($product->getDescription(), 0, 200))->addMeta('name', 'twitter:label1', 'Price')->addMeta('name', 'twitter:data1', $this->numberHelper->formatCurrency($product->getPrice(), $this->currencyDetector->getCurrency()))->addMeta('name', 'twitter:label2', 'SKU')->addMeta('name', 'twitter:data2', $product->getSku())->addMeta('name', 'twitter:site', $this->site)->addMeta('name', 'twitter:creator', $this->creator)->addMeta('name', 'twitter:domain', $this->domain);
     if ($image = $product->getImage()) {
         $provider = $this->mediaPool->getProvider($image->getProviderName());
         $seoPage->addMeta('property', 'twitter:image:src', $provider->generatePublicUrl($image, $this->mediaFormat));
     }
 }
 /**
  * {@inheritdoc}
  */
 public function configureListFields(ListMapper $list)
 {
     $list->addIdentifier('id');
     if (!$list->getAdmin()->isChild()) {
         $list->add('order');
     }
     $list->add('productType')->add('getStatusName', 'trans', array('name' => 'status', 'catalogue' => 'SonataOrderBundle', 'sortable' => 'status'))->add('getDeliveryStatusName', 'trans', array('name' => 'deliveryStatus', 'catalogue' => 'SonataOrderBundle', 'sortable' => 'deliveryStatus'))->add('getTotalWithVat', 'currency', array('currency' => $this->currencyDetector->getCurrency()->getLabel()))->add('getTotal', 'currency', array('currency' => $this->currencyDetector->getCurrency()->getLabel()));
 }
 /**
  * @param SeoPageInterface $seoPage
  * @param ProductInterface $product
  */
 public function alterPage(SeoPageInterface $seoPage, ProductInterface $product)
 {
     $this->registerHeaders($seoPage);
     $seoPage->addMeta('property', 'og:type', 'og:product')->addMeta('property', 'og:title', $product->getName())->addMeta('property', 'og:description', $product->getDescription())->addMeta('property', 'og:url', $this->router->generate('sonata_product_view', array('slug' => $product->getSlug(), 'productId' => $product->getId()), true))->addMeta('property', 'product:price:amount', $this->numberHelper->formatDecimal($product->getPrice()))->addMeta('property', 'product:price:currency', $this->currencyDetector->getCurrency());
     // If a media is available, we add the opengraph image data
     if ($image = $product->getImage()) {
         $this->addImageInfo($image, $seoPage);
     }
 }
Exemple #4
0
 /**
  * {@inheritdoc}
  */
 public function configureListFields(ListMapper $list)
 {
     $currency = $this->currencyDetector->getCurrency()->getLabel();
     $list->addIdentifier('id')->addIdentifier('reference');
     if (!$list->getAdmin()->isChild()) {
         $list->addIdentifier('customer');
     }
     $list->add('paymentMethod')->add('deliveryMethod')->add('locale')->add('status', 'string', array('template' => 'SonataOrderBundle:OrderAdmin:list_status.html.twig'))->add('deliveryStatus', 'string', array('template' => 'SonataOrderBundle:OrderAdmin:list_delivery_status.html.twig'))->add('paymentStatus', 'string', array('template' => 'SonataOrderBundle:OrderAdmin:list_payment_status.html.twig'))->add('validatedAt')->add('totalInc', 'currency', array('currency' => $currency))->add('totalExcl', 'currency', array('currency' => $currency));
 }
 /**
  * {@inheritdoc}
  */
 public function load(CustomerInterface $customer)
 {
     $basket = $this->getFromSession($customer);
     if (!$basket) {
         $basket = $this->basketManager->create();
         $basket->setLocale($customer->getLocale());
         $basket->setCurrency($this->currencyDetector->getCurrency());
     }
     $basket->setCustomer($customer);
     $this->basketBuilder->build($basket);
     return $basket;
 }
 /**
  * {@inheritdoc}
  */
 public function load(CustomerInterface $customer)
 {
     $basket = $this->session->get($this->getSessionVarName($customer));
     if (!$basket) {
         $basket = $this->session->get($this->getSessionVarName());
         if (!$basket) {
             $basket = $this->basketManager->create();
             $basket->setLocale($customer->getLocale());
             $basket->setCurrency($this->currencyDetector->getCurrency());
         }
     }
     $basket->setCustomer($customer);
     $this->basketBuilder->build($basket);
     // always clone the basket so it can be only saved by calling
     // the save method
     return clone $basket;
 }
 /**
  * {@inheritdoc}
  */
 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     $products = $this->getProductRepository()->findLastActiveProducts($blockContext->getSetting('number'));
     $params = array('context' => $blockContext, 'settings' => $blockContext->getSettings(), 'block' => $blockContext->getBlock(), 'products' => $products, 'currency' => $this->currencyDetector->getCurrency());
     return $this->renderResponse($blockContext->getTemplate(), $params, $response);
 }
 /**
  * {@inheritdoc}
  */
 public function configureListFields(ListMapper $list)
 {
     $list->addIdentifier('sku')->addIdentifier('name')->add('isVariation', 'boolean')->add('enabled', null, array('editable' => true))->add('price', 'currency', array('currency' => $this->currencyDetector->getCurrency()->getLabel()))->add('productCategories', null, array('associated_tostring' => 'getCategory'))->add('productCollections', null, array('associated_tostring' => 'getCollection'));
 }
 /**
  * {@inheritdoc}
  */
 public function configureListFields(ListMapper $list)
 {
     $list->addIdentifier('reference')->add('customer')->add('status', 'string', array('template' => 'SonataInvoiceBundle:InvoiceAdmin:list_status.html.twig'))->add('totalExcl', 'currency', array('currency' => $this->currencyDetector->getCurrency()->getLabel()))->add('totalInc', 'currency', array('currency' => $this->currencyDetector->getCurrency()->getLabel()));
 }
 /**
  * {@inheritdoc}
  */
 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     if (!($product = $this->getProductRepository()->findOneBy(array('id' => $blockContext->getSetting('base_product_id'))))) {
         return;
     }
     $products = $this->getProductFinder()->getCrossSellingSimilarParentProducts($product, $blockContext->getSetting('number'));
     $params = array('context' => $blockContext, 'settings' => $blockContext->getSettings(), 'block' => $blockContext->getBlock(), 'products' => $products, 'currency' => $this->currencyDetector->getCurrency());
     return $this->renderResponse($blockContext->getTemplate(), $params, $response);
 }