Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes
Data Class Reference
Inheritance diagram for Data:
AbstractHelper

Public Member Functions

 __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)
 
 getPriceDisplayType ($store=null)
 
 getListPriceDisplayType ($store=null)
 
 getSalesPriceDisplayType ($store=null)
 
 getEmailPriceDisplayType ($store=null)
 
 isTaxable ($store=null)
 
 includeInSubtotal ($store=null)
 
 isEnabled ($store=null)
 
 displayTotalsInclTax ($store=null)
 
 typeOfDisplay ( $compareTo=null, $zone=\Magento\Framework\Pricing\Render::ZONE_DEFAULT, $store=null)
 
 getProductWeeeAttributes ( $product, $shipping=null, $billing=null, $website=null, $calculateTaxes=false, $round=true)
 
 getWeeeTaxAppliedAmount ($item)
 
 getWeeeTaxAppliedRowAmount ($item)
 
 getBaseWeeeTaxAppliedRowAmount ($item)
 
 getApplied ($item)
 
 setApplied ($item, $value)
 
 getWeeeTaxInclTax ($item)
 
 getBaseWeeeTaxInclTax ($item)
 
 getRowWeeeTaxInclTax ($item)
 
 getBaseRowWeeeTaxInclTax ($item)
 
 getTotalTaxAppliedForWeeeTax ($item)
 
 getBaseTotalTaxAppliedForWeeeTax ($item)
 
 getWeeeAmountInvoiced ($orderItem)
 
 getBaseWeeeAmountInvoiced ($orderItem)
 
 getWeeeTaxAmountInvoiced ($orderItem)
 
 getBaseWeeeTaxAmountInvoiced ($orderItem)
 
 getWeeeAmountRefunded ($orderItem)
 
 getBaseWeeeAmountRefunded ($orderItem)
 
 getWeeeTaxAmountRefunded ($orderItem)
 
 getBaseWeeeTaxAmountRefunded ($orderItem)
 
 getTotalAmounts ($items, $store=null)
 
 getBaseTotalAmounts ($items, $store=null)
 
 isDisplayIncl ($storeId=null)
 
 isDisplayInclDesc ($storeId=null)
 
 isDisplayExclDescIncl ($storeId=null)
 
 isDisplayExcl ($storeId=null)
 
 getTaxDisplayConfig ($store=null)
 
 getWeeeAttributesForBundle ($product)
 
- Public Member Functions inherited from AbstractHelper
 __construct (Context $context)
 
 isModuleOutputEnabled ($moduleName=null)
 

Data Fields

const KEY_WEEE_AMOUNT_INVOICED = 'weee_amount_invoiced'
 
const KEY_BASE_WEEE_AMOUNT_INVOICED = 'base_weee_amount_invoiced'
 
const KEY_WEEE_TAX_AMOUNT_INVOICED = 'weee_tax_amount_invoiced'
 
const KEY_BASE_WEEE_TAX_AMOUNT_INVOICED = 'base_weee_tax_amount_invoiced'
 
const KEY_WEEE_AMOUNT_REFUNDED = 'weee_amount_refunded'
 
const KEY_BASE_WEEE_AMOUNT_REFUNDED = 'base_weee_amount_refunded'
 
const KEY_WEEE_TAX_AMOUNT_REFUNDED = 'weee_tax_amount_refunded'
 
const KEY_BASE_WEEE_TAX_AMOUNT_REFUNDED = 'base_weee_tax_amount_refunded'
 

Protected Member Functions

 getRecursiveNumericAmount ($item, $functionName)
 
- Protected Member Functions inherited from AbstractHelper
 _getRequest ()
 
 _getModuleName ()
 
 _getUrl ($route, $params=[])
 

Protected Attributes

 $_storeDisplayConfig = []
 
 $_coreRegistry
 
 $_taxData
 
 $_weeeTax
 
 $_weeeConfig
 
 $_storeManager
 
 $cacheProductWeeeAmount = '_cache_product_weee_amount'
 
- Protected Attributes inherited from AbstractHelper
 $_moduleName
 
 $_request
 
 $_moduleManager
 
 $_logger
 
 $_urlBuilder
 
 $_httpHeader
 
 $_eventManager
 
 $_remoteAddress
 
 $urlEncoder
 
 $urlDecoder
 
 $scopeConfig
 
 $_cacheConfig
 

