0

How i can get value of field which is located in catalog_eav_attributes table? Help please

2 Answers 2

0

$this->attributeRepository->get('attribute')->getField()

0

Follow the following code.

  <?php
namespace Jesadiya\AttributeId\Model;

use Magento\Catalog\Model\Product;
use Magento\Eav\Api\AttributeRepositoryInterface;

class GetAttribute implements DataPatchInterface
{
    /**
     * @var AttributeRepositoryInterface
     */
    private $attributeRepository;

    public function __construct(
        AttributeRepositoryInterface $attributeRepository
    ) {         $this->attributeRepository = $attributeRepository;
    }

    public function getAttributeId()
    {
        $attribute = $this->attributeRepository->get(Product::ENTITY, 'sku');
        return $attribute->getAttributeId();
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.