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
4242 */
4343 protected $ attributeSetId ;
4444
45+ /**
46+ * @var array
47+ */
48+ protected $ loadedAttributeSets ;
49+
4550 /**
4651 * @var \Magento\Catalog\Model\ResourceModel\Product\Collection
4752 */
@@ -215,6 +220,14 @@ public function getAttributeOptions($attributeCode)
215220 */
216221 protected function loadAttributeOptions ()
217222 {
223+ $ attributeSetIdCache = $ this ->getAttributeSetId ();
224+ if (empty ($ attributeSetIdCache )) {
225+ $ attributeSetIdCache = 0 ;
226+ }
227+ if (isset ($ this ->loadedAttributeSets [$ attributeSetIdCache ])) {
228+ return $ this ;
229+ }
230+
218231 /** @var \Magento\Catalog\Model\ResourceModel\Product\Attribute\Collection $collection */
219232 $ collection = $ this ->attributeCollectionFactory ->create ();
220233 $ collection ->addFieldToSelect (['attribute_code ' , 'attribute_id ' ]);
@@ -225,6 +238,7 @@ protected function loadAttributeOptions()
225238 ->setAttributeFilter ($ item ->getAttributeId ())->setPositionOrder ('asc ' , true )->load ();
226239 $ this ->attributeCodeOptionsPair [$ item ->getAttributeCode ()] = $ options ;
227240 }
241+ $ this ->loadedAttributeSets [$ attributeSetIdCache ] = true ;
228242 return $ this ;
229243 }
230244
You can’t perform that action at this time.
0 commit comments