Conversation
This was referenced Sep 21, 2026
The product listing carries no stock information, so a customer has to open every product to learn whether it can be shipped now. The data is already presented for listings: ProductListingPresenter extends ProductPresenter, and availability, availability_message and show_availability are all in the listing whitelist. Only the miniature never rendered them. The mapping from an availability state to its icon and colour lived inline in product-add-to-cart.tpl, so it moves to a shared partial parameterised by the caller's BEM block. Passing componentName='product' reproduces the product page's markup unchanged; the miniature passes its own block and gets the same label with product-miniature__ classes. A listing already had one out-of-stock signal, the flag over the thumbnail, and it carries the same words as the new label. Showing both would say it twice, so product-flags.tpl takes hideOutOfStockFlag and the miniature sets it whenever it renders a label of its own. A shop that has emptied the label keeps the flag, and the product page is untouched. States follow the specs on the issue: in stock in green, out of stock with backorders allowed in orange, out of stock with backorders denied in red. As on the product page, nothing is rendered when the merchant has left the matching label empty in Shop parameters > Product settings.
boo-code
force-pushed
the
feat/stock-label-in-product-listings-23659
branch
from
September 22, 2026 16:47
4b86f23 to
c98b577
Compare
|
This pull request seems to contain new translation strings. I have summarized them below to ease up review:
(Note: this is an automated message, but answering it will reach a real human) |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The listing has carried the data all along.
ProductListingPresenterextendsProductPresenter, andavailability,availability_message,availability_submessageandshow_availabilityare all inProductLazyArray::getProductAttributeWhitelist(), so they reach the miniature. Measured on a 9.2 shopby rendering a probe inside the miniature on a category page:
Only the template never read them.
What it does
The mapping from an availability state to its icon and colour was inline in
product-add-to-cart.tpl. It moves tocatalog/_partials/product-availability-status.tpl, which boththe product page and the miniature include, so the two surfaces cannot drift apart. The partial takes
the caller's BEM block through
$componentName, the convention the theme already uses for sharedpartials, so
componentName='product'reproduces the product page's existing classes exactly and theminiature gets
product-miniature__availability-*for free.States follow the specs on the issue: in stock green, out of stock with backorders allowed orange, out
of stock with backorders denied red. Nothing new is decided here - those three colours are what the
product page has been rendering.
One indicator, not two
A listing already carried an out-of-stock signal: the flag over the thumbnail, gated by
PS_SHOW_LABEL_OOS_LISTING_PAGES, which is 1 on a default install. It renders the same words as thenew label, so a tile with every combination out of stock showed "Out-of-Stock" twice - measured before
this was addressed:
product-flags.tplnow takeshideOutOfStockFlag, and the miniature sets it exactly when it renders alabel of its own. Consequences, each measured:
same tile is untouched, so the filter is selective rather than a blanket suppression.
rendered, and the flag comes back. The setting still does something.
This is the listing half of PrestaShop/PrestaShop#24759, which is
PM (approved)and asks for the flag and its BO toggle to be removed outright; that issue was waiting onthis one. The toggle and the product-page flag stay here.
How to test
Requires stock management enabled (Shop parameters > Product settings).
Shop parameters > Product settings, fill "Label of in-stock products", e.g.
In stock.Open any category page. Each tile now shows a green check and that label under the price.
Set a product's quantity to 0 with "Deny orders" - its tile turns red with the out-of-stock label.
Switch that product to "Allow orders" and fill "Label of out-of-stock products with allowed
backorders" - the tile turns orange.
Clear "Label of in-stock products" again: in-stock tiles show nothing, exactly as the product page
does in the same state.
Set every combination of a product to 0 with "Deny orders": the tile shows the red label and no
out-of-stock badge. Empty the out-of-stock label in Shop parameters > Product settings and the badge
comes back.
Measured on a running 9.2 shop
Product page markup is byte-identical before and after the extraction (diff of the rendered
product__availability-statusblock: no output). Listing, same request:With the label left empty the listing renders nothing, and so does the product page - checked both in
the same state rather than assumed.
Not verified: the compiled CSS.
assets/is generated and gitignored, so the SCSS added forproduct-miniature__availability-statuswas not built; the classes and their order are what wasmeasured, not their rendering.