Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add multistore support to administration and product settings configuration forms#41409

Open
Codencode wants to merge 4 commits into
PrestaShop:developfrom
Codencode:feat/multistore-configuration-forms
Open

Add multistore support to administration and product settings configuration forms#41409
Codencode wants to merge 4 commits into
PrestaShop:developfrom
Codencode:feat/multistore-configuration-forms

Conversation

@Codencode
Copy link
Copy Markdown
Contributor

@Codencode Codencode commented May 6, 2026

Questions Answers
Branch? develop
Description? This PR adds multistore support to two configuration sections:

- Advanced Parameters > Administration
- Shop Parameters > Product Settings

The implementation follows the same multistore pattern already used in Shop Parameters > Order Settings, including form type integration, multistore configuration keys, route compatibility with PATCH, and frontend initialization for multistore fields.

It also fixes the allow_ordering_oosfallback in ProductPreferencesFormHandler by applying it before the save flow and forcing it to the boolean valuetruewhen stock management is disabled. This prevents the disabled field from reaching the configuration layer asnull, fixes the related form option type error, and avoids a duplicate save while keeping the existing save hook dispatch.
Type? improvement
Category? BO
BC breaks? no
Deprecations? no
How to test? 1. Enable multistore.
2. Open Advanced Parameters > Administration in a single shop context and update some configuration values.
3. Open Shop Parameters > Product Settings in a single shop context and update some configuration values.
4. Check that multistore checkboxes are available and that the changes are saved only for the selected shop context.

Note: recompilation of the new-theme admin theme assets is required.
UI Tests https://github.com/Codencode/ga.tests.ui.pr/actions/runs/25482359105
Fixed issue or discussion?
Related PRs
Sponsor company Codencode snc

Note:
The switch to AbstractMultistoreConfiguration also exposes a legacy compatibility issue in front office boolean checks. Some code paths still assume disabled configuration values are stored as 0, while the multistore configuration flow may persist false as NULL. As a result, comparisons such as 0 == Configuration::get('PS_DISP_UNAVAILABLE_ATTR') no longer behave as expected. This currently happens in the product front controller:

$id_attributes = Db::getInstance()->executeS('SELECT pac2.`id_attribute` FROM `' . _DB_PREFIX_ . 'product_attribute_combination` pac2' .
((!Product::isAvailableWhenOutOfStock($this->product->out_of_stock) && 0 == Configuration::get('PS_DISP_UNAVAILABLE_ATTR')) ?
' INNER JOIN `' . _DB_PREFIX_ . 'stock_available` pa ON pa.id_product_attribute = pac2.id_product_attribute
WHERE pa.quantity > 0 AND ' :
' WHERE ') .
'pac2.`id_product_attribute` IN (' . implode(',', array_map('intval', $id_product_attributes)) . ')
AND pac2.id_attribute NOT IN (' . implode(',', array_map('intval', $current_selected_attributes)) . ')');


Adjusting the controller logic is safer than forcing 0 at storage level, since NULL storage matches the default AbstractMultistoreConfiguration behavior. This regression is visible in the failing UI test run: https://github.com/Codencode/ga.tests.ui.pr/actions/runs/25482359105/job/74769371860

@Codencode Codencode added this to the 9.1.2 milestone May 6, 2026
@Codencode Codencode requested a review from kpodemski May 6, 2026 09:30
@Codencode Codencode requested a review from a team as a code owner May 6, 2026 09:30
@github-project-automation github-project-automation Bot moved this to Ready for review in PR Dashboard May 6, 2026
@ps-jarvis ps-jarvis added Improvement Type: Improvement 9.1.x Branch labels May 6, 2026
@Codencode
Copy link
Copy Markdown
Contributor Author

@kpodemski, is this change suitable for 9.1.x, or should I target it to develop?

@Codencode Codencode force-pushed the feat/multistore-configuration-forms branch 2 times, most recently from 7cff7a0 to 0c2d0c4 Compare May 7, 2026 06:15
@Codencode Codencode marked this pull request as draft May 7, 2026 07:23
Codencode added 4 commits May 7, 2026 09:29
Use the boolean value true for the allow_ordering_oos fallback and apply it before saving when stock management is disabled. This prevents the field from being submitted as null and fixes the related boolean type error.
Reuse the parent save flow in ProductPreferencesFormHandler::save() instead of persisting the stock preferences twice. This keeps the save hook dispatch unchanged and avoids an unnecessary second save cycle.
@Codencode Codencode force-pushed the feat/multistore-configuration-forms branch from 0c2d0c4 to a94a452 Compare May 7, 2026 07:29
@Codencode Codencode changed the base branch from 9.1.x to develop May 7, 2026 07:30
@ps-jarvis ps-jarvis added develop Branch and removed 9.1.x Branch labels May 7, 2026
@Codencode Codencode modified the milestones: 9.1.2, 9.2.0 May 7, 2026
@Codencode Codencode closed this May 7, 2026
@github-project-automation github-project-automation Bot moved this from Ready for review to Closed in PR Dashboard May 7, 2026
@Codencode Codencode reopened this May 7, 2026
@github-project-automation github-project-automation Bot moved this from Closed to Reopened in PR Dashboard May 7, 2026
@Codencode Codencode marked this pull request as ready for review May 7, 2026 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

develop Branch Improvement Type: Improvement

Projects

Status: Reopened

Development

Successfully merging this pull request may close these issues.

2 participants