102 \
Magento\Weee\Model\Tax $weeeTax,
103 \
Magento\Weee\Model\Config $weeeConfig,
105 \
Magento\Framework\Registry $coreRegistry,
106 \
Magento\Framework\Serialize\Serializer\Json $serializer =
null 109 $this->_weeeTax = $weeeTax;
110 $this->_coreRegistry = $coreRegistry;
111 $this->_taxData = $taxData;
112 $this->_weeeConfig = $weeeConfig;
114 ->get(\
Magento\Framework\Serialize\Serializer\Json::class);
115 parent::__construct($context);
126 return $this->_weeeConfig->getPriceDisplayType(
$store);
137 return $this->_weeeConfig->getListPriceDisplayType(
$store);
148 return $this->_weeeConfig->getSalesPriceDisplayType(
$store);
159 return $this->_weeeConfig->getEmailPriceDisplayType(
$store);
170 return $this->_weeeConfig->isTaxable(
$store);
181 return $this->_weeeConfig->includeInSubtotal(
$store);
192 return $this->_weeeConfig->isEnabled(
$store);
204 return $this->_taxData->priceIncludesTax(
$store);
216 if (!
$product->hasData($this->cacheProductWeeeAmount)) {
219 $store = $this->_storeManager->getWebsite(
$website)->getDefaultGroup()->getDefaultStore();
231 return $product->getData($this->cacheProductWeeeAmount);
245 $zone = \
Magento\Framework\Pricing\Render::ZONE_DEFAULT,
252 case \Magento\Framework\Pricing\Render::ZONE_ITEM_VIEW:
255 case \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST:
258 case \Magento\Framework\Pricing\Render::ZONE_SALES:
259 case \Magento\Framework\Pricing\Render::ZONE_CART:
262 case \Magento\Framework\Pricing\Render::ZONE_EMAIL:
266 if ($this->_coreRegistry->registry(
'current_product')) {
274 if ($compareTo ===
null) {
277 if (is_array($compareTo)) {
278 return in_array(
$type, $compareTo);
280 return $type == $compareTo;
301 $calculateTaxes =
false,
304 return $this->_weeeTax->getProductWeeeAttributes(
357 if (
$item instanceof QuoteAbstractItem ||
$item instanceof OrderItem) {
358 if (
$item->getHasChildren() &&
$item->isChildrenCalculated()) {
363 if (!empty($childData)) {
387 if (
$item instanceof QuoteAbstractItem) {
388 if (
$item->getHasChildren() &&
$item->isChildrenCalculated()) {
390 foreach (
$item->getChildren() as $child) {
392 if (is_array($childData)) {
405 return $this->serializer->unserialize(
$item->getWeeeTaxApplied());
417 $item->setWeeeTaxApplied($this->serializer->serialize(
$value));
427 public function getProductWeeeAttributesForDisplay(
$product)
449 public function getProductWeeeAttributesForRenderer(
454 $calculateTaxes =
false 458 $store = $this->_storeManager->getWebsite(
$website)->getDefaultGroup()->getDefaultStore();
484 $totalWeeeTaxIncTaxApplied = 0;
485 foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
486 $totalWeeeTaxIncTaxApplied += max($weeeTaxAppliedAmount[
'amount_incl_tax'], 0);
488 return $totalWeeeTaxIncTaxApplied;
500 $totalBaseWeeeTaxIncTaxApplied = 0;
501 foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
502 $totalBaseWeeeTaxIncTaxApplied += max($weeeTaxAppliedAmount[
'base_amount_incl_tax'], 0);
504 return $totalBaseWeeeTaxIncTaxApplied;
516 $totalWeeeTaxIncTaxApplied = 0;
517 foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
518 $totalWeeeTaxIncTaxApplied += max($weeeTaxAppliedAmount[
'row_amount_incl_tax'], 0);
520 return $totalWeeeTaxIncTaxApplied;
532 $totalWeeeTaxIncTaxApplied = 0;
533 foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
534 $totalWeeeTaxIncTaxApplied += max($weeeTaxAppliedAmount[
'base_row_amount_incl_tax'], 0);
536 return $totalWeeeTaxIncTaxApplied;
548 $totalTaxForWeeeTax = 0;
549 foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
550 $totalTaxForWeeeTax += max(
551 $weeeTaxAppliedAmount[
'amount_incl_tax']
552 - $weeeTaxAppliedAmount[
'amount'],
556 return $totalTaxForWeeeTax;
568 $totalTaxForWeeeTax = 0;
569 foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
570 $totalTaxForWeeeTax += max(
571 $weeeTaxAppliedAmount[
'base_amount_incl_tax']
572 - $weeeTaxAppliedAmount[
'base_amount'],
576 return $totalTaxForWeeeTax;
586 $totalAmountInvoiced = 0;
587 foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
588 if (isset($weeeTaxAppliedAmount[self::KEY_WEEE_AMOUNT_INVOICED])) {
593 return $totalAmountInvoiced;
603 $baseTotalAmountInvoiced = 0;
604 foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
605 if (isset($weeeTaxAppliedAmount[self::KEY_BASE_WEEE_AMOUNT_INVOICED])) {
610 return $baseTotalAmountInvoiced;
620 $totalTaxInvoiced = 0;
621 foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
622 if (isset($weeeTaxAppliedAmount[self::KEY_WEEE_TAX_AMOUNT_INVOICED])) {
627 return $totalTaxInvoiced;
637 $baseTotalTaxInvoiced = 0;
638 foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
639 if (isset($weeeTaxAppliedAmount[self::KEY_BASE_WEEE_TAX_AMOUNT_INVOICED])) {
644 return $baseTotalTaxInvoiced;
654 $totalAmountRefunded = 0;
655 foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
656 if (isset($weeeTaxAppliedAmount[self::KEY_WEEE_AMOUNT_REFUNDED])) {
661 return $totalAmountRefunded;
671 $baseTotalAmountRefunded = 0;
672 foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
673 if (isset($weeeTaxAppliedAmount[self::KEY_BASE_WEEE_AMOUNT_REFUNDED])) {
678 return $baseTotalAmountRefunded;
688 $totalTaxRefunded = 0;
689 foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
690 if (isset($weeeTaxAppliedAmount[self::KEY_WEEE_TAX_AMOUNT_REFUNDED])) {
695 return $totalTaxRefunded;
705 $baseTotalTaxRefunded = 0;
706 foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
707 if (isset($weeeTaxAppliedAmount[self::KEY_BASE_WEEE_TAX_AMOUNT_REFUNDED])) {
712 return $baseTotalTaxRefunded;
727 if ($displayTotalsInclTax) {
730 $weeeTotal +=
$item->getWeeeTaxAppliedRowAmount();
749 if ($displayTotalsInclTax) {
752 $baseWeeeTotal +=
$item->getBaseWeeeTaxAppliedRowAmnt();
755 return $baseWeeeTotal;
767 WeeeDisplayConfig::DISPLAY_INCL,
768 \
Magento\Framework\Pricing\Render::ZONE_ITEM_VIEW,
782 WeeeDisplayConfig::DISPLAY_INCL_DESCR,
783 \
Magento\Framework\Pricing\Render::ZONE_ITEM_VIEW,
797 WeeeDisplayConfig::DISPLAY_EXCL_DESCR_INCL,
798 \
Magento\Framework\Pricing\Render::ZONE_ITEM_VIEW,
812 WeeeDisplayConfig::DISPLAY_EXCL,
813 \
Magento\Framework\Pricing\Render::ZONE_ITEM_VIEW,
826 return $this->_taxData->getPriceDisplayType(
$store);
837 if (
$product->getTypeId() == \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) {
845 $insertedWeeeCodesArray = [];
851 $product->getStore()->getWebsiteId(),
857 foreach ($weeeAttributes as $weeeAttribute) {
858 if ($priceTaxDisplay == \
Magento\Tax\Model\Config::DISPLAY_TYPE_INCLUDING_TAX ||
859 $priceTaxDisplay == \
Magento\Tax\Model\Config::DISPLAY_TYPE_BOTH) {
860 if ($priceIncludesTax ==
false) {
861 $weeeAttribute[
'amount'] = $weeeAttribute[
'amount_excl_tax'] + $weeeAttribute[
'tax_amount'];
863 }
elseif ($priceTaxDisplay == \
Magento\Tax\Model\Config::DISPLAY_TYPE_EXCLUDING_TAX) {
864 if ($priceIncludesTax ==
true) {
865 $weeeAttribute[
'amount'] = $weeeAttribute[
'amount_excl_tax'];
868 $insertedWeeeCodesArray[$selectionItem->getId()][$weeeAttribute->getCode()] = $weeeAttribute;
871 return $insertedWeeeCodesArray;
getBaseWeeeTaxAppliedRowAmount($item)
getBaseWeeeAmountRefunded($orderItem)
getWeeeTaxAppliedAmount($item)
getWeeeTaxAmountRefunded($orderItem)
getBaseWeeeAmountInvoiced($orderItem)
getBaseWeeeTaxAmountRefunded($orderItem)
elseif(isset( $params[ 'redirect_parent']))
const KEY_WEEE_AMOUNT_REFUNDED
getTotalTaxAppliedForWeeeTax($item)
getWeeeTaxAmountInvoiced($orderItem)
isDisplayExclDescIncl($storeId=null)
getRecursiveNumericAmount($item, $functionName)
getBaseWeeeTaxAmountInvoiced($orderItem)
getRowWeeeTaxInclTax($item)
const KEY_BASE_WEEE_AMOUNT_INVOICED
setApplied($item, $value)
isDisplayInclDesc($storeId=null)
getWeeeAttributesForBundle($product)
typeOfDisplay( $compareTo=null, $zone=\Magento\Framework\Pricing\Render::ZONE_DEFAULT, $store=null)
const KEY_WEEE_TAX_AMOUNT_INVOICED
const KEY_WEEE_AMOUNT_INVOICED
const KEY_BASE_WEEE_AMOUNT_REFUNDED
const KEY_BASE_WEEE_TAX_AMOUNT_REFUNDED
getProductWeeeAttributes( $product, $shipping=null, $billing=null, $website=null, $calculateTaxes=false, $round=true)
isDisplayIncl($storeId=null)
getBaseRowWeeeTaxInclTax($item)
includeInSubtotal($store=null)
getWeeeAmountInvoiced($orderItem)
getBaseWeeeTaxInclTax($item)
getPriceDisplayType($store=null)
getBaseTotalAmounts($items, $store=null)
__construct(\Magento\Framework\App\Helper\Context $context, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Weee\Model\Tax $weeeTax, \Magento\Weee\Model\Config $weeeConfig, \Magento\Tax\Helper\Data $taxData, \Magento\Framework\Registry $coreRegistry, \Magento\Framework\Serialize\Serializer\Json $serializer=null)
getSalesPriceDisplayType($store=null)
getEmailPriceDisplayType($store=null)
getWeeeTaxAppliedRowAmount($item)
const KEY_WEEE_TAX_AMOUNT_REFUNDED
isDisplayExcl($storeId=null)
displayTotalsInclTax($store=null)
getBaseTotalTaxAppliedForWeeeTax($item)
getListPriceDisplayType($store=null)
getTaxDisplayConfig($store=null)
const KEY_BASE_WEEE_TAX_AMOUNT_INVOICED
getWeeeAmountRefunded($orderItem)
getTotalAmounts($items, $store=null)