File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
app/code/Magento/CatalogSampleData/Model/Product Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,11 @@ class Converter
42
42
*/
43
43
protected $ attributeSetId ;
44
44
45
+ /**
46
+ * @var array
47
+ */
48
+ protected $ loadedAttributeSets ;
49
+
45
50
/**
46
51
* @var \Magento\Catalog\Model\ResourceModel\Product\Collection
47
52
*/
@@ -215,6 +220,14 @@ public function getAttributeOptions($attributeCode)
215
220
*/
216
221
protected function loadAttributeOptions ()
217
222
{
223
+ $ attributeSetIdCache = $ this ->getAttributeSetId ();
224
+ if (empty ($ attributeSetIdCache )) {
225
+ $ attributeSetIdCache = 0 ;
226
+ }
227
+ if (isset ($ this ->loadedAttributeSets [$ attributeSetIdCache ])) {
228
+ return $ this ;
229
+ }
230
+
218
231
/** @var \Magento\Catalog\Model\ResourceModel\Product\Attribute\Collection $collection */
219
232
$ collection = $ this ->attributeCollectionFactory ->create ();
220
233
$ collection ->addFieldToSelect (['attribute_code ' , 'attribute_id ' ]);
@@ -225,6 +238,7 @@ protected function loadAttributeOptions()
225
238
->setAttributeFilter ($ item ->getAttributeId ())->setPositionOrder ('asc ' , true )->load ();
226
239
$ this ->attributeCodeOptionsPair [$ item ->getAttributeCode ()] = $ options ;
227
240
}
241
+ $ this ->loadedAttributeSets [$ attributeSetIdCache ] = true ;
228
242
return $ this ;
229
243
}
230
244
You can’t perform that action at this time.
0 commit comments