Detailed Description

WEEE data helper

@SuppressWarnings(PHPMD.ExcessiveClassComplexity) @SuppressWarnings(PHPMD.CouplingBetweenObjects) @api

Since
100.0.2

Definition at line 22 of file Data.php.

Constructor & Destructor Documentation

◆ __construct()

Data constructor.

Parameters
\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 | null$serializer
Exceptions

Definition at line 99 of file Data.php.

107  {
108  $this->_storeManager = $storeManager;
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);
116  }
$storeManager

Member Function Documentation

◆ displayTotalsInclTax()

displayTotalsInclTax (   $store = null)

Check if the FPT totals line(s) should be displayed with tax included

Parameters
null | string | bool | int | Store$store
Returns
bool

Definition at line 201 of file Data.php.

202  {
203  // If catalog prices include tax, then display FPT totals with tax included
204  return $this->_taxData->priceIncludesTax($store);
205  }

◆ getApplied()

getApplied (   $item)

Returns applied weee taxes

Parameters
QuoteAbstractItem$item
Returns
array

Definition at line 385 of file Data.php.

386  {
387  if ($item instanceof QuoteAbstractItem) {
388  if ($item->getHasChildren() && $item->isChildrenCalculated()) {
389  $result = [];
390  foreach ($item->getChildren() as $child) {
391  $childData = $this->getApplied($child);
392  if (is_array($childData)) {
393  $result = array_merge($result, $childData);
394  }
395  }
396  return $result;
397  }
398  }
399 
400  // if order item data is old enough then weee_tax_applied might not be valid
401  $data = $item->getWeeeTaxApplied();
402  if (empty($data)) {
403  return [];
404  }
405  return $this->serializer->unserialize($item->getWeeeTaxApplied());
406  }

◆ getBaseRowWeeeTaxInclTax()

getBaseRowWeeeTaxInclTax (   $item)

Get the total base weee including tax by row

Parameters
QuoteAbstractItem$item
Returns
float

Definition at line 529 of file Data.php.

530  {
531  $weeeTaxAppliedAmounts = $this->getApplied($item);
532  $totalWeeeTaxIncTaxApplied = 0;
533  foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
534  $totalWeeeTaxIncTaxApplied += max($weeeTaxAppliedAmount['base_row_amount_incl_tax'], 0);
535  }
536  return $totalWeeeTaxIncTaxApplied;
537  }

◆ getBaseTotalAmounts()

getBaseTotalAmounts (   $items,
  $store = null 
)

Returns the base total amount of FPT across all items. Used for displaying the FPT totals line item.

Parameters
QuoteAbstractItem[]$items
null | string | bool | int | Store$store
Returns
float
Since
100.1.0

Definition at line 744 of file Data.php.

745  {
746  $baseWeeeTotal = 0;
747  $displayTotalsInclTax = $this->displayTotalsInclTax($store);
748  foreach ($items as $item) {
749  if ($displayTotalsInclTax) {
750  $baseWeeeTotal += $this->getBaseRowWeeeTaxInclTax($item);
751  } else {
752  $baseWeeeTotal += $item->getBaseWeeeTaxAppliedRowAmnt();
753  }
754  }
755  return $baseWeeeTotal;
756  }
getBaseRowWeeeTaxInclTax($item)
Definition: Data.php:529
displayTotalsInclTax($store=null)
Definition: Data.php:201
$items

◆ getBaseTotalTaxAppliedForWeeeTax()

getBaseTotalTaxAppliedForWeeeTax (   $item)

Get the total tax applied on weee by unit

Parameters
QuoteAbstractItem$item
Returns
float

Definition at line 565 of file Data.php.

566  {
567  $weeeTaxAppliedAmounts = $this->getApplied($item);
568  $totalTaxForWeeeTax = 0;
569  foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
570  $totalTaxForWeeeTax += max(
571  $weeeTaxAppliedAmount['base_amount_incl_tax']
572  - $weeeTaxAppliedAmount['base_amount'],
573  0
574  );
575  }
576  return $totalTaxForWeeeTax;
577  }

◆ getBaseWeeeAmountInvoiced()

