Guest User

Untitled

a guest
Jun 21st, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. $_product->getResource()->getAttribute($attributeCode)->getFrontend()->getValue($_product);
  2.  
  3. $attribute_value = $_product->getData($attributeCode);
  4.  
  5. $eavConfig = $this->objectManager->get('MagentoEavModelConfig');
  6. $attribute = $eavConfig->getAttribute('catalog_product', 'color');
  7. $alloptions = $attribute->getSource()->getAllOptions();
  8. foreach($alloptions as $option) {
  9. $label = $option['label'];
  10. $AllOptionsArr[$label][] = $option['value'];
  11. }
  12.  
  13. $products = $this->_productRepository->get($sku);
  14. if(is_object($products->getCustomAttribute($attributeCode))){
  15. return $products->getCustomAttribute($attributeCode)->getValue();
  16. }
  17.  
  18. <?php
  19.  
  20. $objectManager = MagentoFrameworkAppObjectManager::getInstance();
  21. $atrributesRepository = $objectManager->create('MagentoCatalogModelProductAttributeRepository');
  22. $selectOptions = $atrributesRepository->get('AttributeCode')->getOptions();
  23. foreach ($selectOptions as $selectOption) {
  24. print_r($selectOption->getData());
  25. }
Add Comment
Please, Sign In to add comment