fond-of-impala/product-image-grouping-product-page-search

产品图像分组产品页面搜索模块。

1.3.0 2024-03-22 10:14 UTC

This package is not auto-updated.

Last update: 2024-09-20 15:46:35 UTC


README

CI license

此包将按名称分组图像集。示例

"groupedImages": {
  "setName1": [
    {
      "externalUrlSmall": "https:\/\/...",
      "externalUrlLarge": "https:\/\/...",
      "sortOrder": 5
    },
    {
      "externalUrlSmall": "https:\/\/...",
      "externalUrlLarge": "https:\/\/...",
      "sortOrder": 10
    },
    {
      "externalUrlSmall": "https:\/\/...",
      "externalUrlLarge": "https:\/\/...",
      "sortOrder": 15
    }
  ],
  "setName2": [
    {
      "externalUrlSmall": "https:\/\/...",
      "externalUrlLarge": "https:\/\/...",
      "sortOrder": 0
    }
  ]
}

安装

composer require fond-of-impala/product-image-grouping-product-page-search

用法

在 src/Pyz/Client/Catalog/CatalogDependencyProvider.php 中替换

use Spryker\Client\Catalog\Plugin\Elasticsearch\ResultFormatter\RawCatalogSearchResultFormatterPlugin;

use FondOfImpala\Client\ProductImageGroupingProductPageSearch\Plugin\Search\RawCatalogSearchResultFormatterPlugin

在 src/Pyz/Zed/ProductPageSearch/ProductPageSearchDependencyProvider.php 中

添加 $dataExpanderPlugins[ProductImageGroupingProductPageSearchConfig::PLUGIN_PRODUCT_IMAGE_GROUPED_PAGE_DATA] = new ProductImageGroupedPageDataLoaderExpanderPlugin();

$dataExpanderPlugins[ProductPageSearchConfig::PLUGIN_PRODUCT_IMAGE_PAGE_DATA] = new ProductImagePageDataLoaderExpanderPlugin();

        /**
        * @return array<\Spryker\Zed\ProductPageSearch\Dependency\Plugin\ProductPageDataExpanderInterface>
        */
        protected function getDataExpanderPlugins(): array
        {
            $dataExpanderPlugins = [];
            ...
            $dataExpanderPlugins[ProductPageSearchConfig::PLUGIN_PRODUCT_IMAGE_PAGE_DATA] = new ProductImagePageDataLoaderExpanderPlugin();
            $dataExpanderPlugins[ProductImageGroupingProductPageSearchConfig::PLUGIN_PRODUCT_IMAGE_GROUPED_PAGE_DATA] = new ProductImageGroupedPageDataLoaderExpanderPlugin();
            ...
            return $dataExpanderPlugins;
        }

之后

添加 new ProductImageGroupMapExpanderPlugin(),

new ProductImageMapExpanderPlugin(),

      /**
      * @return array<\Spryker\Zed\ProductPageSearchExtension\Dependency\Plugin\ProductAbstractMapExpanderPluginInterface>
      */
      protected function getProductAbstractMapExpanderPlugins(): array
      {
          return [
              ...
              new ProductImageMapExpanderPlugin(),
              new ProductImageGroupMapExpanderPlugin(),
              ...
          ];
      }