getBaseWeeeAmountInvoiced (   $orderItem)
Parameters
OrderItem$orderItem
Returns
float

Definition at line 600 of file Data.php.

601  {
602  $weeeTaxAppliedAmounts = $this->getApplied($orderItem);
603  $baseTotalAmountInvoiced = 0;
604  foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
605  if (isset($weeeTaxAppliedAmount[self::KEY_BASE_WEEE_AMOUNT_INVOICED])) {
606  $baseTotalAmountInvoiced = $weeeTaxAppliedAmount[self::KEY_BASE_WEEE_AMOUNT_INVOICED];
607  break;
608  }
609  }
610  return $baseTotalAmountInvoiced;
611  }
$orderItem
Definition: order.php:30
const KEY_BASE_WEEE_AMOUNT_INVOICED
Definition: Data.php:29

◆ getBaseWeeeAmountRefunded()

getBaseWeeeAmountRefunded (   $orderItem)
Parameters
OrderItem$orderItem
Returns
float

Definition at line 668 of file Data.php.

669  {
670  $weeeTaxAppliedAmounts = $this->getApplied($orderItem);
671  $baseTotalAmountRefunded = 0;
672  foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
673  if (isset($weeeTaxAppliedAmount[self::KEY_BASE_WEEE_AMOUNT_REFUNDED])) {
674  $baseTotalAmountRefunded = $weeeTaxAppliedAmount[self::KEY_BASE_WEEE_AMOUNT_REFUNDED];
675  break;
676  }
677  }
678  return $baseTotalAmountRefunded;
679  }
$orderItem
Definition: order.php:30
const KEY_BASE_WEEE_AMOUNT_REFUNDED
Definition: Data.php:37

◆ getBaseWeeeTaxAmountInvoiced()

getBaseWeeeTaxAmountInvoiced (   $orderItem)
Parameters
OrderItem$orderItem
Returns
float

Definition at line 634 of file Data.php.

635  {
636  $weeeTaxAppliedAmounts = $this->getApplied($orderItem);
637  $baseTotalTaxInvoiced = 0;
638  foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
639  if (isset($weeeTaxAppliedAmount[self::KEY_BASE_WEEE_TAX_AMOUNT_INVOICED])) {
640  $baseTotalTaxInvoiced = $weeeTaxAppliedAmount[self::KEY_BASE_WEEE_TAX_AMOUNT_INVOICED];
641  break;
642  }
643  }
644  return $baseTotalTaxInvoiced;
645  }
$orderItem
Definition: order.php:30
const KEY_BASE_WEEE_TAX_AMOUNT_INVOICED
Definition: Data.php:33

◆ getBaseWeeeTaxAmountRefunded()

getBaseWeeeTaxAmountRefunded (   $orderItem)
Parameters
OrderItem$orderItem
Returns
float

Definition at line 702 of file Data.php.

703  {
704  $weeeTaxAppliedAmounts = $this->getApplied($orderItem);
705  $baseTotalTaxRefunded = 0;
706  foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
707  if (isset($weeeTaxAppliedAmount[self::KEY_BASE_WEEE_TAX_AMOUNT_REFUNDED])) {
708  $baseTotalTaxRefunded = $weeeTaxAppliedAmount[self::KEY_BASE_WEEE_TAX_AMOUNT_REFUNDED];
709  break;
710  }
711  }
712  return $baseTotalTaxRefunded;
713  }
$orderItem
Definition: order.php:30
const KEY_BASE_WEEE_TAX_AMOUNT_REFUNDED
Definition: Data.php:41

◆ getBaseWeeeTaxAppliedRowAmount()

getBaseWeeeTaxAppliedRowAmount (   $item)

Returns applied base weee tax amount for the row

Parameters
QuoteAbstractItem | OrderItem$item
Returns
float
Since
100.2.0

Definition at line 343 of file Data.php.

344  {
345  return $this->getRecursiveNumericAmount($item, 'getBaseWeeeTaxAppliedRowAmnt');
346  }
getRecursiveNumericAmount($item, $functionName)
Definition: Data.php:355

◆ getBaseWeeeTaxInclTax()

getBaseWeeeTaxInclTax (   $item)

Get the total base weee tax

