Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $_product->getResource()->getAttribute($attributeCode)->getFrontend()->getValue($_product);
- $attribute_value = $_product->getData($attributeCode);
- $eavConfig = $this->objectManager->get('MagentoEavModelConfig');
- $attribute = $eavConfig->getAttribute('catalog_product', 'color');
- $alloptions = $attribute->getSource()->getAllOptions();
- foreach($alloptions as $option) {
- $label = $option['label'];
- $AllOptionsArr[$label][] = $option['value'];
- }
- $products = $this->_productRepository->get($sku);
- if(is_object($products->getCustomAttribute($attributeCode))){
- return $products->getCustomAttribute($attributeCode)->getValue();
- }
- <?php
- $objectManager = MagentoFrameworkAppObjectManager::getInstance();
- $atrributesRepository = $objectManager->create('MagentoCatalogModelProductAttributeRepository');
- $selectOptions = $atrributesRepository->get('AttributeCode')->getOptions();
- foreach ($selectOptions as $selectOption) {
- print_r($selectOption->getData());
- }
Add Comment
Please, Sign In to add comment