Skip to content

Commit 9e78b20

Browse files
author
Momotenko,Natalia(nmomotenko)
committed
Merge pull request #411 from magento-webdev/PR
[WebDev+Folks] Bugfixes + tasks
2 parents 197a6df + 4f4b0a4 commit 9e78b20

File tree

84 files changed

+1412
-1030
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+1412
-1030
lines changed
File renamed without changes.

app/code/Magento/Backend/view/adminhtml/layout/default.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
99
<head>
1010
<title>Magento Admin</title>
11-
<meta name="viewport" content="width=1024, initial-scale=1"/>
11+
<meta name="viewport" content="width=1024"/>
1212
<link src="requirejs/require.js"/>
1313
<css src="extjs/resources/css/ext-all.css"/>
1414
<css src="extjs/resources/css/ytheme-magento.css"/>

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class AdvancedPricing extends AbstractModifier
7474
/**
7575
* @var string
7676
*/
77-
protected $targetName = 'product_form.product_form';
77+
protected $scopeName;
7878

7979
/**
8080
* @var array
@@ -90,6 +90,7 @@ class AdvancedPricing extends AbstractModifier
9090
* @param ModuleManager $moduleManager
9191
* @param Data $directoryHelper
9292
* @param ArrayManager $arrayManager
93+
* @param string $scopeName
9394
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
9495
*/
9596
public function __construct(
@@ -100,7 +101,8 @@ public function __construct(
100101
SearchCriteriaBuilder $searchCriteriaBuilder,
101102
ModuleManager $moduleManager,
102103
Data $directoryHelper,
103-
ArrayManager $arrayManager
104+
ArrayManager $arrayManager,
105+
$scopeName = ''
104106
) {
105107
$this->locator = $locator;
106108
$this->storeManager = $storeManager;
@@ -110,6 +112,7 @@ public function __construct(
110112
$this->moduleManager = $moduleManager;
111113
$this->directoryHelper = $directoryHelper;
112114
$this->arrayManager = $arrayManager;
115+
$this->scopeName = $scopeName;
113116
}
114117

115118
/**
@@ -366,7 +369,7 @@ protected function addAdvancedPriceLink()
366369
'template' => 'ui/form/components/button/container',
367370
'actions' => [
368371
[
369-
'targetName' => $this->targetName . '.advanced_pricing_modal',
372+
'targetName' => $this->scopeName . '.advanced_pricing_modal',
370373
'actionName' => 'toggleModal',
371374
]
372375
],

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

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ class Related extends AbstractModifier
8383
*/
8484
protected $scopeName;
8585

86+
/**
87+
* @var string
88+
*/
89+
protected $scopePrefix;
90+
8691
/**
8792
* @param LocatorInterface $locator
8893
* @param UrlInterface $urlBuilder
@@ -92,6 +97,7 @@ class Related extends AbstractModifier
9297
* @param Status $status
9398
* @param AttributeSetRepositoryInterface $attributeSetRepository
9499
* @param string $scopeName
100+
* @param string $scopePrefix
95101
*/
96102
public function __construct(
97103
LocatorInterface $locator,
@@ -101,7 +107,8 @@ public function __construct(
101107
ImageHelper $imageHelper,
102108
Status $status,
103109
AttributeSetRepositoryInterface $attributeSetRepository,
104-
$scopeName = ''
110+
$scopeName = '',
111+
$scopePrefix = ''
105112
) {
106113
$this->locator = $locator;
107114
$this->urlBuilder = $urlBuilder;
@@ -111,6 +118,7 @@ public function __construct(
111118
$this->status = $status;
112119
$this->attributeSetRepository = $attributeSetRepository;
113120
$this->scopeName = $scopeName;
121+
$this->scopePrefix = $scopePrefix;
114122
}
115123

116124
/**
@@ -123,9 +131,9 @@ public function modifyMeta(array $meta)
123131
[
124132
static::GROUP_RELATED => [
125133
'children' => [
126-
static::DATA_SCOPE_RELATED => $this->getRelatedFieldset(),
127-
static::DATA_SCOPE_UPSELL => $this->getUpSellFieldset(),
128-
static::DATA_SCOPE_CROSSSELL => $this->getCrossSellFieldset(),
134+
$this->scopePrefix . static::DATA_SCOPE_RELATED => $this->getRelatedFieldset(),
135+
$this->scopePrefix . static::DATA_SCOPE_UPSELL => $this->getUpSellFieldset(),
136+
$this->scopePrefix . static::DATA_SCOPE_CROSSSELL => $this->getCrossSellFieldset(),
129137
],
130138
'arguments' => [
131139
'data' => [
@@ -228,13 +236,13 @@ protected function getRelatedFieldset()
228236
'button_set' => $this->getButtonSet(
229237
$content,
230238
__('Add Related Products'),
231-
static::DATA_SCOPE_RELATED
239+
$this->scopePrefix . static::DATA_SCOPE_RELATED
232240
),
233241
'modal' => $this->getGenericModal(
234242
__('Add Related Products'),
235-
static::DATA_SCOPE_RELATED
243+
$this->scopePrefix . static::DATA_SCOPE_RELATED
236244
),
237-
static::DATA_SCOPE_RELATED => $this->getGrid(static::DATA_SCOPE_RELATED),
245+
static::DATA_SCOPE_RELATED => $this->getGrid($this->scopePrefix . static::DATA_SCOPE_RELATED),
238246
],
239247
'arguments' => [
240248
'data' => [
@@ -268,13 +276,13 @@ protected function getUpSellFieldset()
268276
'button_set' => $this->getButtonSet(
269277
$content,
270278
__('Add Up-Sell Products'),
271-
static::DATA_SCOPE_UPSELL
279+
$this->scopePrefix . static::DATA_SCOPE_UPSELL
272280
),
273281
'modal' => $this->getGenericModal(
274282
__('Add Up-Sell Products'),
275-
static::DATA_SCOPE_UPSELL
283+
$this->scopePrefix . static::DATA_SCOPE_UPSELL
276284
),
277-
static::DATA_SCOPE_UPSELL => $this->getGrid(static::DATA_SCOPE_UPSELL),
285+
static::DATA_SCOPE_UPSELL => $this->getGrid($this->scopePrefix . static::DATA_SCOPE_UPSELL),
278286
],
279287
'arguments' => [
280288
'data' => [
@@ -308,13 +316,13 @@ protected function getCrossSellFieldset()
308316
'button_set' => $this->getButtonSet(
309317
$content,
310318
__('Add Cross-Sell Products'),
311-
static::DATA_SCOPE_CROSSSELL
319+
$this->scopePrefix . static::DATA_SCOPE_CROSSSELL
312320
),
313321
'modal' => $this->getGenericModal(
314322
__('Add Cross-Sell Products'),
315-
static::DATA_SCOPE_CROSSSELL
323+
$this->scopePrefix . static::DATA_SCOPE_CROSSSELL
316324
),
317-
static::DATA_SCOPE_CROSSSELL => $this->getGrid(static::DATA_SCOPE_CROSSSELL),
325+
static::DATA_SCOPE_CROSSSELL => $this->getGrid($this->scopePrefix . static::DATA_SCOPE_CROSSSELL),
318326
],
319327
'arguments' => [
320328
'data' => [

app/code/Magento/Catalog/etc/adminhtml/di.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,4 +154,9 @@
154154
<argument name="scopeName" xsi:type="string">product_form.product_form</argument>
155155
</arguments>
156156
</type>
157+
<type name="Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AdvancedPricing">
158+
<arguments>
159+
<argument name="scopeName" xsi:type="string">product_form.product_form</argument>
160+
</arguments>
161+
</type>
157162
</config>

app/code/Magento/CatalogRule/Model/Rule/Action/SimpleActionOptionsProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
namespace Magento\CatalogRule\Model\Rule\Action;
77

8-
class SimpleActionOptionsProvider
8+
class SimpleActionOptionsProvider implements \Magento\Framework\Data\OptionSourceInterface
99
{
1010
/**
1111
* @return array
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\CatalogRule\Model\Rule;
7+
8+
class CustomerGroupsOptionsProvider implements \Magento\Framework\Data\OptionSourceInterface
9+
{
10+
/**
11+
* @var \Magento\Customer\Api\GroupRepositoryInterface
12+
*/
13+
private $groupRepository;
14+
15+
/**
16+
* @var \Magento\Framework\Api\SearchCriteriaBuilder
17+
*/
18+
private $searchCriteriaBuilder;
19+
20+
/**
21+
* @var \Magento\Framework\Convert\DataObject
22+
*/
23+
private $objectConverter;
24+
25+
/**
26+
* @param \Magento\Customer\Api\GroupRepositoryInterface $groupRepository
27+
* @param \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder
28+
* @param \Magento\Framework\Convert\DataObject $objectConverter
29+
*/
30+
public function __construct(
31+
\Magento\Customer\Api\GroupRepositoryInterface $groupRepository,
32+
\Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder,
33+
\Magento\Framework\Convert\DataObject $objectConverter
34+
) {
35+
$this->groupRepository = $groupRepository;
36+
$this->searchCriteriaBuilder = $searchCriteriaBuilder;
37+
$this->objectConverter = $objectConverter;
38+
}
39+
40+
/**
41+
* @return array
42+
*/
43+
public function toOptionArray()
44+
{
45+
$customerGroups = $this->groupRepository->getList($this->searchCriteriaBuilder->create())->getItems();
46+
return $this->objectConverter->toOptionArray($customerGroups, 'id', 'code');
47+
}
48+
}

app/code/Magento/CatalogRule/Model/Rule/DataProvider.php

Lines changed: 0 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@
88
use Magento\CatalogRule\Model\ResourceModel\Rule\Collection;
99
use Magento\CatalogRule\Model\ResourceModel\Rule\CollectionFactory;
1010
use Magento\CatalogRule\Model\Rule;
11-
use Magento\Store\Model\System\Store;
12-
use Magento\Customer\Api\GroupRepositoryInterface;
13-
use Magento\Framework\Api\SearchCriteriaBuilder;
14-
use Magento\Framework\Convert\DataObject;
15-
use Magento\CatalogRule\Model\Rule\Action\SimpleActionOptionsProvider;
1611
use Magento\Framework\App\Request\DataPersistorInterface;
1712

1813
/**
@@ -31,31 +26,6 @@ class DataProvider extends \Magento\Ui\DataProvider\AbstractDataProvider
3126
*/
3227
protected $loadedData;
3328

34-
/**
35-
* @var Store
36-
*/
37-
protected $store;
38-
39-
/**
40-
* @var GroupRepositoryInterface
41-
*/
42-
protected $groupRepository;
43-
44-
/**
45-
* @var SearchCriteriaBuilder
46-
*/
47-
protected $searchCriteriaBuilder;
48-
49-
/**
50-
* @var DataObject
51-
*/
52-
protected $objectConverter;
53-
54-
/**
55-
* @var SimpleActionOptionsProvider
56-
*/
57-
protected $actionOptions;
58-
5929
/**
6030
* @var DataPersistorInterface
6131
*/
@@ -66,112 +36,24 @@ class DataProvider extends \Magento\Ui\DataProvider\AbstractDataProvider
6636
* @param string $primaryFieldName
6737
* @param string $requestFieldName
6838
* @param CollectionFactory $collectionFactory
69-
* @param Store $store
70-
* @param GroupRepositoryInterface $groupRepository
71-
* @param SearchCriteriaBuilder $searchCriteriaBuilder
72-
* @param DataObject $objectConverter
73-
* @param SimpleActionOptionsProvider $actionOptions
7439
* @param DataPersistorInterface $dataPersistor
7540
* @param array $meta
7641
* @param array $data
77-
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
7842
*/
7943
public function __construct(
8044
$name,
8145
$primaryFieldName,
8246
$requestFieldName,
8347
CollectionFactory $collectionFactory,
84-
Store $store,
85-
GroupRepositoryInterface $groupRepository,
86-
SearchCriteriaBuilder $searchCriteriaBuilder,
87-
DataObject $objectConverter,
88-
SimpleActionOptionsProvider $actionOptions,
8948
DataPersistorInterface $dataPersistor,
9049
array $meta = [],
9150
array $data = []
9251
) {
93-
$this->groupRepository = $groupRepository;
9452
$this->collection = $collectionFactory->create();
95-
$this->store = $store;
96-
$this->searchCriteriaBuilder = $searchCriteriaBuilder;
97-
$this->objectConverter = $objectConverter;
98-
$this->actionOptions = $actionOptions;
9953
$this->dataPersistor = $dataPersistor;
100-
101-
$meta = array_replace_recursive($meta, $this->getMetadata());
10254
parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);
10355
}
10456

105-
/**
106-
* @return array
107-
*/
108-
protected function getMetadata()
109-
{
110-
$customerGroups = $this->groupRepository->getList($this->searchCriteriaBuilder->create())->getItems();
111-
112-
return [
113-
'rule_information' => [
114-
'children' => [
115-
'website_ids' => [
116-
'arguments' => [
117-
'data' => [
118-
'config' => [
119-
'options' => $this->store->getWebsiteValuesForForm(),
120-
],
121-
],
122-
],
123-
],
124-
'is_active' => [
125-
'arguments' => [
126-
'data' => [
127-
'config' => [
128-
'options' => [
129-
['label' => __('Active'), 'value' => '1'],
130-
['label' => __('Inactive'), 'value' => '0']
131-
],
132-
],
133-
],
134-
],
135-
],
136-
'customer_group_ids' => [
137-
'arguments' => [
138-
'data' => [
139-
'config' => [
140-
'options' => $this->objectConverter->toOptionArray($customerGroups, 'id', 'code'),
141-
],
142-
],
143-
],
144-
]
145-
]
146-
],
147-
'actions' => [
148-
'children' => [
149-
'simple_action' => [
150-
'arguments' => [
151-
'data' => [
152-
'config' => [
153-
'options' => $this->actionOptions->toOptionArray()
154-
],
155-
],
156-
],
157-
],
158-
'stop_rules_processing' => [
159-
'arguments' => [
160-
'data' => [
161-
'config' => [
162-
'options' => [
163-
['label' => __('Yes'), 'value' => '1'],
164-
['label' => __('No'), 'value' => '0']
165-
]
166-
],
167-
],
168-
],
169-
],
170-
]
171-
]
172-
];
173-
}
174-
17557
/**
17658
* @return array
17759
*/

0 commit comments

Comments
 (0)