Parameters
QuoteAbstractItem$item
Returns
float

Definition at line 497 of file Data.php.

498  {
499  $weeeTaxAppliedAmounts = $this->getApplied($item);
500  $totalBaseWeeeTaxIncTaxApplied = 0;
501  foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
502  $totalBaseWeeeTaxIncTaxApplied += max($weeeTaxAppliedAmount['base_amount_incl_tax'], 0);
503  }
504  return $totalBaseWeeeTaxIncTaxApplied;
505  }

◆ getEmailPriceDisplayType()

getEmailPriceDisplayType (   $store = null)

Get weee amount display type in email templates

Parameters
null | string | bool | int | Store$store
Returns
int

Definition at line 157 of file Data.php.

158  {
159  return $this->_weeeConfig->getEmailPriceDisplayType($store);
160  }

◆ getListPriceDisplayType()

getListPriceDisplayType (   $store = null)

Get weee amount display type on product list page

Parameters
null | string | bool | int | Store$store
Returns
int

Definition at line 135 of file Data.php.

136  {
137  return $this->_weeeConfig->getListPriceDisplayType($store);
138  }

◆ getPriceDisplayType()

getPriceDisplayType (   $store = null)

Get weee amount display type on product view page

Parameters
null | string | bool | int | Store$store
Returns
int

Definition at line 124 of file Data.php.

125  {
126  return $this->_weeeConfig->getPriceDisplayType($store);
127  }

◆ getProductWeeeAttributes()

getProductWeeeAttributes (   $product,
  $shipping = null,
  $billing = null,
  $website = null,
  $calculateTaxes = false,
  $round = true 
)

Proxy for \Magento\Weee\Model\Tax::getProductWeeeAttributes()

Parameters
\Magento\Catalog\Model\Product$product
null | false | \Magento\Framework\DataObject$shipping
null | false | \Magento\Framework\DataObject$billing
Website$website
bool$calculateTaxes
bool$round
Returns
\Magento\Framework\DataObject[]

Definition at line 296 of file Data.php.

303  {
304  return $this->_weeeTax->getProductWeeeAttributes(
305  $product,
306  $shipping,
307  $billing,
308  $website,
309  $calculateTaxes,
310  $round
311  );
312  }

◆ getRecursiveNumericAmount()

getRecursiveNumericAmount (   $item,
  $functionName 
)
protected

Returns accumulated amounts for the item

Parameters
QuoteAbstractItem | OrderItem$item
string$functionName
Returns
float

Definition at line 355 of file Data.php.

356  {
357  if ($item instanceof QuoteAbstractItem || $item instanceof OrderItem) {
358  if ($item->getHasChildren() && $item->isChildrenCalculated()) {
359  $result = 0;
360  $children = $item instanceof OrderItem ? $item->getChildrenItems() : $item->getChildren();
361  foreach ($children as $child) {
362  $childData = $this->getRecursiveNumericAmount($child, $functionName);
363  if (!empty($childData)) {
364  $result += $childData;
365  }
366  }
367 
368  return $result;
369  }
370  }
371 
372  $data = $item->$functionName();
373  if (empty($data)) {
374  return 0;
375  }
376  return $data;
377  }
getRecursiveNumericAmount($item, $functionName)
Definition: Data.php:355
$children
Definition: actions.phtml:11

◆ getRowWeeeTaxInclTax()

getRowWeeeTaxInclTax (   $item)

Get the total weee including tax by row

Parameters
QuoteAbstractItem$item
Returns
float

Definition at line 513 of file Data.php.

514  {
515  $weeeTaxAppliedAmounts = $this->getApplied($item);
516  $totalWeeeTaxIncTaxApplied = 0;
517  foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
518  $totalWeeeTaxIncTaxApplied += max($weeeTaxAppliedAmount['row_amount_incl_tax'], 0);
519  }
520  return $totalWeeeTaxIncTaxApplied;
521  }

◆ getSalesPriceDisplayType()

getSalesPriceDisplayType (   $store = null)

Get weee amount display type in sales modules

Parameters
null | string | bool | int | Store$store
Returns
int

Definition at line 146 of file Data.php.

147  {
148  return $this->_weeeConfig->getSalesPriceDisplayType($store);
149  }

