/**
  * @param \Magento\Quote\Model\Quote\Address $address
  * @return bool
  */
 public function isCanApplyMsrp($address)
 {
     $canApplyMsrp = false;
     foreach ($address->getAllItems() as $item) {
         if (!$item->getParentItemId() && $this->msrpHelper->isShowBeforeOrderConfirm($item->getProductId()) && $this->msrpHelper->isMinimalPriceLessMsrp($item->getProductId())) {
             $canApplyMsrp = true;
             break;
         }
     }
     return $canApplyMsrp;
 }
Beispiel #2
0
 /**
  * Collect information about MSRP price enabled
  *
  * @param  \Magento\Quote\Model\Quote\Address $address
  * @return $this
  * @api
  */
 public function collect(\Magento\Quote\Model\Quote\Address $address)
 {
     parent::collect($address);
     $items = $this->_getAddressItems($address);
     if (!count($items)) {
         return $this;
     }
     $canApplyMsrp = false;
     foreach ($items as $item) {
         if (!$item->getParentItemId() && $this->msrpData->isShowBeforeOrderConfirm($item->getProductId()) && $this->msrpData->isMinimalPriceLessMsrp($item->getProductId())) {
             $canApplyMsrp = true;
             break;
         }
     }
     $address->setCanApplyMsrp($canApplyMsrp);
     return $this;
 }
 /**
  * {@inheritdoc}
  */
 protected function doGetItemData()
 {
     $imageHelper = $this->imageHelper->init($this->getProductForThumbnail(), 'mini_cart_product_thumbnail');
     return ['options' => $this->getOptionList(), 'qty' => $this->item->getQty() * 1, 'item_id' => $this->item->getId(), 'configure_url' => $this->getConfigureUrl(), 'is_visible_in_site_visibility' => $this->item->getProduct()->isVisibleInSiteVisibility(), 'product_name' => $this->item->getProduct()->getName(), 'product_url' => $this->getProductUrl(), 'product_has_url' => $this->hasProductUrl(), 'product_price' => $this->checkoutHelper->formatPrice($this->item->getCalculationPrice()), 'product_image' => ['src' => $imageHelper->getUrl(), 'alt' => $imageHelper->getLabel(), 'width' => $imageHelper->getWidth(), 'height' => $imageHelper->getHeight()], 'canApplyMsrp' => $this->msrpHelper->isShowBeforeOrderConfirm($this->item->getProduct()) && $this->msrpHelper->isMinimalPriceLessMsrp($this->item->getProduct())];
 }