eugene-petrov/magento2-category-filter

Magento 2 分类筛选器

dev-main 2022-01-13 13:51 UTC

This package is auto-updated.

Last update: 2024-09-13 19:28:03 UTC


README

M2 Coding Standard M2 Mess Detector M2 PHPStan

ReadyToGo_CategoryFilter

任务:我们需要在产品列表页面上只显示添加到多个分类中的产品

要启用此模块,执行以下命令:

  • composer require eugene-petrov/magento2-category-filter 或如果上面的命令不起作用,则: composer config repositories.readyToGoCategoryFilter vcs git@github.com:eugene-petrov/magento2-category-filter.git
  • php bin/magento setup:upgrade
  • php bin/magento cache:clean

示例

前提条件:已安装 magento 示例数据

让我们假设我们正在一个像这样的分类页面上: img

我们需要一个筛选器来找出哪些产品(来自特定分类)正在进行促销(分配给促销分类)。 img_1

要实现这一点,让我们在 URL 中指定一个参数 cat_ids,并包含所需的分类 ID(或多个 ID),并观察结果: img_2

这就是全部内容。现在我们可以在这个实现的基础上构建一些东西。