◆ getTaxDisplayConfig()

getTaxDisplayConfig (   $store = null)

Get tax price display settings

Parameters
null | string | bool | int | Store$store
Returns
int

Definition at line 824 of file Data.php.

825  {
826  return $this->_taxData->getPriceDisplayType($store);
827  }

◆ getTotalAmounts()

getTotalAmounts (   $items,
  $store = null 
)

Returns the total amount of FPT across all items. Used for displaying the FPT totals line item.

Parameters
QuoteAbstractItem[]$items
null | string | bool | int | Store$store
Returns
float

Definition at line 722 of file Data.php.

723  {
724  $weeeTotal = 0;
725  $displayTotalsInclTax = $this->displayTotalsInclTax($store);
726  foreach ($items as $item) {
727  if ($displayTotalsInclTax) {
728  $weeeTotal += $this->getRowWeeeTaxInclTax($item);
729  } else {
730  $weeeTotal += $item->getWeeeTaxAppliedRowAmount();
731  }
732  }
733  return $weeeTotal;
734  }
getRowWeeeTaxInclTax($item)
Definition: Data.php:513
displayTotalsInclTax($store=null)
Definition: Data.php:201
$items

◆ getTotalTaxAppliedForWeeeTax()

getTotalTaxAppliedForWeeeTax (   $item)

Get the total tax applied on weee by unit

Parameters
QuoteAbstractItem$item
Returns
float

Definition at line 545 of file Data.php.

546  {
547  $weeeTaxAppliedAmounts = $this->getApplied($item);
548  $totalTaxForWeeeTax = 0;
549  foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
550  $totalTaxForWeeeTax += max(
551  $weeeTaxAppliedAmount['amount_incl_tax']
552  - $weeeTaxAppliedAmount['amount'],
553  0
554  );
555  }
556  return $totalTaxForWeeeTax;
557  }

◆ getWeeeAmountInvoiced()

getWeeeAmountInvoiced (   $orderItem)
Parameters
OrderItem$orderItem
Returns
float

Definition at line 583 of file Data.php.

584  {
585  $weeeTaxAppliedAmounts = $this->getApplied($orderItem);
586  $totalAmountInvoiced = 0;
587  foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
588  if (isset($weeeTaxAppliedAmount[self::KEY_WEEE_AMOUNT_INVOICED])) {
589  $totalAmountInvoiced = $weeeTaxAppliedAmount[self::KEY_WEEE_AMOUNT_INVOICED];
590  break;
591  }
592  }
593  return $totalAmountInvoiced;
594  }
$orderItem
Definition: order.php:30
const KEY_WEEE_AMOUNT_INVOICED
Definition: Data.php:27

◆ getWeeeAmountRefunded()

getWeeeAmountRefunded (   $orderItem)
Parameters
OrderItem$orderItem
Returns
float

Definition at line 651 of file Data.php.

652  {
653  $weeeTaxAppliedAmounts = $this->getApplied($orderItem);
654  $totalAmountRefunded = 0;
655  foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
656  if (isset($weeeTaxAppliedAmount[self::KEY_WEEE_AMOUNT_REFUNDED])) {
657  $totalAmountRefunded = $weeeTaxAppliedAmount[self::KEY_WEEE_AMOUNT_REFUNDED];
658  break;
659  }
660  }
661  return $totalAmountRefunded;
662  }
$orderItem
Definition: order.php:30
const KEY_WEEE_AMOUNT_REFUNDED
Definition: Data.php:35

◆ getWeeeAttributesForBundle()

getWeeeAttributesForBundle (   $product)

Return an array of FPT attributes for a bundle product

Parameters
\Magento\Catalog\Model\Product$product
Returns
array

Definition at line 835 of file Data.php.

