I have create custom admin FORM and use 2 product attributes as field select option but in getting error.
"You cannot define a correlation name 'tdv' more than once"
If i have use single attribute in Form then it's working fine. Any idea how can it resolve ?
Here is my code:
static public function getOptionArray3()
{
$data_array=array();
$attributeCode = 'size';
$entityType = 'catalog_product';
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$attributeInfo = $objectManager->create(\Magento\Eav\Model\Entity\Attribute::class)
->loadByCode($entityType, $attributeCode);
$attributeId = $attributeInfo->getAttributeId();
$attributeOptionAll = $objectManager->get(\Magento\Eav\Model\ResourceModel\Entity\Attribute\Option\Collection::class)
->setPositionOrder('asc')
->setAttributeFilter($attributeId)
->setStoreFilter()
->load();
foreach ($attributeOptionAll as $attributeOption) {
$data_array[$attributeOption->getOptionId()] = $attributeOption->getValue();
}
return($data_array);
}
static public function getOptionArray6()
{
$data_array=array();
$attributeCode = 'use_the_mattress';
$entityType = 'catalog_product';
$objectManager1 = \Magento\Framework\App\ObjectManager::getInstance();
$attributeInfo = $objectManager1->create(\Magento\Eav\Model\Entity\Attribute::class)
->loadByCode($entityType, $attributeCode);
$attributeId = $attributeInfo->getAttributeId();
$attributeOptionAll = $objectManager1->get(\Magento\Eav\Model\ResourceModel\Entity\Attribute\Option\Collection::class)
->setPositionOrder('asc')
->setAttributeFilter($attributeId)
->setStoreFilter()
->load();
foreach ($attributeOptionAll as $attributeOption) {
$data_array[$attributeOption->getOptionId()] = $attributeOption->getValue();
}
return($data_array);
}