Cyber Monday 2024! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Adobe Exam AD0-E716 Topic 8 Question 15 Discussion

Actual exam question for Adobe's AD0-E716 exam
Question #: 15
Topic #: 8
[All AD0-E716 Questions]

An Adobe Commerce developer wants to generate a list of products using ProductRepositorylnterf ace and search for products using a supplier_id filter for data that is stored in a standalone table (i.e., not in an EAV attribute).

Keeping maintainability in mind, how can the developer add the supplier ID to the search?

Show Suggested Answer Hide Answer
Suggested Answer: B

The developer can add a custom filter to the virtual type MagentoCatalogModelApiSearchCriteriaCollectionProcessorProductFilterProce5sor for supplier_id field. In the custom filter, the developer can apply the needed join and filter to the passed $collection. This is the recommended way to extend the search criteria for products using dependency injection and plugins. Verified Reference: [Magento 2.4 DevDocs] [Magento Stack Exchange]


Contribute your Thoughts:

Cecily
6 months ago
That's a valid point, adding a custom filter could simplify the process for the developer.
upvoted 0 times
...
Sylvie
6 months ago
I'm leaning towards option B, as it adds a custom filter to the Virtual type for supplier_id field.
upvoted 0 times
...
Cecily
7 months ago
But with option A, you can register the search criteria and apply the needed join and filter easily.
upvoted 0 times
...
Denny
7 months ago
I disagree, I believe option C is more efficient in this case.
upvoted 0 times
...
Cecily
7 months ago
I think option A is the best approach to add the supplier ID to the search.
upvoted 0 times
...

Save Cancel