836  {
837  if ($product->getTypeId() == \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) {
838  $typeInstance = $product->getTypeInstance();
839  $typeInstance->setStoreFilter($product->getStoreId(), $product);
840 
841  $selectionCollection = $typeInstance->getSelectionsCollection(
842  $typeInstance->getOptionsIds($product),
843  $product
844  );
845  $insertedWeeeCodesArray = [];
846  foreach ($selectionCollection as $selectionItem) {
847  $weeeAttributes = $this->getProductWeeeAttributes(
848  $selectionItem,
849  null,
850  null,
851  $product->getStore()->getWebsiteId(),
852  true,
853  false
854  );
855  $priceTaxDisplay = $this->getTaxDisplayConfig();
856  $priceIncludesTax = $this->displayTotalsInclTax();
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'];
862  }
863  } elseif ($priceTaxDisplay == \Magento\Tax\Model\Config::DISPLAY_TYPE_EXCLUDING_TAX) {
864  if ($priceIncludesTax == true) {
865  $weeeAttribute['amount'] = $weeeAttribute['amount_excl_tax'];
866  }
867  }
868  $insertedWeeeCodesArray[$selectionItem->getId()][$weeeAttribute->getCode()] = $weeeAttribute;
869  }
870  }
871  return $insertedWeeeCodesArray;
872  }
873  return [];
874  }
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
return false
Definition: gallery.phtml:36
getProductWeeeAttributes( $product, $shipping=null, $billing=null, $website=null, $calculateTaxes=false, $round=true)
Definition: Data.php:296
$selectionCollection
displayTotalsInclTax($store=null)
Definition: Data.php:201
getTaxDisplayConfig($store=null)
Definition: Data.php:824

◆ getWeeeTaxAmountInvoiced()

getWeeeTaxAmountInvoiced (   $orderItem)
Parameters
OrderItem$orderItem
Returns
float

Definition at line 617 of file Data.php.

618  {
619  $weeeTaxAppliedAmounts = $this->getApplied($orderItem);
620  $totalTaxInvoiced = 0;
621  foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
622  if (isset($weeeTaxAppliedAmount[self::KEY_WEEE_TAX_AMOUNT_INVOICED])) {
623  $totalTaxInvoiced = $weeeTaxAppliedAmount[self::KEY_WEEE_TAX_AMOUNT_INVOICED];
624  break;
625  }
626  }
627  return $totalTaxInvoiced;
628  }
$orderItem
Definition: order.php:30
const KEY_WEEE_TAX_AMOUNT_INVOICED
Definition: Data.php:31

◆ getWeeeTaxAmountRefunded()

getWeeeTaxAmountRefunded (   $orderItem)
Parameters
OrderItem$orderItem
Returns
float

Definition at line 685 of file Data.php.

686  {
687  $weeeTaxAppliedAmounts = $this->getApplied($orderItem);
688  $totalTaxRefunded = 0;
689  foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
690  if (isset($weeeTaxAppliedAmount[self::KEY_WEEE_TAX_AMOUNT_REFUNDED])) {
691  $totalTaxRefunded = $weeeTaxAppliedAmount[self::KEY_WEEE_TAX_AMOUNT_REFUNDED];
692  break;
693  }
694  }
695  return $totalTaxRefunded;
696  }
$orderItem
Definition: order.php:30
const KEY_WEEE_TAX_AMOUNT_REFUNDED
Definition: Data.php:39

◆ getWeeeTaxAppliedAmount()

getWeeeTaxAppliedAmount (   $item)

Returns applied weee tax amount

Parameters
QuoteAbstractItem$item
Returns
float

Definition at line 320 of file Data.php.

321  {
322  return $this->getRecursiveNumericAmount($item, 'getWeeeTaxAppliedAmount');
323  }
getRecursiveNumericAmount($item, $functionName)
Definition: Data.php:355

◆ getWeeeTaxAppliedRowAmount()

getWeeeTaxAppliedRowAmount (   $item)

Returns applied weee tax amount for the row

Parameters
QuoteAbstractItem$item
Returns
float

Definition at line 331 of file Data.php.

332  {
333  return $this->getRecursiveNumericAmount($item, 'getWeeeTaxAppliedRowAmount');
334  }
getRecursiveNumericAmount($item, $functionName)
Definition: Data.php:355

◆ getWeeeTaxInclTax()

getWeeeTaxInclTax (   $item)

Get the weee tax including tax

Parameters
QuoteAbstractItem$item
Returns
float

Definition at line 481 of file Data.php.

482  {
483  $weeeTaxAppliedAmounts = $this->getApplied($item);
484  $totalWeeeTaxIncTaxApplied = 0;
485  foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
486  $totalWeeeTaxIncTaxApplied += max($weeeTaxAppliedAmount['amount_incl_tax'], 0);
487  }
488  return $totalWeeeTaxIncTaxApplied;
489  }

