Search by

hryvinskyi / magento2-catalog-sorting-no-image

hryvinskyi

Catalog sorting rule: products with a listing image before products without one in category listings and, optionally, search results.

Package info

github.com/hryvinskyi/magento2-catalog-sorting-no-image

Type:magento2-module

pkg:composer/hryvinskyi/magento2-catalog-sorting-no-image

Statistics

Installs: 0

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-11-18 19:58 UTC

This package is auto-updated.

Last update: 2026-11-18 20:10:35 UTC


README

Lists products with a listing image before products without one, on category pages or on category and search pages, whatever sort the shopper chose. A leading sort rule of hryvinskyi/magento2-catalog-sorting.

What it does for a store

  • Products without images go last. Products whose listing image (small_image) is not set go after the others; the shopper's sort orders each group. No value, an empty value and no_selection all count as no image; a store-view value wins over the default one.
  • Category pages, or search too. Per store view: off, on category pages, or on category and search pages.
  • Missing data never buries a product. A product without the field in its search document counts as having an image.
  • Written at index time, nothing per request. Whether a product has an image is written into its search document as the numeric field sort_has_image, with one query per batch of products. The engine sorts on it; there is no join and no computation per query.
  • Switching the setting needs no reindex. The field is written in every store whatever the store's setting.

Requirements

  • PHP 8.1 to 8.5.
  • hryvinskyi/magento2-catalog-sorting ^1.0.
  • The platform's Catalog, Eav, Store, Config and Backend modules (what composer.json and etc/module.xml declare).

Installation

composer require hryvinskyi/magento2-catalog-sorting-no-image
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:flush
bin/magento indexer:reindex catalogsearch_fulltext

The module adds the field sort_has_image to the product search documents. One full catalogsearch_fulltext reindex puts it into the index mapping and writes the values; listings keep working before it, and every product counts as having an image until then.

Configuration

Stores › Configuration › Catalog › Catalog Sorting › Products without Images

Path Label Default Scope
catalog_sorting/no_image/mode Show Products without Images Last: No (0), On Category Pages (1), On Category and Search Pages (2) No default, website, store view

Registrations

Pool Item
rules of Hryvinskyi\CatalogSorting\Model\Search\LeadingSorts no_image, sortOrder 200: after the out-of-stock rule (100) when both are installed
providers of Hryvinskyi\CatalogSorting\Model\Index\DocumentFields has_image, field sort_has_image (integer)

A product's image state in the index changes when its search document is rebuilt.