将magento 2.1.9应用到我的项目时出现问题。Magento 2.1.9属性在导航中不显示。
我的属性是ab_size
我已创建了代码打击该属性。
$categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
$entityTypeId = $categorySetup->getEntityTypeId(\Magento\Catalog\Model\Product::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' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL,
'filterable' => 0,
'visible_on_front' => true,
'used_in_product_listing' => true,
'group' => $group,
'apply_to' => 'simple,configurable,bundle,downloadable,grouped',
]
);
}
在后端配置。
- 启用过滤器(带结果)做
- 类是锚做
- 重新编制做
- 启用范畴平做
- 启用产品平做
- 个编制所有数据做
- 清除缓存做
- 使用的Magento干净没有任何扩展做
- 请与属性颜色(做了导航显示)
- 产品价格显示
类别显示
我的系统信息
的CentOS 7.0
- 的Litespeed
- Php7.0
- Magento的CE 2.1.9
我已经调试了产品收集桶返回空
我认为创建属性代码的问题,有任何人都有同样的问题。
谢谢任何人有提示。