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

Public Member Functions

 __construct (LocatorInterface $locator, MsrpConfig $msrpConfig, ArrayManager $arrayManager)
 
 modifyData (array $data)
 
 modifyMeta (array $meta)
 

Data Fields

const FIELD_MSRP = 'msrp'
 
const FIELD_MSRP_DISPLAY_ACTUAL_PRICE = 'msrp_display_actual_price_type'
 
- Data Fields inherited from AbstractModifier
const FORM_NAME = 'product_form'
 
const DATA_SOURCE_DEFAULT = 'product'
 
const DATA_SCOPE_PRODUCT = 'data.product'
 
const DEFAULT_GENERAL_PANEL = 'product-details'
 
const GENERAL_PANEL_ORDER = 10
 
const CONTAINER_PREFIX = 'container_'
 
const META_CONFIG_PATH = '/arguments/data/config'
 

Protected Member Functions

 customizeMsrp ()
 
 customizeMsrpDisplayActualPrice ()
 
- Protected Member Functions inherited from AbstractModifier
 getNextGroupSortOrder (array $meta, $groupCodes, $defaultSortOrder, $iteration=1)
 
 getNextAttributeSortOrder (array $meta, $attributeCodes, $defaultSortOrder, $iteration=1)
 
 startsWith ($haystack, $needle)
 
 getGeneralPanelName (array $meta)
 
 getFirstPanelCode (array $meta)
 
 getGroupCodeByField (array $meta, $field)
 
 formatPrice ($value)
 
 formatWeight ($value)
 

Protected Attributes

 $locator
 
 $msrpConfig
 
 $arrayManager
 
 $data = []
 
 $meta = []
 

Detailed Description

Class Msrp

Definition at line 16 of file Msrp.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( LocatorInterface  $locator,
MsrpConfig  $msrpConfig,
ArrayManager  $arrayManager 
)
Parameters
LocatorInterface$locator
MsrpConfig$msrpConfig
ArrayManager$arrayManager

Definition at line 53 of file Msrp.php.

Member Function Documentation

◆ customizeMsrp()

customizeMsrp ( )
protected

Customize msrp field

Returns
$this

Definition at line 89 of file Msrp.php.

90  {
91  $msrpPath = $this->arrayManager->findPath(static::FIELD_MSRP, $this->meta, null, 'children');
92 
93  if ($msrpPath) {
94  if ($this->msrpConfig->isEnabled()) {
95  $this->meta = $this->arrayManager->merge(
96  $msrpPath . '/arguments/data/config',
97  $this->meta,
98  [
99  'addbefore' => $this->locator->getStore()->getBaseCurrency()->getCurrencySymbol(),
100  'validation' => ['validate-zero-or-greater' => true],
101  ]
102  );
103  } else {
104  $this->meta = $this->arrayManager->remove(
105  $this->arrayManager->slicePath($msrpPath, 0, -2),
107  );
108  }
109  }
110 
111  return $this;
112  }

◆ customizeMsrpDisplayActualPrice()

customizeMsrpDisplayActualPrice ( )
protected

Customize msrp display actual price field

Returns
$this

Definition at line 119 of file Msrp.php.

120  {
121  $msrpDisplayPath = $this->arrayManager->findPath(
122  static::FIELD_MSRP_DISPLAY_ACTUAL_PRICE,
123  $this->meta,
124  null,
125  'children'
126  );
127 
128  if ($msrpDisplayPath) {
129  if (!$this->msrpConfig->isEnabled()) {
130  $this->meta = $this->arrayManager->remove(
131  $this->arrayManager->slicePath($msrpDisplayPath, 0, -2),
133  );
134  }
135  }
136 
137  return $this;
138  }

◆ modifyData()

modifyData ( array  $data)

{

Parameters
array$data
Returns
array
Since
100.1.0
}

Implements ModifierInterface.

Definition at line 66 of file Msrp.php.

◆ modifyMeta()

modifyMeta ( array  $meta)

{

Parameters
array$meta
Returns
array
Since
100.1.0
}

Implements ModifierInterface.

Definition at line 74 of file Msrp.php.

Field Documentation

◆ $arrayManager

$arrayManager
protected

Definition at line 36 of file Msrp.php.

◆ $data

$data = []
protected

Definition at line 41 of file Msrp.php.

◆ $locator

$locator
protected

#- #-

Definition at line 26 of file Msrp.php.

◆ $meta

$meta = []
protected

Definition at line 46 of file Msrp.php.

◆ $msrpConfig

$msrpConfig
protected

Definition at line 31 of file Msrp.php.

◆ FIELD_MSRP

const FIELD_MSRP = 'msrp'

#+ Field names

Definition at line 21 of file Msrp.php.

◆ FIELD_MSRP_DISPLAY_ACTUAL_PRICE

const FIELD_MSRP_DISPLAY_ACTUAL_PRICE = 'msrp_display_actual_price_type'

Definition at line 22 of file Msrp.php.


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