creativestyle/magesuite-elasticsuite-virtual-category-indexer
Composer 安装命令:
composer require creativestyle/magesuite-elasticsuite-virtual-category-indexer
包简介
ElasticSuite Virtual Category Indexer
README 文档
README
Configuration
To enable virtual category indexer or change a cron schedule go to: Store > Configuration > MageSuite > Virtual Category Indexer > General
CLI Commmand
| Command | Description |
|---|---|
indexer:reindex elasticsuite_virtual_category_indexer |
Reindex all virtual categories. It reindex whole catalogsearch_category index |
magesuite:elasticsuite:virtual-category-products-relations:reindex [-s, --strategy [STRATEGY]] [-c , --ids [CATEGORY IDS]] |
Reindex virtual categories with strategy (full, list, category) |
magesuite:elasticsuite:virtual-category-products-relations:delete |
Cleanup/revert indexed virtual categories relations |
Cron
Full reindexation is runing automaticaly by cron schedule.
Important module classes
| Class | Responsibility |
|---|---|
| MageSuite\ElasticsuiteVirtualCategoryIndexer\Model\Indexer\VirtualCategoryIndexer | Insert product ids into the table catalog_category_product and refresh catalog and elasticsuite indexes |
| MageSuite\ElasticsuiteVirtualCategoryIndexer\Model\ElasticsuiteVirtualCategory\Model\Preview | Allow to get raw data from from response from elasticsearch using getRawData() method |
| MageSuite\ElasticsuiteVirtualCategoryIndexer\Model\Catalog\ResourceModel\CategoryProduct | Extension Class for Magento\Catalog\Model\ResourceModel\CategoryProduct. Allow to insert product ids for a virtual category into the table catalog_category_product and get theirs ids for other operations |
| MageSuite\ElasticsuiteVirtualCategoryIndexer\Model\ResourceModel\CategoryProductRelations | Resource Model which provide the method to delete category ids from the table catalog_category_product. |
| MageSuite\ElasticsuiteVirtualCategoryIndexer\Plugin\Catalog\Category\ReindexOnChange | Plugin which is call before runing the reindex method on category model and causes run virtual category indexer |
| MageSuite\ElasticsuiteVirtualCategoryIndexer\Plugin\ElasticsuiteVirtualCategory\Model\Rule\GetCategorySearchQuery | Plugin which change value of is_virtual_category attribute to null . It force sending standard category request to elasticsearch instead of depends of the attribute value. |
Extension attribute
Module provide the extension attribute virtual_query to modify request to elasticsaerch using the plugin.
If it has true smile works standardly. False value remove virtual query request.
See: \Smile\ElasticsuiteVirtualCategory\Model\Rule::getCategorySearchQuery
public function getCategorySearchQuery($category, $excludedCategories = []): ?QueryInterface { $query = null; if (!is_object($category)) { $category = $this->categoryFactory->create()->setStoreId($this->getStoreId())->load($category); } if (!in_array($category->getId(), $excludedCategories)) { $excludedCategories[] = $category->getId(); if ((bool) $category->getIsVirtualCategory() && $category->getIsActive()) { $query = $this->getVirtualCategoryQuery($category, $excludedCategories, $category->getData('virtual_category_root')); } elseif ($category->getId() && $category->getIsActive()) { $query = $this->getStandardCategoryQuery($category, $excludedCategories); } if ($query && $category->hasChildren()) { $query = $this->addChildrenQueries($query, $category, $excludedCategories); } } return $query; }
EAV attribute
Module install a new category attribute virtual_category_reindex_required. If this attribute has value=1 smile works standardly.
Troubleshooting and todo in the future
When change root category of virtual category, previous products still are in the category
To remove product from categories run full reindexation.
After turn on module, virtual category does not display products anymore
If you see products on the preview in admin area:
it seems that ES is able to return the right product IDs in the indexer.
Make sure that the script provides the right category object here:
vendor/creativestyle/magesuite-elasticsuite-virtual-category-indexer/Model/Indexer/VirtualCategoryIndexer.php:150
should be the same as here:
vendor/creativestyle/magesuite-elasticsuite-virtual-category-indexer/Controller/Adminhtml/Category/Virtual/Preview.php:67
creativestyle/magesuite-elasticsuite-virtual-category-indexer 适用场景与选型建议
creativestyle/magesuite-elasticsuite-virtual-category-indexer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 17.28k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2021 年 07 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 creativestyle/magesuite-elasticsuite-virtual-category-indexer 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 creativestyle/magesuite-elasticsuite-virtual-category-indexer 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 17.28k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 35
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: OSL-3.0
- 更新时间: 2021-07-16



