Skip to content

NEW : show product variants by default in product list (backport)#758

Merged
atm-vincent-p merged 5 commits into
23.0_ateliertortilfrom
NEW/product-list-show-variants-default-ateliertortil
Jul 16, 2026
Merged

NEW : show product variants by default in product list (backport)#758
atm-vincent-p merged 5 commits into
23.0_ateliertortilfrom
NEW/product-list-show-variants-default-ateliertortil

Conversation

@atm-corentin

Copy link
Copy Markdown

Backport vers 23.0_ateliertortil

Backport de #757 (branche develop).

Contexte (ticket client)

Suite à la montée v17 → v23, le client signale des produits « manquants » dans la liste (ex. ASAMA-HT-00084, AEROLITE-HT-00318, KAZAN-HT-00091). Diagnostic : ces produits existent mais sont des variantes enfants, masquées par défaut dans la liste produit tant que la case « Afficher les produits enfants » n'est pas cochée (comportement natif du module Variantes). Rien à voir avec la liaison Splash/Akeneo.

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.
  • Oui → variantes visibles par défaut dans la liste (case cochée).

L'état de la case est toujours porté dans les paramètres de la liste (survit à la pagination/tri).

Activation côté client

Configuration > Modules > Variantes de produit → « Afficher les variantes par défaut dans la liste produit » = Oui.

Tests

  • php -l OK
  • Base réelle (v23) : constante=0 → 0/3 produits du ticket visibles ; constante=1 → 3/3 visibles
  • Logique de résolution $show_childproducts : 9 scénarios OK

🤖 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-vincent-p atm-vincent-p left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plusieurs GetPost sans le deuxième paramètre, mais possibilité d'y outre passé car backport

Comment thread ChangeLog Outdated
NEW: Add MULTICURRENCY_SHOW_ALSO_MAIN_CURRENCY_ON_PDF for legal requirement that need both currencies on PDF
NEW: Add note public and private on order export
NEW: Finish dev for API_ENABLE_COUNT_CALLS (count of API use is visible on user API key field)
NEW: Add option PRODUIT_ATTRIBUTES_SHOWCHILD_IN_LIST to show product variants by default in the products list

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ajouter la date ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Le ChangeLog Dolibarr ne date pas les lignes individuelles (regroupement par version). J'ai plutôt tagué l'entrée comme backport, conforme aux autres (backport ...) du fichier : ... (backport ATM #757, native in Dolibarr 24.0). Corrigé.

Comment thread htdocs/variants/admin/admin.php Outdated
Comment on lines +58 to +63
// BACKPORT ATM #757 - natif dès Dolibarr 24.0, à retirer après upgrade vers 24+
if (!dolibarr_set_const($db, 'PRODUIT_ATTRIBUTES_SHOWCHILD_IN_LIST', GETPOST('PRODUIT_ATTRIBUTES_SHOWCHILD_IN_LIST'), 'chaine', 0, '', $conf->entity)) {
setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors');
$error++;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backport Start et End ou équivalent

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fait : bloc encadré par // >>> BACKPORT ATM #757 / // <<< BACKPORT ATM #757, comme le bloc d'affichage plus bas.

Comment thread htdocs/variants/admin/admin.php Outdated
}

// BACKPORT ATM #757 - natif dès Dolibarr 24.0, à retirer après upgrade vers 24+
if (!dolibarr_set_const($db, 'PRODUIT_ATTRIBUTES_SHOWCHILD_IN_LIST', GETPOST('PRODUIT_ATTRIBUTES_SHOWCHILD_IN_LIST'), 'chaine', 0, '', $conf->entity)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manque du second paramètre de getpost, mais on passe car backport

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ajouté : GETPOST('PRODUIT_ATTRIBUTES_SHOWCHILD_IN_LIST', 'int') (la valeur vient d'un selectyesno -> 0/1).

Comment thread htdocs/variants/admin/admin.php
- 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)
@atm-vincent-p
atm-vincent-p merged commit f37fb6f into 23.0_ateliertortil Jul 16, 2026
6 checks passed
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.

2 participants