Magento adding attribute with option filterable (no results) through extension installation

Magento adding attribute with option filterable (no results) through extension installation

September 21, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento adding attribute with option filterable (no results) through extension installation

Resolving Magento Attribute Filterability Issues Through Extension Installation

As a senior Magento developer, I understand the challenge of configuring attributes with specific filter behavior during extension installation. In your case, you’re trying to set an attribute as “Filterable (no results)” using the installer file, but it’s not working as expected.

Understanding the Current Setup

In your provided code snippet, the filterable property is currently set to true, which means the attribute should be filterable with results. However, you want it to show up in layered navigation without actually displaying any results when filtered.

The issue lies in the fact that Magento’s core does not support the “Filterable (no results)” option directly through the installer file. The options available are “No” and “Filterable (with results)”.

Exploring Alternative Solutions

To achieve your desired behavior, we can’t rely solely on the filterable property in the installer file. Instead, let’s explore a two-step approach:

  1. Create the Attribute with Standard Behavior

    First, create the attribute as you currently have it, setting filterable to 0 for “No” or 1 for “Filterable (with results)”. This will ensure the attribute is added to your Magento instance.

  2. Manually Adjust the Navigation Settings

    After the attribute has been created, we need to manually override the layered navigation settings for this specific attribute. This involves editing the database directly or using a script to update the table where these settings are stored.

Updating Layered Navigation Settings

The settings for layered navigation are stored in the catalog_eav_attribute table. To set an attribute as “Filterable (no results)”, you need to update two columns:

  • is_filterable_in_search: Set this to 0
  • used_for_sort_by: Set this to 0

These changes effectively disable filtering for the attribute while still keeping it visible in layered navigation.

An Example Script for Updating Settings

Let’s assume your new attribute has an ID of 72. You can use a script like this to update its settings:

<?php
require_once Mage::getBaseDir() . '/includes/config.php';
$installer = new Mage_Catalog_Model_Resource_Eav_Mysql4 Setup('default_setup');
$installer->startSetup();
$attributeId = 72; // ID of your attribute

// Disable filtering in search and sort by
$sql = "UPDATE catalog_eav_attribute SET is_filterable_in_search=0, used_for_sort_by=0 WHERE attribute_id={$attributeId}";
$installer->getConnection()->query($sql);

$installer->endSetup();

This script first includes the Magento configuration file and then runs a direct SQL query to update the specified columns for your attribute ID.

Conclusion

In summary, while Magento’s core does not directly support the “Filterable (no results)” option through the installer file, you can achieve this behavior by creating the attribute with standard settings and then manually adjusting the layered navigation settings using a script or direct database updates.

Remember to backup your database before running any direct SQL queries. Also, consider implementing this logic within your extension’s setup script for a cleaner integration with Magento’s core processes.

If you need further assistance or have questions about extending Magento functionality through custom attributes and navigation settings, feel free to explore our comprehensive guides at Laravel Company.

Extensions Configuration Errors

Our network