Skip to content

Add supplier_reference_to_display to ProductLazyArray#40450

Open
drhide16 wants to merge 3 commits into
PrestaShop:developfrom
drhide16:feature/supplier-reference-display
Open

Add supplier_reference_to_display to ProductLazyArray#40450
drhide16 wants to merge 3 commits into
PrestaShop:developfrom
drhide16:feature/supplier-reference-display

Conversation

@drhide16
Copy link
Copy Markdown

@drhide16 drhide16 commented Jan 5, 2026

This change exposes the supplier reference for products and combinations in the same way reference_to_display works. The value is automatically updated when changing combinations via JavaScript.

  • Add getSupplierReferenceToDisplay() method with LazyArrayAttribute
  • Add supplier_reference_to_display to embedded attributes whitelist
Questions Answers
Branch? develop
Description? Add supplier_reference_to_display property to ProductLazyArray to expose supplier reference for products and combinations in front-office templates, with dynamic update support when changing combinations (same behavior as reference_to_display).
Type? new feature
Category? FO
BC breaks? no
Deprecations? no
How to test? 1. Create a product with a supplier reference
2. Add combinations with different supplier references
3. In theme template product-details.tpl, add: {if $product.supplier_reference_to_display}<span>{$product.supplier_reference_to_display}</span>{/if}
4. Visit product page and change combinations - verify supplier reference updates dynamically
UI Tests N/A (no UI changes in core)
Fixed issue or discussion? N/A
Related PRs N/A
Sponsor company N/A

@drhide16 drhide16 requested a review from a team as a code owner January 5, 2026 14:51
@github-project-automation github-project-automation Bot moved this to Ready for review in PR Dashboard Jan 5, 2026
@ps-jarvis ps-jarvis added develop Branch Feature Type: New Feature labels Jan 5, 2026
@ps-jarvis
Copy link
Copy Markdown

Hello @drhide16!

This is your first pull request on PrestaShop repository of the PrestaShop project.

Thank you, and welcome to this Open Source community!

Comment on lines +470 to +474
$supplierRef = Db::getInstance()->getValue(
'SELECT supplier_reference
FROM ' . _DB_PREFIX_ . 'product_attribute
WHERE id_product_attribute = ' . $idProductAttribute
);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hi @drhide16 , thanks !
This is not the best place to put this query, can you please move to Product object model and use ProductPresenter ?

Copy link
Copy Markdown
Contributor

@Hlavtox Hlavtox left a comment

Choose a reason for hiding this comment

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

Please, use same logic as in getReferenceToDisplay, so we load the combination data only once. :-)

Expose supplier reference for products and combinations in front-office
templates with dynamic update support when changing combinations.

Changes:
- Add supplier_reference to getAttributesParams() SELECT query
- Add supplier_reference to getAttributesInformationsByProduct() SELECT query
- Add getSupplierReferenceToDisplay() method with LazyArrayAttribute
- Add supplier_reference_to_display to embedded attributes whitelist
@drhide16 drhide16 force-pushed the feature/supplier-reference-display branch from ed67d45 to 25f5761 Compare January 6, 2026 20:23
Comment thread src/Adapter/Presenter/Product/ProductLazyArray.php Outdated
Co-authored-by: Daniel Hlaváček <daniel.hlavacek@hotmail.cz>
Hlavtox
Hlavtox previously approved these changes Jan 6, 2026
@ps-jarvis ps-jarvis moved this from Ready for review to Need 2nd approval in PR Dashboard Jan 6, 2026
@Hlavtox Hlavtox added this to the 9.2.0 milestone Jan 6, 2026
@Touxten
Copy link
Copy Markdown
Contributor

Touxten commented Jan 9, 2026

I re-run test failed but it's ok for me.

Touxten
Touxten previously approved these changes Jan 9, 2026
@Touxten Touxten mentioned this pull request Jan 9, 2026
@drhide16 drhide16 dismissed stale reviews from Touxten and Hlavtox via c4a72bd March 20, 2026 15:49
@drhide16 drhide16 requested review from Hlavtox, PululuK and Touxten April 7, 2026 14:37
@drhide16
Copy link
Copy Markdown
Author

Hi @Touxten @Hlavtox,
I've fixed the trailing space issue. Could you re-review when you have a moment?
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

develop Branch Feature Type: New Feature

Projects

Status: Need 2nd approval

Development

Successfully merging this pull request may close these issues.

5 participants