◆ includeInSubtotal()

includeInSubtotal (   $store = null)

Check if weee tax amount should be included to subtotal

Parameters
null | string | bool | int | Store$store
Returns
bool

Definition at line 179 of file Data.php.

180  {
181  return $this->_weeeConfig->includeInSubtotal($store);
182  }

◆ isDisplayExcl()

isDisplayExcl (   $storeId = null)

Get FPT DISPLAY_EXCL setting

Parameters
int | null$storeId
Returns
bool

Definition at line 809 of file Data.php.

810  {
811  return $this->typeOfDisplay(
812  WeeeDisplayConfig::DISPLAY_EXCL,
813  \Magento\Framework\Pricing\Render::ZONE_ITEM_VIEW,
814  $storeId
815  );
816  }
typeOfDisplay( $compareTo=null, $zone=\Magento\Framework\Pricing\Render::ZONE_DEFAULT, $store=null)
Definition: Data.php:243

◆ isDisplayExclDescIncl()

isDisplayExclDescIncl (   $storeId = null)

Get FPT DISPLAY_EXCL_DESCR_INCL setting

Parameters
int | null$storeId
Returns
bool

Definition at line 794 of file Data.php.

795  {
796  return $this->typeOfDisplay(
797  WeeeDisplayConfig::DISPLAY_EXCL_DESCR_INCL,
798  \Magento\Framework\Pricing\Render::ZONE_ITEM_VIEW,
799  $storeId
800  );
801  }
typeOfDisplay( $compareTo=null, $zone=\Magento\Framework\Pricing\Render::ZONE_DEFAULT, $store=null)
Definition: Data.php:243

◆ isDisplayIncl()

isDisplayIncl (   $storeId = null)

Get FPT DISPLAY_INCL setting

Parameters
int | null$storeId
Returns
bool

Definition at line 764 of file Data.php.

765  {
766  return $this->typeOfDisplay(
767  WeeeDisplayConfig::DISPLAY_INCL,
768  \Magento\Framework\Pricing\Render::ZONE_ITEM_VIEW,
769  $storeId
770  );
771  }
typeOfDisplay( $compareTo=null, $zone=\Magento\Framework\Pricing\Render::ZONE_DEFAULT, $store=null)
Definition: Data.php:243

◆ isDisplayInclDesc()

isDisplayInclDesc (   $storeId = null)

Get FPT DISPLAY_INCL_DESCR setting

Parameters
int | null$storeId
Returns
bool

Definition at line 779 of file Data.php.

780  {
781  return $this->typeOfDisplay(
782  WeeeDisplayConfig::DISPLAY_INCL_DESCR,
783  \Magento\Framework\Pricing\Render::ZONE_ITEM_VIEW,
784  $storeId
785  );
786  }
typeOfDisplay( $compareTo=null, $zone=\Magento\Framework\Pricing\Render::ZONE_DEFAULT, $store=null)
Definition: Data.php:243

◆ isEnabled()

isEnabled (   $store = null)

Check if fixed taxes are used in system

Parameters
null | string | bool | int | Store$store
Returns
bool

Definition at line 190 of file Data.php.

191  {
192  return $this->_weeeConfig->isEnabled($store);
193  }

◆ isTaxable()

isTaxable (   $store = null)

Check if weee tax amount should be taxable

Parameters
null | string | bool | int | Store$store
Returns
bool

Definition at line 168 of file Data.php.

169  {
170  return $this->_weeeConfig->isTaxable($store);
171  }

◆ setApplied()

setApplied (   $item,
  $value 
)

Sets applied weee taxes

Parameters
QuoteAbstractItem$item
array$value
Returns
$this

Definition at line 415 of file Data.php.

416  {
417  $item->setWeeeTaxApplied($this->serializer->serialize($value));
418  return $this;
419  }
$value
Definition: gender.phtml:16

◆ typeOfDisplay()

typeOfDisplay (   $compareTo = null,
  $zone = \Magento\Framework\Pricing\Render::ZONE_DEFAULT,
  $store = null 
)

Returns display type for price accordingly to current zone

