2

I had to change my multiselect attribute backend type from varchar to text because I needed to select over 100 items. On varchar it would only save about 50 selections.

Now this works great, and I can save as many selections as needed. The problem now is when I activate the attribute for layered navigation it won't display on frontend. Can anyone help me fix this?

1
  • I am facing the same issue. Did you find a way to fix this?
    – jony974
    May 20, 2020 at 6:12

2 Answers 2

3

My hunch is that it should work, but the problem might be that there are no attribute values found for your attribute for any product.
The varchar attribute values are saved in catalog_product_entity_varchar table and the text attribute values are saved in catalog_product_entity_text table.
You changed the attribute type, but I assume the values still remained in the _varchar table and Magento is looking in the _text table.
You should try to move the rows with attribute_id = your attribute id from _varchar to _text and then reindex.

4
  • Thanks Marius. I don't think this is the problem. I can display the attribute values on my product view page, but only experience a problem with layered navigation.
    – Rudy
    Aug 31, 2015 at 11:45
  • @Rudy. That is what actually makes me think that the problem IS what I suggested. In the product page load is called on the product model. This one looks in all the attribute value tables for any records with attribute_id in the allowed attributes and makes a UNION on all of them. In this case it is not important in which tables are the values stored. But the layered navigation looks in specific tables. Try as a proof of concept, to save a product or 2 and reindex. then see if at least one value appears in the layered navigation.
    – Marius
    Aug 31, 2015 at 11:48
  • I did save two products, reindexed, but no effect. When creating this attribute I changed varchar to text right away and before updating the attribute on any product. Can the data still be in varchar table in this case? I don't know how to check this in my database with PHPmyadmin.
    – Rudy
    Aug 31, 2015 at 13:11
  • I looked in my database. The data is saved in catalog_product_entity_text.
    – Rudy
    Aug 31, 2015 at 13:39
1

I was in the same situation with the multiselect attribute. They seem to be correctly populated in catalog_product_entity_text table but the attribute doesn't appear in layered navigation. Here is some info that may be helpful to others.

After some more debugging I found out that text backend_type will fail the checks in Mage_Catalog_Model_Resource_Eav_Attribute::isIndexable() and hence it will not be indexed for layered navigation. One workaround to make this input types indexable will be to rewrite this attribute resource model.

Or you can also override the getBackendTypeByInput($type) function in app/code/core/Mage/Eav/Model/Entity/Attribute.php and return the field = 'text' when case 'multiselect':. I believe this will make all multiselects to be the text type.

Also, in case you are not showing multiselect attribute in layered navigation and product listing page you will not have this issue when you change varchar to text. Make sure to set Use in Layered Navigation, Used in Product Listing, Used for Sorting in Product Listing to NO

Lastly, there are more details available in Vinai's answer here.

Another (not recommended) solution here will be to alter table and increase the varchar field length. See http://dev.mysql.com/doc/refman/5.0/en/char.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.