Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ean13 field to api stock management search engine for product and combinations #35505

Merged
merged 2 commits into from
Feb 29, 2024

Conversation

matthieu-rolland
Copy link
Contributor

@matthieu-rolland matthieu-rolland commented Feb 28, 2024

Questions Answers
Branch? develop
Description? On the stock management page, we want to be able to search by ean/JAN code, whether it's the product 's code or an individual combination's code
Type? improvement
Category? BO
BC breaks? no
Deprecations? no
How to test? 1- Add an EAN code to a product
2- Add an EAN code to a specific combination of a product
3- On the stock management page, try searching by ean, it should give you all combinations of a product having the given EAN code, or the specific combination having this EAN if it's the EAN you added on a specific combination.
UI Tests UI tests https://github.com/florine2623/testing_pr/actions/runs/8093114379
Fixed issue or discussion? #21503
Related PRs none
Sponsor company PrestaShop SA

@matthieu-rolland matthieu-rolland requested a review from a team as a code owner February 28, 2024 07:46
@prestonBot prestonBot added develop Branch Improvement Type: Improvement labels Feb 28, 2024
@matthieu-rolland matthieu-rolland changed the title add ean13 field to stock management search engine for product and combinations Add ean13 field to api stock management search engine for product and combinations Feb 28, 2024
@matthieu-rolland matthieu-rolland marked this pull request as draft February 28, 2024 07:48
@matthieu-rolland matthieu-rolland marked this pull request as ready for review February 28, 2024 08:00
'{product_name} LIKE :keyword_%d OR ' .
'{combination_name} LIKE :keyword_%d' .
')',
$index,
$index,
$index,
$index,
$index,
$index
Copy link
Contributor Author

Choose a reason for hiding this comment

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

at first, I replaced this with an array of fields and a loop to avoid having this list of $index variables...

but it made the whole thing harder to read and understand, and this search engine is already complicated, so I thought it was not worth it

@ps-jarvis ps-jarvis added the Waiting for QA Status: action required, waiting for test feedback label Feb 28, 2024
@Hlavtox Hlavtox added this to the 9.0.0 milestone Feb 28, 2024
@florine2623 florine2623 self-assigned this Feb 29, 2024
Copy link
Contributor

@florine2623 florine2623 left a comment

Choose a reason for hiding this comment

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

Hello @matthieu-rolland ,

Tested the search of EAN for all types of products in Stocks page.

Search of the exact match is OK ✅ for standard product and combination product (EAN on each combination AND EAN for the whole product)

If I have 2 products with similar EAN, both of the products will be displayed.
For example, I have :

  • product A : 123456789
  • product B : 12345678

I search for 123456789, only product A will be displayed.
I search for 12345678, both of the products will be displayed.

LGTM ✅
Thanks !

@florine2623 florine2623 added QA ✔️ Status: check done, code approved and removed Waiting for QA Status: action required, waiting for test feedback labels Feb 29, 2024
@kpodemski kpodemski merged commit 89f8d15 into PrestaShop:develop Feb 29, 2024
33 checks passed
@kpodemski
Copy link
Contributor

nice improvement @matthieu-rolland 👏🏻

@@ -311,6 +311,8 @@ protected function having(QueryParamsCollection $queryParams)
return strtr($filters['having'], [
'{combination_name}' => 'combination_name',
'{product_reference}' => 'product_reference',
'{product_ean13}' => 'product_ean13',
Copy link

Choose a reason for hiding this comment

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

I have this error if i search one reference in Mvt tab in stock management

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'product_ean13' in 'having clause'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
develop Branch Improvement Type: Improvement QA ✔️ Status: check done, code approved
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Search by & show EAN and other reference fields in Catalog / Stock Window
7 participants