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)
4040 */
4141 public function add ($ attributeCode , $ option )
4242 {
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+ }
4354 return $ this ->eavOptionManagement ->add (
4455 \Magento \Catalog \Api \Data \ProductAttributeInterface::ENTITY_TYPE_CODE ,
4556 $ attributeCode ,
Original file line number Diff line number Diff line change @@ -127,7 +127,10 @@ private function validateAclResource($dataProviderConfigData)
127127 {
128128 if (isset ($ dataProviderConfigData ['aclResource ' ])) {
129129 if (!$ this ->_authorization ->isAllowed ($ dataProviderConfigData ['aclResource ' ])) {
130- $ this ->_redirect ('admin/denied ' );
130+ if (!$ this ->_request ->isAjax ()) {
131+ $ this ->_redirect ('admin/denied ' );
132+ }
133+
131134 return false ;
132135 }
133136 }
Original file line number Diff line number Diff line change @@ -279,6 +279,13 @@ public function testExecuteAjaxRequestWithoutPermissions(array $dataProviderConf
279279 $ this ->requestMock ->expects ($ this ->any ())
280280 ->method ('getParams ' )
281281 ->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 ' );
282289 $ this ->responseMock ->expects ($ this ->any ())
283290 ->method ('appendBody ' )
284291 ->with ($ renderedData );
Original file line number Diff line number Diff line change 1212 <width >140</width >
1313 <height >140</height >
1414 </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 >
1818 </image >
1919 <image id =" cart_page_product_thumbnail" type =" small_image" >
2020 <width >110</width >
Original file line number Diff line number Diff line change 1212 <width >140</width >
1313 <height >140</height >
1414 </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 >
1818 </image >
1919 <image id =" cart_page_product_thumbnail" type =" small_image" >
2020 <width >165</width >
You can’t perform that action at this time.
0 commit comments