0

I want Dealer store view attribute value of product.

I have tried this

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$eavConfig = $objectManager->get('\Magento\Eav\Model\Config');
$attribute = $eavConfig->getAttribute('catalog_product', 'manufacturer');
$options = $attribute->getSource()->getAllOptions();

$optionsExists = array();

foreach($options as $option) {

    $optionsExists[] = $option['value'];
}

echo "<pre>"; print_r($optionsExists); die;

enter image description here

  • When you want this? What is the name and attribute code of that attribute? Can you also update what you have tried? – Sukumar Gorai Jan 3 at 12:16
  • You need to Dealer Store View means 10,20,30 etc but according to your code its returns only the value id not label. – Sukumar Gorai Jan 3 at 13:57
0

Try the below code instead of yours:

<?php
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$eavConfig = $objectManager->get('\Magento\Eav\Model\Config');
$attribute = $eavConfig->getAttribute('catalog_product', 'geslacht');
$attribute->setStoreId(1); // Add your store view ID of Dealer Store View. In my case its 1.
$options = $attribute->getSource()->getAllOptions();

$optionsExists = array();

foreach($options as $option) {

    $optionsExists[] = $option['label'];
}

echo "<pre>"; print_r($optionsExists);
?>

Hope this helps!

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

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