Skip to content

Commit a585ab5

Browse files
Merge branch 'MAGETWO-49457' of https://github.corp.magento.com/magento-tango/magento2ce into MAGETWO-49914-2
2 parents f8a9fa0 + 899c0c6 commit a585ab5

File tree

17 files changed

+115
-114
lines changed

17 files changed

+115
-114
lines changed

app/code/Magento/Bundle/Test/Unit/Ui/DataProvider/Product/Form/Modifier/BundleSkuTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
namespace Magento\Bundle\Test\Unit\Ui\DataProvider\Product\Form\Modifier;
77

88
use Magento\Bundle\Ui\DataProvider\Product\Form\Modifier\BundleSku;
9-
use Magento\Catalog\Model\AttributeConstantsInterface;
9+
use Magento\Catalog\Api\Data\ProductAttributeInterface;
1010

1111
/**
1212
* Class BundleSkuTest
@@ -31,7 +31,7 @@ public function testModifyMeta()
3131
$sourceMeta = [
3232
'testGroup' => [
3333
'children' => [
34-
AttributeConstantsInterface::CODE_SKU => [
34+
ProductAttributeInterface::CODE_SKU => [
3535
'componentType' => 'testComponent',
3636
],
3737
]

app/code/Magento/Bundle/Ui/DataProvider/Product/Form/Modifier/BundleAdvancedPricing.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
*/
66
namespace Magento\Bundle\Ui\DataProvider\Product\Form\Modifier;
77

8+
use Magento\Catalog\Api\Data\ProductAttributeInterface;
89
use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier;
9-
use Magento\Catalog\Model\AttributeConstantsInterface as Constants;
1010

1111
/**
1212
* Customize Advanced Pricing modal panel
@@ -32,13 +32,15 @@ public function modifyMeta(array $meta)
3232
unset($parentNode['container_' . self::CODE_MSRP]);
3333
unset($parentNode['container_' . self::CODE_MSRP_DISPLAY_ACTUAL_PRICE_TYPE]);
3434
}
35-
if (isset($parentNode['container_' . Constants::CODE_SPECIAL_PRICE])) {
36-
$currentNode = &$parentNode['container_' . Constants::CODE_SPECIAL_PRICE]['children'];
37-
$currentNode[Constants::CODE_SPECIAL_PRICE]['arguments']['data']['config']['addbefore'] = "%";
35+
if (isset($parentNode['container_' . ProductAttributeInterface::CODE_SPECIAL_PRICE])) {
36+
$currentNode = &$parentNode['container_' . ProductAttributeInterface::CODE_SPECIAL_PRICE]['children'];
37+
$currentNode[ProductAttributeInterface::CODE_SPECIAL_PRICE]['arguments']['data']['config']['addbefore']
38+
= "%";
3839
}
39-
$parentNodeChildren = &$parentNode[Constants::CODE_TIER_PRICE]['children'];
40-
if (isset( $parentNodeChildren[self::CODE_RECORD]['children'][Constants::CODE_PRICE])) {
41-
$currentNode = &$parentNodeChildren[self::CODE_RECORD]['children'][Constants::CODE_PRICE];
40+
$parentNodeChildren = &$parentNode[ProductAttributeInterface::CODE_TIER_PRICE]['children'];
41+
if (isset($parentNodeChildren[self::CODE_RECORD]['children'][ProductAttributeInterface::CODE_PRICE])) {
42+
$currentNode =
43+
&$parentNodeChildren[self::CODE_RECORD]['children'][ProductAttributeInterface::CODE_PRICE];
4244
$currentNode['arguments']['data']['config']['label'] = __('Percent Discount');
4345
}
4446
}

app/code/Magento/Bundle/Ui/DataProvider/Product/Form/Modifier/BundlePrice.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
*/
66
namespace Magento\Bundle\Ui\DataProvider\Product\Form\Modifier;
77

