File tree Expand file tree Collapse file tree 5 files changed +26
-5
lines changed
Catalog/Model/Product/Attribute
design/adminhtml/Magento/backend/web/css/source/forms/fields Expand file tree Collapse file tree 5 files changed +26
-5
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 @@ -395,6 +395,10 @@ public function subscribe($email)
395395 {
396396 $ this ->loadByEmail ($ email );
397397
398+ if ($ this ->getId () && $ this ->getStatus () == self ::STATUS_SUBSCRIBED ) {
399+ return $ this ->getStatus ();
400+ }
401+
398402 if (!$ this ->getId ()) {
399403 $ this ->setSubscriberConfirmCode ($ this ->randomSequence ());
400404 }
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ public function readAllWebsites()
4747 ->select ()
4848 ->from ($ this ->getTable ('store_website ' ));
4949
50- foreach ($ this ->getConnection ()->fetchAll ($ select ) as $ websiteData ) {
50+ foreach ($ this ->getConnection ()->fetchAll ($ select ) as $ websiteData ) {
5151 $ websites [$ websiteData ['code ' ]] = $ websiteData ;
5252 }
5353
@@ -63,7 +63,7 @@ public function readAllWebsites()
6363 */
6464 protected function _beforeSave (\Magento \Framework \Model \AbstractModel $ object )
6565 {
66- if (!preg_match ('/^[a-z]+[a-z0-9_]*$/ ' , $ object ->getCode ())) {
66+ if (!preg_match ('/^[a-z]+[a-z0-9_]*$/i ' , $ object ->getCode ())) {
6767 throw new \Magento \Framework \Exception \LocalizedException (
6868 __ (
6969 'Website code may only contain letters (a-z), numbers (0-9) or underscore (_), '
Original file line number Diff line number Diff line change 1212use Magento \Framework \App \Http \Context ;
1313use Magento \Framework \App \ObjectManager ;
1414use Magento \Framework \App \ScopeInterface as AppScopeInterface ;
15- use Magento \Framework \Filesystem ;
1615use Magento \Framework \DataObject \IdentityInterface ;
17- use Magento \Framework \Url \ ScopeInterface as UrlScopeInterface ;
16+ use Magento \Framework \Filesystem ;
1817use Magento \Framework \Model \AbstractExtensibleModel ;
18+ use Magento \Framework \Url \ScopeInterface as UrlScopeInterface ;
1919use Magento \Framework \UrlInterface ;
2020use Magento \Store \Api \Data \StoreInterface ;
2121
@@ -459,7 +459,7 @@ protected function _getValidationRulesBeforeSave()
459459 $ storeLabelRule ->setMessage (__ ('Name is required ' ), \Zend_Validate_NotEmpty::IS_EMPTY );
460460 $ validator ->addRule ($ storeLabelRule , 'name ' );
461461
462- $ storeCodeRule = new \Zend_Validate_Regex ('/^[a-z]+[a-z0-9_]*$/ ' );
462+ $ storeCodeRule = new \Zend_Validate_Regex ('/^[a-z]+[a-z0-9_]*$/i ' );
463463 $ storeCodeRule ->setMessage (
464464 __ (
465465 'The store code may contain only letters (a-z), numbers (0-9) or underscore (_), '
Original file line number Diff line number Diff line change 122122 }
123123 }
124124
125+ td {
126+ .admin__field-control {
127+ position : relative ;
128+ }
129+ }
130+
125131 th {
126132 color : @color-very-dark-gray-black ;
127133 font-size : @font-size__base ;
You can’t perform that action at this time.
0 commit comments