Skip to content

Commit 3dae92d

Browse files
author
Yuri Kovsher
committed
Merge remote-tracking branch 'tango-ce/MAGETWO-49193' into MAGETWO-48913
2 parents 12e36c5 + 82f4aa1 commit 3dae92d

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,25 @@ protected function setupMetaProperties(ProductAttributeInterface $attribute)
472472
}
473473

474474
$meta = $this->addWysiwyg($attribute, $meta);
475+
$meta = $this->customizePriceAttribute($attribute, $meta);
476+
477+
return $meta;
478+
}
479+
480+
/**
481+
* Customize attribute that has price type
482+
*
483+
* @param ProductAttributeInterface $attribute
484+
* @param array $meta
485+
* @return array
486+
*/
487+
private function customizePriceAttribute(ProductAttributeInterface $attribute, array $meta)
488+
{
489+
if ($attribute->getFrontendInput() === 'price') {
490+
$meta['arguments']['data']['config']['addbefore'] = $this->locator->getStore()
491+
->getBaseCurrency()
492+
->getCurrencySymbol();
493+
}
475494

476495
return $meta;
477496
}

app/code/Magento/Ui/DataProvider/EavValidationRules.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ public function build(AbstractAttribute $attribute, array $data)
3535
if (!empty($data['arguments']['data']['config']['required'])) {
3636
$rules['required-entry'] = true;
3737
}
38+
if ($attribute->getFrontendInput() === 'price') {
39+
$rules['validate-zero-or-greater'] = true;
40+
}
41+
3842
$validation = $attribute->getValidateRules();
3943
if (!empty($validation)) {
4044
foreach ($validation as $type => $ruleName) {

0 commit comments

Comments
 (0)