8+
use Magento\Catalog\Api\Data\ProductAttributeInterface;
89
use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier;
9-
use Magento\Catalog\Model\AttributeConstantsInterface;
1010
use Magento\Ui\Component\Form;
1111
use Magento\Framework\Stdlib\ArrayManager;
1212
use Magento\Catalog\Model\Locator\LocatorInterface;
@@ -49,11 +49,11 @@ public function __construct(
4949
*/
5050
public function modifyMeta(array $meta)
5151
{
52-
if ($groupCode = $this->getGroupCodeByField($meta, AttributeConstantsInterface::CODE_PRICE)
52+
if ($groupCode = $this->getGroupCodeByField($meta, ProductAttributeInterface::CODE_PRICE)
5353
?: $this->getGroupCodeByField($meta, self::CODE_GROUP_PRICE)
5454
) {
5555
$isNewProduct = ($this->locator->getProduct()->getId()) ? false : true;
56-
$pricePath = $this->getElementArrayPath($meta, AttributeConstantsInterface::CODE_PRICE)
56+
$pricePath = $this->getElementArrayPath($meta, ProductAttributeInterface::CODE_PRICE)
5757
?: $this->getElementArrayPath($meta, self::CODE_GROUP_PRICE);
5858

5959
$meta[$groupCode]['children'][self::CODE_PRICE_TYPE] = [
@@ -91,7 +91,7 @@ public function modifyMeta(array $meta)
9191
$meta[$groupCode]['children'][self::CODE_GROUP_PRICE],
9292
[
9393
'children' => [
94-
AttributeConstantsInterface::CODE_PRICE => [
94+
ProductAttributeInterface::CODE_PRICE => [
9595
'arguments' => [
9696
'data' => [
9797
'config' => [

app/code/Magento/Bundle/Ui/DataProvider/Product/Form/Modifier/BundleSku.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
*/
66
namespace Magento\Bundle\Ui\DataProvider\Product\Form\Modifier;
77

8+
use Magento\Catalog\Api\Data\ProductAttributeInterface;
89
use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier;
9-
use Magento\Catalog\Model\AttributeConstantsInterface;
1010
use Magento\Ui\Component\Form;
1111
use Magento\Framework\Stdlib\ArrayManager;
1212

@@ -36,15 +36,15 @@ public function __construct(ArrayManager $arrayManager)
3636
*/
3737
public function modifyMeta(array $meta)
3838
{
39-
if ($groupCode = $this->getGroupCodeByField($meta, AttributeConstantsInterface::CODE_SKU)) {
40-
$skuPath = $this->getElementArrayPath($meta, AttributeConstantsInterface::CODE_SKU);
39+
if ($groupCode = $this->getGroupCodeByField($meta, ProductAttributeInterface::CODE_SKU)) {
40+
$skuPath = $this->getElementArrayPath($meta, ProductAttributeInterface::CODE_SKU);
4141
$meta[$groupCode]['children'][self::CODE_SKU_TYPE] = [
4242
'arguments' => [
4343
'data' => [
4444
'config' => [
4545
'sortOrder' => $this->getNextAttributeSortOrder(
4646
$meta,
47-
[AttributeConstantsInterface::CODE_SKU],
47+
[ProductAttributeInterface::CODE_SKU],
4848
self::SORT_ORDER
4949
),
5050
'formElement' => Form\Element\Checkbox::NAME,

app/code/Magento/Bundle/Ui/DataProvider/Product/Form/Modifier/BundleWeight.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
*/
66
namespace Magento\Bundle\Ui\DataProvider\Product\Form\Modifier;
77

8+
use Magento\Catalog\Api\Data\ProductAttributeInterface;
89
use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier;
9-
use Magento\Catalog\Model\AttributeConstantsInterface;
1010
use Magento\Ui\Component\Form;
1111
use Magento\Framework\Stdlib\ArrayManager;
1212

@@ -37,10 +37,10 @@ public function __construct(ArrayManager $arrayManager)
3737
*/
3838
public function modifyMeta(array $meta)
3939
{
40-
if (($groupCode = $this->getGroupCodeByField($meta, AttributeConstantsInterface::CODE_WEIGHT)
40+
if (($groupCode = $this->getGroupCodeByField($meta, ProductAttributeInterface::CODE_WEIGHT)
4141
?: $this->getGroupCodeByField($meta, self::CODE_CONTAINER_WEIGHT))
4242
) {
43-
$weightPath = $this->getElementArrayPath($meta, AttributeConstantsInterface::CODE_WEIGHT)
43+
$weightPath = $this->getElementArrayPath($meta, ProductAttributeInterface::CODE_WEIGHT)
4444
?: $this->getElementArrayPath($meta, self::CODE_CONTAINER_WEIGHT);
4545
$meta[$groupCode]['children'][self::CODE_WEIGHT_TYPE] = [
4646
'arguments' => [
@@ -76,7 +76,7 @@ public function modifyMeta(array $meta)
7676
$meta[$groupCode]['children'][self::CODE_CONTAINER_WEIGHT],
7777
[
7878
'children' => [
79-
AttributeConstantsInterface::CODE_HAS_WEIGHT => [
79+
ProductAttributeInterface::CODE_HAS_WEIGHT => [
8080
'arguments' => [
8181
'data' => [
8282
'config' => [
@@ -93,7 +93,7 @@ public function modifyMeta(array $meta)
9393
$meta[$groupCode]['children'][self::CODE_CONTAINER_WEIGHT],
9494
[
9595
'children' => [
96-
AttributeConstantsInterface::CODE_WEIGHT => [
96+
ProductAttributeInterface::CODE_WEIGHT => [
9797
'arguments' => [
9898
'data' => [
9999
'config' => [

app/code/Magento/Catalog/Api/Data/ProductAttributeInterface.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,21 @@
1212
interface ProductAttributeInterface extends \Magento\Catalog\Api\Data\EavAttributeInterface
1313
{
1414
const ENTITY_TYPE_CODE = 'catalog_product';
15+
const CODE_TIER_PRICE_FIELD_PRICE = 'price';
16+
const CODE_HAS_WEIGHT = 'product_has_weight';
17+
const CODE_SPECIAL_PRICE = 'special_price';
18+
const CODE_PRICE = 'price';
19+
const CODE_TIER_PRICE_FIELD_PRICE_QTY = 'price_qty';
20+
const CODE_SHORT_DESCRIPTION = 'short_description';
21+
const CODE_SEO_FIELD_META_TITLE = 'meta_title';
22+
const CODE_STATUS = 'status';
23+
const CODE_NAME = 'name';
24+
const CODE_SKU = 'sku';
25+
const CODE_SEO_FIELD_META_KEYWORD = 'meta_keyword';
26+
const CODE_DESCRIPTION = 'description';
27+
const CODE_COST = 'cost';
28+
const CODE_SEO_FIELD_URL_KEY = 'url_key';
29+
const CODE_TIER_PRICE = 'tier_price';
30+
const CODE_SEO_FIELD_META_DESCRIPTION = 'meta_description';
31+
const CODE_WEIGHT = 'weight';
1532
}

app/code/Magento/Catalog/Model/AttributeConstantsInterface.php

Lines changed: 0 additions & 31 deletions
This file was deleted.

app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/GeneralTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66
namespace Magento\Catalog\Test\Unit\Ui\DataProvider\Product\Form\Modifier;
77

8-
use Magento\Catalog\Model\AttributeConstantsInterface;
98
use Magento\Catalog\Model\Product\Type;
109
use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\General;
1110

app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/ImagesTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
*/
66
namespace Magento\Catalog\Test\Unit\Ui\DataProvider\Product\Form\Modifier;
77

8+
use Magento\Catalog\Api\Data\ProductAttributeInterface;
89
use Magento\Catalog\Model\Product\Type;
9-
use Magento\Catalog\Model\AttributeConstantsInterface;
1010
use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\General;
1111

1212
/**
@@ -32,9 +32,9 @@ public function testModifyData()
3232
$data = [
3333
$modelId => [
3434
\Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\General::DATA_SOURCE_DEFAULT => [
35-
AttributeConstantsInterface::CODE_SKU => 'product_42',
36-
AttributeConstantsInterface::CODE_PRICE => '42.00',
37-
AttributeConstantsInterface::CODE_STATUS => '1',
35+
ProductAttributeInterface::CODE_SKU => 'product_42',
36+
ProductAttributeInterface::CODE_PRICE => '42.00',
37+
ProductAttributeInterface::CODE_STATUS => '1',
3838
\Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Images::CODE_MEDIA_GALLERY => [
3939
'images' => [
4040
[
@@ -55,9 +55,9 @@ public function testModifyData()
5555
$expectedData = [
5656
$modelId => [
5757
General::DATA_SOURCE_DEFAULT => [
58-
AttributeConstantsInterface::CODE_SKU => 'product_42',
59-
AttributeConstantsInterface::CODE_PRICE => '42.00',
60-
AttributeConstantsInterface::CODE_STATUS => '1',
58+
ProductAttributeInterface::CODE_SKU => 'product_42',
59+
ProductAttributeInterface::CODE_PRICE => '42.00',
60+
ProductAttributeInterface::CODE_STATUS => '1',
6161
]
6262
]
6363
];

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
*/
66
namespace Magento\Catalog\Ui\DataProvider\Product\Form\Modifier;
77

8+
use Magento\Catalog\Api\Data\ProductAttributeInterface;
89
use Magento\Catalog\Model\Locator\LocatorInterface;
9-
use Magento\Catalog\Model\AttributeConstantsInterface;
1010
use Magento\Directory\Helper\Data;
1111
use Magento\Store\Model\StoreManagerInterface;
1212
use Magento\Customer\Api\Data\GroupInterface;
@@ -128,9 +128,9 @@ public function modifyMeta(array $meta)
128128
{
129129
$this->meta = $meta;
130130

131-
$this->preparePriceFields(AttributeConstantsInterface::CODE_PRICE);
132-
$this->preparePriceFields(AttributeConstantsInterface::CODE_SPECIAL_PRICE);
133-
$this->preparePriceFields(AttributeConstantsInterface::CODE_COST);
131+
$this->preparePriceFields(ProductAttributeInterface::CODE_PRICE);
132+
$this->preparePriceFields(ProductAttributeInterface::CODE_SPECIAL_PRICE);
133+
$this->preparePriceFields(ProductAttributeInterface::CODE_COST);
134134
$this->specialPriceDataToInline();
135135
$this->customizeTierPrice();
136136

@@ -185,7 +185,7 @@ protected function preparePriceFields($fieldCode)
185185
*/
186186
protected function customizeTierPrice()
187187
{
188-
$tierPricePath = $this->getElementArrayPath($this->meta, AttributeConstantsInterface::CODE_TIER_PRICE);
188+
$tierPricePath = $this->getElementArrayPath($this->meta, ProductAttributeInterface::CODE_TIER_PRICE);
189189

190190
if ($tierPricePath) {
191191
$this->meta = $this->arrayManager->set(
@@ -195,7 +195,7 @@ protected function customizeTierPrice()
195195
);
196196
$this->meta = $this->arrayManager->set(
197197
$this->arrayManager->slicePath($tierPricePath, 0, -3)
198-
. '/' . AttributeConstantsInterface::CODE_TIER_PRICE,
198+
. '/' . ProductAttributeInterface::CODE_TIER_PRICE,
199199
$this->meta,
200200
$this->arrayManager->get($tierPricePath, $this->meta)
201201
);
@@ -246,7 +246,7 @@ protected function isScopeGlobal()
246246
{
247247
return $this->locator->getProduct()
248248
->getResource()
249-
->getAttribute(AttributeConstantsInterface::CODE_TIER_PRICE)
249+
->getAttribute(ProductAttributeInterface::CODE_TIER_PRICE)
250250
->isScopeGlobal();
251251
}
252252

@@ -358,7 +358,7 @@ protected function isAllowChangeWebsite()
358358
*/
359359
protected function addAdvancedPriceLink()
360360
{
361-
$pricePath = $this->getElementArrayPath($this->meta, AttributeConstantsInterface::CODE_PRICE);
361+
$pricePath = $this->getElementArrayPath($this->meta, ProductAttributeInterface::CODE_PRICE);
362362

363363
if ($pricePath) {
364364
$this->meta = $this->arrayManager->merge(
@@ -613,7 +613,7 @@ protected function customizeAdvancedPricing()
613613
];
614614

615615
$this->meta = $this->arrayManager->merge(
616-
$this->getElementArrayPath($this->meta, static::CONTAINER_PREFIX . AttributeConstantsInterface::CODE_PRICE),
616+
$this->getElementArrayPath($this->meta, static::CONTAINER_PREFIX . ProductAttributeInterface::CODE_PRICE),
617617
$this->meta,
618618
[
619619
'arguments' => [

0 commit comments

Comments
 (0)