Skip to content

NEW : show product variants by default in product list#757

Closed
atm-corentin wants to merge 2 commits into
developfrom
NEW/product-list-show-variants-default
Closed

NEW : show product variants by default in product list#757
atm-corentin wants to merge 2 commits into
developfrom
NEW/product-list-show-variants-default

Conversation

@atm-corentin

Copy link
Copy Markdown

Contexte

Quand le module Variantes est actif, la liste des produits (product/list.php) masque par défaut les produits enfants (variantes) via AND pac.rowid IS NULL, tant que la case « Afficher les produits enfants » n'est pas cochée. Aucune option ne permettait de cocher cette case par défaut (la constante native PRODUIT_ATTRIBUTES_HIDECHILD ne pilote que les sélecteurs produit, pas le SELECT de la liste).

Changement

Ajout de l'option PRODUIT_ATTRIBUTES_SHOWCHILD_IN_LIST (Oui/Non) dans le setup du module Variantes.

  • Non par défaut → comportement actuel conservé, aucune régression sur les installs existants.
  • Oui → la case « Afficher les produits enfants » est cochée par défaut, les variantes sont visibles sans manip.

L'état de la case est désormais toujours porté dans les paramètres de la liste, pour qu'un « décoché » explicite survive à la pagination et au tri même quand le défaut est « affiché ».

Fichiers

  • htdocs/product/list.php — résolution du défaut (parse + reset) + carry du paramètre
  • htdocs/variants/admin/admin.php — nouvelle option Oui/Non
  • htdocs/langs/en_US/products.lang — clés ShowProductCombinationsInList(+Help)
  • ChangeLog

Tests

  • php -l OK sur les fichiers modifiés
  • Réplique du WHERE de la liste sur base réelle : constante=0 → variantes masquées ; constante=1 → variantes affichées
  • Test unitaire de la logique de résolution $show_childproducts : 9 scénarios OK (défaut, coche explicite, recherche box décochée, reset, survie pagination on/off)

🤖 Generated with Claude Code

Add option PRODUIT_ATTRIBUTES_SHOWCHILD_IN_LIST (Yes/No) in the variants
module setup. When enabled, the "Show child products" checkbox of the
products list (product/list.php) is ticked by default, so variant child
products are visible without having to tick it manually.

The default value keeps the current behaviour (variants hidden), so there
is no regression for existing installs. The checkbox state is now always
carried in the list parameters so an explicit "off" survives pagination
and sorting even when the default is "on".

Note: this is unrelated to PRODUIT_ATTRIBUTES_HIDECHILD, which only drives
the product selectors, not the products list SQL query.
@atm-corentin

Copy link
Copy Markdown
Author

Fermée : basée sur atm/develop (22.0.0-alpha, périmée). La feature reste livrée au client via la PR #758 (backport 23.0_ateliertortil). Une vraie contribution upstream sera reproposée sur origin/develop (v24) si besoin.

@atm-corentin
atm-corentin deleted the NEW/product-list-show-variants-default branch July 15, 2026 08:30
atm-corentin added a commit that referenced this pull request Jul 16, 2026
- admin.php: wrap the set_const block with >>>/<<< BACKPORT markers (consistency)
- admin.php: add missing 'int' 2nd param to GETPOST for the new const
- ChangeLog: tag the entry as backport ATM #757 (native in Dolibarr 24.0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant