File tree Expand file tree Collapse file tree 5 files changed +28
-7
lines changed
Catalog/Model/Product/Attribute
Controller/Adminhtml/Index
Test/Unit/Controller/Adminhtml/Index Expand file tree Collapse file tree 5 files changed +28
-7
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,17 @@ public function getItems($attributeCode)
40
40
*/
41
41
public function add ($ attributeCode , $ option )
42
42
{
43
+ /** @var \Magento\Eav\Api\Data\AttributeOptionInterface[] $currentOptions */
44
+ $ currentOptions = $ this ->getItems ($ attributeCode );
45
+ if (is_array ($ currentOptions )) {
46
+ array_walk ($ currentOptions , function (&$ attributeOption ) {
47
+ /** @var \Magento\Eav\Api\Data\AttributeOptionInterface $attributeOption */
48
+ $ attributeOption = $ attributeOption ->getLabel ();
49
+ });
50
+ if (in_array ($ option ->getLabel (), $ currentOptions )) {
51
+ return false ;
52
+ }
53
+ }
43
54
return $ this ->eavOptionManagement ->add (
44
55
\Magento \Catalog \Api \Data \ProductAttributeInterface::ENTITY_TYPE_CODE ,
45
56
$ attributeCode ,
Original file line number Diff line number Diff line change @@ -127,7 +127,10 @@ private function validateAclResource($dataProviderConfigData)
127
127
{
128
128
if (isset ($ dataProviderConfigData ['aclResource ' ])) {
129
129
if (!$ this ->_authorization ->isAllowed ($ dataProviderConfigData ['aclResource ' ])) {
130
- $ this ->_redirect ('admin/denied ' );
130
+ if (!$ this ->_request ->isAjax ()) {
131
+ $ this ->_redirect ('admin/denied ' );
132
+ }
133
+
131
134
return false ;
132
135
}
133
136
}
Original file line number Diff line number Diff line change @@ -279,6 +279,13 @@ public function testExecuteAjaxRequestWithoutPermissions(array $dataProviderConf
279
279
$ this ->requestMock ->expects ($ this ->any ())
280
280
->method ('getParams ' )
281
281
->willReturn ([]);
282
+ if ($ isAllowed === false ) {
283
+ $ this ->requestMock ->expects ($ this ->once ())
284
+ ->method ('isAjax ' )
285
+ ->willReturn (true );
286
+ }
287
+ $ this ->responseMock ->expects ($ this ->never ())
288
+ ->method ('setRedirect ' );
282
289
$ this ->responseMock ->expects ($ this ->any ())
283
290
->method ('appendBody ' )
284
291
->with ($ renderedData );
Original file line number Diff line number Diff line change 12
12
<width >140</width >
13
13
<height >140</height >
14
14
</image >
15
- <image id =" cart_cross_sell_products" type =" thumbnail " >
16
- <width >152 </width >
17
- <height >188 </height >
15
+ <image id =" cart_cross_sell_products" type =" small_image " >
16
+ <width >240 </width >
17
+ <height >300 </height >
18
18
</image >
19
19
<image id =" cart_page_product_thumbnail" type =" small_image" >
20
20
<width >110</width >
Original file line number Diff line number Diff line change 12
12
<width >140</width >
13
13
<height >140</height >
14
14
</image >
15
- <image id =" cart_cross_sell_products" type =" thumbnail " >
16
- <width >200 </width >
17
- <height >248 </height >
15
+ <image id =" cart_cross_sell_products" type =" small_image " >
16
+ <width >240 </width >
17
+ <height >300 </height >
18
18
</image >
19
19
<image id =" cart_page_product_thumbnail" type =" small_image" >
20
20
<width >165</width >
You can’t perform that action at this time.
0 commit comments