Parameters
int|int[]|null$compareTo
string$zone
Store | int | string$store
Returns
bool|int @SuppressWarnings(PHPMD.CyclomaticComplexity)

Definition at line 243 of file Data.php.

247  {
248  if (!$this->isEnabled($store)) {
249  return false;
250  }
251  switch ($zone) {
252  case \Magento\Framework\Pricing\Render::ZONE_ITEM_VIEW:
253  $type = $this->getPriceDisplayType($store);
254  break;
255  case \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST:
257  break;
258  case \Magento\Framework\Pricing\Render::ZONE_SALES:
259  case \Magento\Framework\Pricing\Render::ZONE_CART:
261  break;
262  case \Magento\Framework\Pricing\Render::ZONE_EMAIL:
264  break;
265  default:
266  if ($this->_coreRegistry->registry('current_product')) {
267  $type = $this->getPriceDisplayType($store);
268  } else {
270  }
271  break;
272  }
273 
274  if ($compareTo === null) {
275  return $type;
276  } else {
277  if (is_array($compareTo)) {
278  return in_array($type, $compareTo);
279  } else {
280  return $type == $compareTo;
281  }
282  }
283  }
isEnabled($store=null)
Definition: Data.php:190
$type
Definition: item.phtml:13
getPriceDisplayType($store=null)
Definition: Data.php:124
getSalesPriceDisplayType($store=null)
Definition: Data.php:146
getEmailPriceDisplayType($store=null)
Definition: Data.php:157
getListPriceDisplayType($store=null)
Definition: Data.php:135

Field Documentation

◆ $_coreRegistry

$_coreRegistry
protected

Definition at line 53 of file Data.php.

◆ $_storeDisplayConfig

$_storeDisplayConfig = []
protected

#- #-

Definition at line 46 of file Data.php.

◆ $_storeManager

$_storeManager
protected

Definition at line 75 of file Data.php.

◆ $_taxData

$_taxData
protected

Definition at line 60 of file Data.php.

◆ $_weeeConfig

$_weeeConfig
protected

Definition at line 70 of file Data.php.

◆ $_weeeTax

$_weeeTax
protected

Definition at line 65 of file Data.php.

◆ $cacheProductWeeeAmount

$cacheProductWeeeAmount = '_cache_product_weee_amount'
protected

Definition at line 80 of file Data.php.

◆ KEY_BASE_WEEE_AMOUNT_INVOICED

const KEY_BASE_WEEE_AMOUNT_INVOICED = 'base_weee_amount_invoiced'

Definition at line 29 of file Data.php.

◆ KEY_BASE_WEEE_AMOUNT_REFUNDED

const KEY_BASE_WEEE_AMOUNT_REFUNDED = 'base_weee_amount_refunded'

Definition at line 37 of file Data.php.

◆ KEY_BASE_WEEE_TAX_AMOUNT_INVOICED

const KEY_BASE_WEEE_TAX_AMOUNT_INVOICED = 'base_weee_tax_amount_invoiced'

Definition at line 33 of file Data.php.

◆ KEY_BASE_WEEE_TAX_AMOUNT_REFUNDED

const KEY_BASE_WEEE_TAX_AMOUNT_REFUNDED = 'base_weee_tax_amount_refunded'

Definition at line 41 of file Data.php.

◆ KEY_WEEE_AMOUNT_INVOICED

const KEY_WEEE_AMOUNT_INVOICED = 'weee_amount_invoiced'

#+ Constants defined for keys of array, makes typos less likely

Definition at line 27 of file Data.php.

◆ KEY_WEEE_AMOUNT_REFUNDED

const KEY_WEEE_AMOUNT_REFUNDED = 'weee_amount_refunded'

Definition at line 35 of file Data.php.

◆ KEY_WEEE_TAX_AMOUNT_INVOICED

const KEY_WEEE_TAX_AMOUNT_INVOICED = 'weee_tax_amount_invoiced'

Definition at line 31 of file Data.php.

◆ KEY_WEEE_TAX_AMOUNT_REFUNDED

const KEY_WEEE_TAX_AMOUNT_REFUNDED = 'weee_tax_amount_refunded'

Definition at line 39 of file Data.php.


The documentation for this class was generated from the following file: