27 $attributes[
'quote_item_row_total'] =
__(
'Row total in cart');
29 $attributes[
'parent::category_ids'] =
__(
'Category (Parent only)');
30 $attributes[
'children::category_ids'] =
__(
'Category (Children Only)');
53 if ($this->getAttributeScope()) {
64 $productAttributes = $this->_productResource->loadAllAttributes()->getAttributesByCode();
70 || !
$attribute->getDataUsingMethod($this->_isUsedForRuleProperty)
93 $html = parent::getAttributeElementHtml() .
94 $this->getAttributeScopeElement()->getHtml();
103 private function getAttributeScopeElement()
105 return $this->
getForm()->addField(
106 $this->getPrefix() .
'__' . $this->
getId() .
'__attribute_scope',
109 'name' => $this->elementName .
'[' . $this->getPrefix() .
'][' . $this->
getId() .
'][attribute_scope]',
110 'value' => $this->getAttributeScope(),
113 'data-form-part' => $this->getFormName()
125 if (strpos(
$value,
'::') !==
false) {
127 $this->
setData(
'attribute_scope', $scope);
139 parent::loadArray($arr);
140 $this->setAttributeScope(isset($arr[
'attribute_scope']) ? $arr[
'attribute_scope'] :
null);
147 public function asArray(array $arrAttributes = [])
149 $out = parent::asArray($arrAttributes);
150 $out[
'attribute_scope'] = $this->getAttributeScope();
166 $product = $this->productRepository->getById(
$model->getProductId());
171 )->setQuoteItemPrice(
173 )->setQuoteItemRowTotal(
179 if ($attrCode ===
'category_ids') {
183 if ($attrCode ===
'quote_item_price') {
185 if (in_array($this->getOperator(), $numericOperations)) {
204 $url =
'sales_rule/promo_widget/chooser/attribute/' . $this->
getAttribute();
205 if ($this->getJsFormObject()) {
206 $url .=
'/form/' . $this->getJsFormObject();
212 return $url !==
false ? $this->_backendData->getUrl(
$url) :
'';
221 private function getFormattedPrice(
$value)
228 $separatorComa = strpos(
$value,
',');
229 $separatorDot = strpos(
$value,
'.');
230 if ($separatorComa !==
false && $separatorDot ===
false && preg_match(
'/,\d{3}$/m',
$value) === 1) {
233 return $this->_localeFormat->getNumber(
$value);
validateAttribute($validatedValue)
getData($key='', $index=null)
getDefaultOperatorInputByType()
getAttributeElementHtml()
validate(\Magento\Framework\Model\AbstractModel $model)
getValueElementChooserUrl()
_getAvailableInCategories($productId)
setData($key, $value=null)
_addSpecialAttributes(array &$attributes)
asArray(array $arrAttributes=[])