Esempio n. 1
0
 /**
  * Process bundle options selection for prepare view json
  *
  * @param   \Magento\Framework\Event\Observer $observer
  * @return  $this
  */
 public function updateBundleProductOptions(\Magento\Framework\Event\Observer $observer)
 {
     if (!$this->_weeeData->isEnabled()) {
         return $this;
     }
     $response = $observer->getEvent()->getResponseObject();
     $selection = $observer->getEvent()->getSelection();
     $options = $response->getAdditionalOptions();
     $_product = $this->_registry->registry('current_product');
     $typeDynamic = \Magento\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab\Attributes\Extend::DYNAMIC;
     if (!$_product || $_product->getPriceType() != $typeDynamic) {
         return $this;
     }
     $amount = $this->_weeeData->getAmount($selection);
     $attributes = $this->_weeeData->getProductWeeeAttributes($_product, null, null, null, $this->_weeeData->isTaxable());
     $amountInclTaxes = $this->_weeeData->getAmountInclTaxes($attributes);
     $taxes = $amountInclTaxes - $amount;
     $options['plusDisposition'] = $amount;
     $options['plusDispositionTax'] = $taxes < 0 ? 0 : $taxes;
     // Exclude Weee amount from excluding tax amount
     if (!$this->_weeeData->typeOfDisplay(array(0, 1, 4))) {
         $options['exclDisposition'] = true;
     }
     $response->setAdditionalOptions($options);
     return $this;
 }
Esempio n. 2
0
 /**
  * Define if adjustment is included in display price
  *
  * @return bool
  */
 public function isIncludedInDisplayPrice()
 {
     if ($this->taxHelper->displayPriceExcludingTax()) {
         return false;
     }
     if ($this->weeeHelper->isEnabled() == true && $this->weeeHelper->isTaxable() == true && $this->weeeHelper->typeOfDisplay([\Magento\Weee\Model\Tax::DISPLAY_EXCL]) == false) {
         return true;
     } else {
         return false;
     }
 }
Esempio n. 3
0
 /**
  * Whether to display final price that include Weee amounts
  *
  * @return bool
  */
 public function displayFinalPrice()
 {
     $flag = $this->weeeHelper->typeOfDisplay(WeeeDisplayConfig::DISPLAY_EXCL_DESCR_INCL, $this->getZone(), $this->getStoreId());
     if (!$flag) {
         return false;
     }
     if (!$this->getItem()->getWeeeTaxAppliedAmount()) {
         return false;
     }
     return true;
 }
Esempio n. 4
0
 /**
  * Returns display type for price accordingly to current zone
  *
  * @param int|int[]|null $compareTo
  * @param \Magento\Store\Model\Store|null $store
  * @return bool|int
  */
 protected function typeOfDisplay($compareTo = null, $store = null)
 {
     return $this->weeeHelper->typeOfDisplay($compareTo, $this->getZone(), $store);
 }
Esempio n. 5
0
 /**
  * Define if adjustment is included in display price
  *
  * @return bool
  */
 public function isIncludedInDisplayPrice()
 {
     return $this->weeeHelper->typeOfDisplay([\Magento\Weee\Model\Tax::DISPLAY_INCL, \Magento\Weee\Model\Tax::DISPLAY_INCL_DESCR, \Magento\Weee\Model\Tax::DISPLAY_EXCL_DESCR_INCL]);
 }
 /**
  * Return the flag whether to include weee in the price
  *
  * @return bool|int
  */
 private function getIncludeWeeeFlag()
 {
     $includeWeee = $this->weeeHelper->typeOfDisplay([WeeeDisplayConfig::DISPLAY_INCL_DESCR, WeeeDisplayConfig::DISPLAY_INCL], 'cart', $this->getStoreId());
     return $includeWeee;
 }