Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Adobe AD0-E716 Exam - Topic 12 Question 8 Discussion

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?
B) Add a CUStOm filter to the Virtual type 'agento\Catalog\Model\Api\SearchCriteria\CollectionProcessor\ProductFilterProce5sor for supplier_id field. In the custom filter, apply the needed join and filter to the passed $collection.
A) Write a before plugin on \Hagento\catalogVtodel\ProductRepository: :geti_ist() and register the search criteria passed. Write an event observer to 0 listen for the event cataiog_product_coiiection_ioad_before. Iterate through the registered search criteria, and if found, apply the needed join and filter to the events scollection.
C) Write a before plugin On \Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface: :process(). Iterate through the $searchCriteria provided for supplier_id, and if found, apply the needed join and filter to the passed scollection.

Adobe AD0-E716 Exam - Topic 12 Question 8 Discussion

Actual exam question for Adobe's AD0-E716 exam
Question #: 8
Topic #: 12
[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:

0/2000 characters
Tricia
7 months ago
A might work, but it feels a bit hacky to me.
upvoted 0 times
...
Sylvie
7 months ago
B is definitely the way to go for custom filters.
upvoted 0 times
...
Renea
7 months ago
Surprised that C is even an option, seems overly complicated!
upvoted 0 times
...
Providencia
7 months ago
I disagree, A could be more flexible with event observers.
upvoted 0 times
...
Shonda
8 months ago
Option B seems like the cleanest approach for maintainability.
upvoted 0 times
...
Mabel
8 months ago
I recall that option C involves modifying the SearchCriteria, which could be a good way to handle custom filters, but I’m a bit hazy on the specifics.
upvoted 0 times
...
Shawn
8 months ago
I feel like option A might be the most maintainable since it uses an event observer, but I'm not completely confident about the implementation details.
upvoted 0 times
...
Gerald
8 months ago
I think option B sounds familiar; we practiced adding custom filters in a similar question about product attributes.
upvoted 0 times
...
Kati
8 months ago
I remember we discussed using plugins and observers in class, but I'm not entirely sure which approach is best for adding the supplier ID filter.
upvoted 0 times
...
Mitsue
8 months ago
Hmm, this is a tricky one. I'm not sure if the AAPCC is the average cost of services or the fee-for-service amount adjusted for factors like age and status. I'll have to think this through carefully before answering.
upvoted 0 times
...
Shannan
9 months ago
Okay, let me think this through. I know we need to make the tftp service start automatically, so I'm guessing it's either B or E. I'm a bit unsure about the difference between "enable" and "enable-start" though. Might need to double-check the systemctl documentation.
upvoted 0 times
...
Dulce
9 months ago
Got it, I think I've got a good handle on this. The key advantages are binding the control manually, attaching the label control, and taking over the table-level formats and validation rules. I'll select those three options and move on to the next question.
upvoted 0 times
...
Avery
9 months ago
Hmm, this is a tricky one. I'll need to think carefully about the best approach here.
upvoted 0 times
...

Save Cancel