Search by

searchspring / magento2-module

searchspring

Package info

github.com/searchspring/magento2-module

Type:magento2-module

pkg:composer/searchspring/magento2-module

Statistics

Installs: 21 894

Dependents: 0

Suggesters: 0

Stars: 0

2.4.3 2026-04-28 08:21 UTC

README

Searchspring's Magento application can be installed on the Magento Marketplace here

Module Extensibility

Product Feed: Product Collection modification

The feed product collection is built by a modifier pipeline in SearchSpring\Feed\Model\Feed\CollectionProvider. Each modifier applies filters, joins or attribute selections to the product collection, in sortOrder:

Key Class sortOrder
store SearchSpring\Feed\Model\Feed\Collection\StoreModifier 100
status SearchSpring\Feed\Model\Feed\Collection\StatusModifier 200
visibility SearchSpring\Feed\Model\Feed\Collection\VisibilityModifier 300
stock SearchSpring\Feed\Model\Feed\Collection\StockModifier 400
attributes SearchSpring\Feed\Model\Feed\Collection\AttributesModifier 500
price SearchSpring\Feed\Model\Feed\Collection\PricesModifier 600

Creating a Custom Modifier

Step 1: Create the modifier class

namespace Vendor\Module\Model\Feed\Collection;

use Magento\Catalog\Model\ResourceModel\Product\Collection;
use SearchSpring\Feed\Api\Data\FeedSpecificationInterface;
use SearchSpring\Feed\Model\Feed\Collection\ModifierInterface;

class CustomVisibilityModifier implements ModifierInterface
{
    /**
     * @param Collection $collection
     * @param FeedSpecificationInterface $feedSpecification
     * @return Collection
     */
    public function modify(
        Collection $collection,
        FeedSpecificationInterface $feedSpecification
    ): Collection {
        $collection->addAttributeToFilter('visibility', ['neq' => 1]);
        return $collection;
    }
}

Step 2: Register the modifier in app/code/Vendor/Module/etc/di.xml, the sortOrder decides where it runs in the pipeline:

<type name="SearchSpring\Feed\Model\Feed\CollectionProvider">
    <arguments>
        <argument name="modifiers" xsi:type="array">
            <item name="custom_visibility" xsi:type="array">
                <item name="objectInstance" xsi:type="object">Vendor\Module\Model\Feed\Collection\CustomVisibilityModifier</item>
                <item name="sortOrder" xsi:type="number">350</item>
            </item>
        </argument>
    </arguments>
</type>

Overriding a Core Modifier

Use the key of the core modifier (see table above) to replace it, e.g. to replace the visibility filter:

<type name="SearchSpring\Feed\Model\Feed\CollectionProvider">
    <arguments>
        <argument name="modifiers" xsi:type="array">
            <item name="visibility" xsi:type="array">
                <item name="objectInstance" xsi:type="object">Vendor\Module\Model\Feed\Collection\CustomVisibilityModifier</item>
                <item name="sortOrder" xsi:type="number">300</item>
            </item>
        </argument>
    </arguments>
</type>

Add SearchSpring_Feed to the <sequence> of your etc/module.xml so your di.xml is merged after the module's one.

Each modifier, including custom ones, is logged in var/log/searchspring_feed.log as Collection modifier applied with its key, class and the collection SQL after it, see Feed generation logging.

Product Feed: Product Data Provider modification

Product feed data is generated by the data providers of SearchSpring\Feed\Model\Feed\DataProviderPool. Each data provider adds a part of the product row (price, stock, attributes, options, etc.) and receives the rows returned by the previous provider, in the order of the di.xml configuration.

Key Class
__all_attributes__ SearchSpring\Feed\Model\Feed\DataProvider\AttributesProvider
__configurable_child__ SearchSpring\Feed\Model\Feed\DataProvider\ConfigurableProductsProvider
__grouped_child__ SearchSpring\Feed\Model\Feed\DataProvider\GroupedProductsProvider
prices SearchSpring\Feed\Model\Feed\DataProvider\PricesProvider
stock SearchSpring\Feed\Model\Feed\DataProvider\StockProvider
saleable SearchSpring\Feed\Model\Feed\DataProvider\SaleableProvider
url SearchSpring\Feed\Model\Feed\DataProvider\UrlProvider
__rating__ SearchSpring\Feed\Model\Feed\DataProvider\RatingProvider
__categories__ SearchSpring\Feed\Model\Feed\DataProvider\CategoriesProvider
options SearchSpring\Feed\Model\Feed\DataProvider\OptionsProvider
__media_gallery__ SearchSpring\Feed\Model\Feed\DataProvider\MediaGalleryProvider
__json_config__ SearchSpring\Feed\Model\Feed\DataProvider\JsonConfigProvider
config_child_data SearchSpring\Feed\Model\Feed\DataProvider\ConfigurableChildProvider

A data provider is skipped when its key is in the ignoreFields of the feed task.

Creating a Custom Data Provider

Step 1: Create the provider class

namespace Vendor\Module\Model\Feed\DataProvider;

use SearchSpring\Feed\Api\Data\FeedSpecificationInterface;
use SearchSpring\Feed\Model\Feed\DataProviderInterface;

