|
| __construct (\Magento\Directory\Model\CurrencyFactory $currencyFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Helper\Data $catalogData, \Magento\Framework\App\Config\ScopeConfigInterface $config, \Magento\Framework\Locale\FormatInterface $localeFormat, \Magento\Catalog\Model\Product\Type $catalogProductType, \Magento\Customer\Api\GroupManagementInterface $groupManagement, \Magento\Catalog\Model\ResourceModel\Product\Attribute\Backend\Tierprice $productAttributeTierprice, ScopeOverriddenValue $scopeOverriddenValue=null) |
|
| isScalar () |
|
| validate ($object) |
|
| __construct (\Magento\Directory\Model\CurrencyFactory $currencyFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Helper\Data $catalogData, \Magento\Framework\App\Config\ScopeConfigInterface $config, \Magento\Framework\Locale\FormatInterface $localeFormat, \Magento\Catalog\Model\Product\Type $catalogProductType, GroupManagementInterface $groupManagement, ScopeOverriddenValue $scopeOverriddenValue=null) |
|
| validate ($object) |
|
| preparePriceData (array $priceData, $productTypeId, $websiteId) |
|
| afterLoad ($object) |
|
| setPriceData ($object, $priceData) |
|
| afterSave ($object) |
|
| getAffectedFields ($object) |
|
| getResource () |
|
| __construct (\Magento\Directory\Model\CurrencyFactory $currencyFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Helper\Data $catalogData, \Magento\Framework\App\Config\ScopeConfigInterface $config, \Magento\Framework\Locale\FormatInterface $localeFormat, ScopeOverriddenValue $scopeOverriddenValue=null) |
|
| setAttribute ($attribute) |
|
| setScope ($attribute) |
|
| validate ($object) |
|
| setAttribute ($attribute) |
|
| getAttribute () |
|
| getType () |
|
| isStatic () |
|
| getTable () |
|
| getEntityIdField () |
|
| setValueId ($valueId) |
|
| setEntityValueId ($entity, $valueId) |
|
| getValueId () |
|
| getEntityValueId ($entity) |
|
| getDefaultValue () |
|
| validate ($object) |
|
| afterLoad ($object) |
|
| beforeSave ($object) |
|
| afterSave ($object) |
|
| beforeDelete ($object) |
|
| afterDelete ($object) |
|
| getAffectedFields ($object) |
|
| isScalar () |
|
Definition at line 16 of file Tierprice.php.
◆ __construct()
- Parameters
-
\Magento\Directory\Model\CurrencyFactory | $currencyFactory | |
\Magento\Store\Model\StoreManagerInterface | $storeManager | |
\Magento\Catalog\Helper\Data | $catalogData | |
\Magento\Framework\App\Config\ScopeConfigInterface | $config | |
\Magento\Framework\Locale\FormatInterface | $localeFormat | |
\Magento\Catalog\Model\Product\Type | $catalogProductType | |
\Magento\Customer\Api\GroupManagementInterface | $groupManagement | |
\Magento\Catalog\Model\ResourceModel\Product\Attribute\Backend\Tierprice | $productAttributeTierprice | |
ScopeOverriddenValue | null | $scopeOverriddenValue | |
Definition at line 36 of file Tierprice.php.
47 $this->_productAttributeBackendTierprice = $productAttributeTierprice;
◆ _getAdditionalUniqueFields()
_getAdditionalUniqueFields |
( |
|
$objectArray | ) |
|
|
protected |
Add price qty to unique fields
- Parameters
-
- Returns
- array
Definition at line 76 of file Tierprice.php.
78 $uniqueFields = parent::_getAdditionalUniqueFields($objectArray);
79 $uniqueFields[
'qty'] = $objectArray[
'price_qty'] * 1;
◆ _getDuplicateErrorMessage()
_getDuplicateErrorMessage |
( |
| ) |
|
|
protected |
Error message when duplicates
- Returns
- \Magento\Framework\Phrase
Definition at line 100 of file Tierprice.php.
102 return __(
'We found a duplicate website, tier price, customer group and quantity.');
◆ _getResource()
Retrieve resource instance
- Returns
- \Magento\Catalog\Model\ResourceModel\Product\Attribute\Backend\Tierprice
Definition at line 65 of file Tierprice.php.
$_productAttributeBackendTierprice
◆ _isPriceFixed()
_isPriceFixed |
( |
|
$priceObject | ) |
|
|
protected |
Whether tier price value fixed or percent of original price
- Parameters
-
\Magento\Catalog\Model\Product\Type\Price | $priceObject | |
- Returns
- bool
Definition at line 111 of file Tierprice.php.
113 return $priceObject->isTierPriceFixed();
◆ getAdditionalFields()
getAdditionalFields |
( |
|
$objectArray | ) |
|
|
protected |
Definition at line 86 of file Tierprice.php.
88 $percentageValue = $this->getPercentage($objectArray);
90 'value' => $percentageValue ? null : $objectArray[
'price'],
91 'percentage_value' => $percentageValue ?:
null,
◆ isScalar()
By default attribute value is considered non-scalar that can be stored in a generic way
- Returns
- bool
Implements BackendInterface.
Definition at line 121 of file Tierprice.php.
◆ modifyPriceData()
modifyPriceData |
( |
|
$object, |
|
|
|
$data |
|
) |
| |
|
protected |
Definition at line 160 of file Tierprice.php.
162 $data = parent::modifyPriceData($object,
$data);
163 $price = $object->getPrice();
164 foreach (
$data as $key => $tierPrice) {
165 $percentageValue = $this->getPercentage($tierPrice);
166 if ($percentageValue) {
167 $data[$key][
'price'] =
$price * (1 - $percentageValue / 100);
168 $data[$key][
'website_price'] =
$data[$key][
'price'];
◆ updateValues()
updateValues |
( |
array |
$valuesToUpdate, |
|
|
array |
$oldValues |
|
) |
| |
|
protected |
- Parameters
-
array | $valuesToUpdate | |
array | $oldValues | |
- Returns
- boolean
Definition at line 179 of file Tierprice.php.
182 foreach ($valuesToUpdate as $key =>
$value) {
183 if ((!empty(
$value[
'value']) && $oldValues[$key][
'price'] !=
$value[
'value'])
184 || $this->getPercentage($oldValues[$key]) != $this->getPercentage(
$value)
186 $price = new \Magento\Framework\DataObject(
188 'value_id' => $oldValues[$key][
'price_id'],
189 'value' =>
$value[
'value'],
190 'percentage_value' => $this->getPercentage(
$value)
◆ validate()
Definition at line 129 of file Tierprice.php.
132 $priceRows = $object->getData(
$attribute->getName());
133 $priceRows = array_filter((array)$priceRows);
135 foreach ($priceRows as $priceRow) {
136 $percentage = $this->getPercentage($priceRow);
137 if ($percentage !==
null && (!$this->
isPositiveOrZero($percentage) || $percentage > 100)) {
138 throw new \Magento\Framework\Exception\LocalizedException(
139 __(
'Percentage value must be a number between 0 and 100.')
144 return parent::validate($object);
◆ validatePrice()
validatePrice |
( |
array |
$priceRow | ) |
|
|
protected |
Definition at line 150 of file Tierprice.php.
152 if (!$this->getPercentage($priceRow)) {
153 parent::validatePrice($priceRow);
◆ $_productAttributeBackendTierprice
$_productAttributeBackendTierprice |
|
protected |
The documentation for this class was generated from the following file:
- vendor/magento/module-catalog/Model/Product/Attribute/Backend/Tierprice.php