0

I am trying to get the admin values of an attribute from app/design/frontend/{package_name}/default/template/catalog/layer/filter.phtml. From this file I am able to get the attribute code (i.e., the admin label of the attribute) and $_item->getValue() only gives me the escaped current store value. I am able to get the admin value of an attribute for a specific product from app/design/frontend/{package_name}/default/template/catalog/view.phtml though:

$productAdminAttributeValue = $_product->getResource()->getAttribute('attribute_name')->setStoreId(Mage_Core_Model_App::ADMIN_STORE_ID)->getFrontend()->getValue($_product);

Thank you in advance.

0

To get all the values of an attribute:

<?php

  $attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'attribute_code'); 
  $allOptions = $attribute->getSource()->getAllOptions(true, true);
  foreach ($allOptions as $instance) {
      $id = $instance['value']; //id of the option
      $value = $instance['label']; //Label of the option
  }
?>

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.