class CustomBadgeProvider implements DataProviderInterface
{
    /**
     * @param array $products
     * @param FeedSpecificationInterface $feedSpecification
     * @return array
     */
    public function getData(
        array $products,
        FeedSpecificationInterface $feedSpecification
    ): array {
        foreach ($products as &$product) {
            /** @var \Magento\Catalog\Model\Product|null $productModel */
            $productModel = $product['product_model'] ?? null;
            if (!$productModel) {
                continue;
            }
            $product['custom_badge'] = $productModel->getData('custom_badge');
        }

        return $products;
    }

    /**
     * Called before and after the feed generation, reset any state kept for the whole feed
     */
    public function reset(): void
    {
    }

    /**
     * Called after each page of products, reset any state kept for the current page
     */
    public function resetAfterFetchItems(): void
    {
    }
}

product_model is the loaded product of the feed collection, all product attributes except the task ignoreFields are selected by the attributes collection modifier. It is removed from the row before the row is written to the feed.

Step 2: Register the provider in app/code/Vendor/Module/etc/di.xml:

<type name="SearchSpring\Feed\Model\Feed\DataProviderPool">
    <arguments>
        <argument name="dataProviders" xsi:type="array">
            <item name="custom_badge_provider" xsi:type="object">Vendor\Module\Model\Feed\DataProvider\CustomBadgeProvider</item>
        </argument>
    </arguments>
</type>

Overriding a Core Data Provider

Use the key of the core data provider (see table above) to replace it, e.g. to replace the stock data:

<type name="SearchSpring\Feed\Model\Feed\DataProviderPool">
    <arguments>
        <argument name="dataProviders" xsi:type="array">
            <item name="stock" xsi:type="object">Vendor\Module\Model\Feed\DataProvider\CustomStockProvider</item>
        </argument>
    </arguments>
</type>

As for modifiers, add SearchSpring_Feed to the <sequence> of your etc/module.xml.

Data provider keys and classes, including custom ones, are logged per feed task in var/log/searchspring_feed.log together with their execution time, see Feed generation logging. Use the productinfo endpoint to check the output of a custom provider for a single product.

Debugging REST endpoints

All endpoints use the same integration token as the other /V1/searchspring/* endpoints.

Logs (SearchSpring_Feed::general)

Endpoint File
GET /rest/V1/searchspring/applicationlog/filter var/log/searchspring_feed.log
GET /rest/V1/searchspring/exceptionlog/filter var/log/exception.log
GET /rest/V1/searchspring/cronlog var/log/cron.log, only searchspring_task lines unless keyword is set

Unlike applicationlog / exceptionlog, these never return the whole file (max 10000 lines). Parameters, all optional:

  • lastLines (default 100) - lines from the end, ignored when startLine/endLine is set
  • startLine, endLine - 1-based range of the filtered result
  • keyword - case-sensitive plain string
  • startDate, endDate - e.g. 2026-10-01 or 2026-10-01T10:00:00; a plain endDate includes the whole day. Stack trace lines are kept with their log entry.
  • compressOutput - true returns content as base64url encoded gzdeflate instead of lines
GET /rest/V1/searchspring/applicationlog/filter?keyword=ERROR&startDate=2026-10-01&lastLines=200

Cron schedule (SearchSpring_Feed::general)

GET /rest/V1/searchspring/cron/status?status=error&startDate=2026-10-01&endDate=2026-10-02&currentPage=1&pageSize=50

Returns cron_schedule entries of the searchspring_task_execution job, latest first. All parameters are optional: status (pending, running, success, missed, error), startDate / endDate on scheduled_at in UTC (e.g. 2026-10-01 or 2026-10-01T10:00:00, a plain endDate includes the whole day), pageSize max 200.

Task errors (SearchSpring_Feed::task)

GET /rest/V1/searchspring/taskerrors?currentPage=1&pageSize=20&taskId=15

Returns the error of each failed task with the task type, status, created/started/ended dates. taskId is optional, pageSize max 200.

Product info (SearchSpring_Feed::task)

GET /rest/V1/searchspring/productinfo?productId=1010&storeId=1

Runs the feed collection modifiers, after-load processors and data providers for the product (and its configurable/grouped parents) without generating a file, using the payload of the latest feed task of the store. The response contains the feed rows (product_info), the collection SQL after all modifiers (query), the task_id whose payload was used and a message explaining why the product is missing, if it is.

Note: this replaces the productinfo endpoint of the SearchSpringDev_FeedLogger utility module, disable that module to avoid a route conflict.

Feed generation logging

Written to var/log/searchspring_feed.log for every feed task:

  • Collection modifier applied (info) - one line per collection modifier (store, status, visibility, stock, attributes, price) with its key, class, time and the collection SQL after it. Attributes added with addAttributeToSelect() are joined on load, so they are not part of this SQL.
  • Feed data providers (info) - data provider keys and classes used for the task.
  • Feed data providers execution time in seconds, slowest first (info) - total time per data provider key for the task.
  • Feed data provider executed (debug) - time and row count per data provider per page, only when debug is enabled in app/etc/env.php:
'searchspring' => [
    'feed' => [
        'debug' => true,
    ],
],