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.
- Enable filter (with result) done
- Category Is Anchor done
- Reindex done
- Enable Category flat done
- Enable Product flat done
- Reindex all data done
- Clear cache done
- Use magento clean doesn’t have any extension done
- Check with attribute color (done it show in navigation)
- Product Price Show
Category Show
about my system information
CentOS 7.0
- Litespeed
- Php7.0
- 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..