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

Product Image Grouping Product Page Search module.

1.3.0 2024-03-22 10:14 UTC

This package is not auto-updated.

Last update: 2024-12-13 16:50:53 UTC


README

CI license

This package will group the image sets by name. Example:

"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
    }
  ]
}

Installation

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

Usage

In src/Pyz/Client/Catalog/CatalogDependencyProvider.php replace

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

with

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

In src/Pyz/Zed/ProductPageSearch/ProductPageSearchDependencyProvider.php

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

after

$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;
        }

add

new ProductImageGroupMapExpanderPlugin(),

after

new ProductImageMapExpanderPlugin(),

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