In the product list, I show the manufacturer and everything works fine. But when I make a search, instead of showing the manufacturer’s name it shows No. I use the following code to show the brands :


I'm using magento


Diagnosing your actual problem:

  • Ensure that the product collection used for search includes the manufacturer attribute or that the manufacturer attribute is set in the backend to display on the frontend (see screenshot below).
  • Ensure that the manufacturer attr is set for the appropriate store view! In the manage catalog product edit view, ensure that the dropdown is being set for the value of the store view, not the store/website/default view.
  • Make sure you're reindexed. If you're on CE, run the indexer manually. If on EE make sure your indexes are refreshed from cron or via $ php shell/indexer.php reindexall.
  • Clear all of your caches. Flush cache storage. rm -rf var/cache and all the destructive things. Check for the existance of a /tmp/magento folder.
  • Disable/enable flat catalog and reindex.

Enabling an attribute for frontend/product page/collection visibility:

enter image description here

Why this happens:

So, there is a valid reason why Magento returns "No" when there is no data available. The method getFrontend returns an object that is a subclass of Mage_Eav_Model_Entity_Attribute_Frontend_Abstract.

In the method getValue, if there are no options available / set, it defaults to output boolean. Thus, the value of "No" - which is the frontend boolean equivalent of false:

public function getValue(Varien_Object $object)
    $value = $object->getData($this->getAttribute()->getAttributeCode());
    if (in_array($this->getConfigField('input'), array('select','boolean'))) {
        $valueOption = $this->getOption($value);
        if (!$valueOption) {
            $opt     = Mage::getModel('eav/entity_attribute_source_boolean');

Once the above troubleshooting points are done - if you still receive "No" and it's an appropriate response (e.g. you have no manufacturer set on a product, and on purpose) you may want to conditionally test the output before echoing:

$value = $_product->getResource()->getAttribute('manufacturer')->getFrontend()->getValue($_product);
echo $value=="No" ? "" : $value;

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.