Skip to content
Advertisement

Magento 2 Attribute Not Show In Navigation

I have a problem when applying magento 2.1.9 to my project.

My attribute is ab_size

I have created that attribute with code blow.

$categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
        $entityTypeId = $categorySetup->getEntityTypeId(MagentoCatalogModelProduct::ENTITY);

        foreach ($singleAttributeCodes as $key => $label) {
            $categorySetup->removeAttribute($entityTypeId, $key);
            $categorySetup->addAttribute(
                $entityTypeId,
                $key,
                [
                    'type' => 'varchar',
                    'label' => $label,
                    'input' => 'select',
                    'required' => false,
                    'sort_order' => $sortOrder,
                    'visible' => true,
                    'user_defined' => true,
                    'global' => MagentoEavModelEntityAttributeScopedAttributeInterface::SCOPE_GLOBAL,
                    'filterable' => 0,
                    'visible_on_front' => true,
                    'used_in_product_listing' => true,
                    'group' => $group,
                    'apply_to' => 'simple,configurable,bundle,downloadable,grouped',
                ]
            );
        }

With config in the backend.

  1. Enable filter (with result) done
  2. Category Is Anchor done
  3. Reindex done
  4. Enable Category flat done
  5. Enable Product flat done
  6. Reindex all data done
  7. Clear cache done
  8. Use magento clean doesn’t have any extension done
  9. Check with attribute color (done it show in navigation)
  10. Product Price Show
  11. Category Show

    about my system information

  12. CentOS 7.0

  13. Litespeed
  14. Php7.0
  15. Magento CE 2.1.9

I have debugged that the product collection buckets return empty

I think that problem with creating attribute code, has anyone got the same problem.

Thank anyone have tips.

Advertisement

Answer

With select attribute we must use type of int..

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement