File tree Expand file tree Collapse file tree 3 files changed +8
-3
lines changed
app/code/Magento/Catalog/Test/Unit/Model
lib/internal/Magento/Framework/Model Expand file tree Collapse file tree 3 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -550,7 +550,7 @@ public function testGetCustomAttributes()
550
550
$ this ->assertEquals ("description " , $ this ->category ->getCustomAttribute ($ descriptionAttributeCode )->getValue ());
551
551
552
552
//Change the attribute value, should reflect in getCustomAttribute
553
- $ this ->category ->setData ($ descriptionAttributeCode , "new description " );
553
+ $ this ->category ->setCustomAttribute ($ descriptionAttributeCode , "new description " );
554
554
$ this ->assertEquals (1 , count ($ this ->category ->getCustomAttributes ()));
555
555
$ this ->assertNotNull ($ this ->category ->getCustomAttribute ($ descriptionAttributeCode ));
556
556
$ this ->assertEquals (
Original file line number Diff line number Diff line change @@ -1247,7 +1247,7 @@ public function testGetCustomAttributes()
1247
1247
$ this ->assertEquals ("red " , $ this ->model ->getCustomAttribute ($ colorAttributeCode )->getValue ());
1248
1248
1249
1249
//Change the attribute value, should reflect in getCustomAttribute
1250
- $ this ->model ->setData ($ colorAttributeCode , "blue " );
1250
+ $ this ->model ->setCustomAttribute ($ colorAttributeCode , "blue " );
1251
1251
$ this ->assertEquals (1 , count ($ this ->model ->getCustomAttributes ()));
1252
1252
$ this ->assertNotNull ($ this ->model ->getCustomAttribute ($ colorAttributeCode ));
1253
1253
$ this ->assertEquals ("blue " , $ this ->model ->getCustomAttribute ($ colorAttributeCode )->getValue ());
Original file line number Diff line number Diff line change @@ -113,7 +113,12 @@ protected function initializeCustomAttributes()
113
113
$ customAttributeCodes = $ this ->getCustomAttributesCodes ();
114
114
115
115
foreach ($ customAttributeCodes as $ customAttributeCode ) {
116
- if (isset ($ this ->_data [$ customAttributeCode ])) {
116
+ if (isset ($ this ->_data [self ::CUSTOM_ATTRIBUTES ][$ customAttributeCode ])) {
117
+ $ customAttribute = $ this ->customAttributeFactory ->create ()
118
+ ->setAttributeCode ($ customAttributeCode )
119
+ ->setValue ($ this ->_data [self ::CUSTOM_ATTRIBUTES ][$ customAttributeCode ]->getValue ());
120
+ $ customAttributes [$ customAttributeCode ] = $ customAttribute ;
121
+ } elseif (isset ($ this ->_data [$ customAttributeCode ])) {
117
122
$ customAttribute = $ this ->customAttributeFactory ->create ()
118
123
->setAttributeCode ($ customAttributeCode )
119
124
->setValue ($ this ->_data [$ customAttributeCode ]);
You can’t perform that action at this time.
0 commit comments