Questions tagged [search-criteria]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
15 views

How to return products in stock via API REST using SearchCriteria?

I have an integration that must get my products in stock via the Magento 2 API using SearchCriteria. How could I filter it, since it's inside my custom_attributes?
0
votes
3answers
25 views

Rand sort on searchCriteria getItems

Is it possible to have a random sort when searching with repositories? Checked dev docs and unsure. Not found much elsewhere. https://devdocs.magento.com/guides/v2.3/extension-dev-guide/searching-...
0
votes
2answers
17 views

searchCriteriaBuilder using multiple sort

I've been experimenting with SearchCriteriaBuilder but I can't seem to get the syntax right to apply multiple sort. I've tried this $this->searchCriteriaBuilder->addFilter(EntryInterface::...
1
vote
0answers
16 views

Magento 2 Search - how to show result when customer search for a SKU with prefix and suffix? EX: AA-SKU1234

Is there a way to return result for 'SKU', if the customer search for the term like 'AA-SKU2033'? Currently, our product has the following format on the actual product sticker 'AA-SKU2033' 'AA-' is ...
0
votes
0answers
34 views

How to create filter group for the query to search Via search Criteria

I am trying to build below query using filter groups SELECT `main_table`.* FROM `sales_order` AS `main_table` WHERE( (`updated_at` > '2020-04-01 15:11:31') AND (`updated_at` <= '2020-04-02 15:...
1
vote
1answer
39 views

How to get the product type by the product SKU?

I have some product SKUs in my custom module and I want to get just the simple products. I don't want to load each product entity by SKU in a loop to get the product type to avoid performance issues. ...
0
votes
1answer
33 views

Magento 2: How to add OR condition b/w 2 AND conditions in Searchcriteria

I have a requirement where I found the list of specific orders according to the filtered conditions. I need to create a searchCriteria which I can pass to $this->orderRepository->getList($...
0
votes
0answers
36 views

Search Product by SKU programatically using search criteria

I need to search product programatically using search_criteria public function search($storeId, $searchTerm, $searchOrder, $searchDir, $page, $pageSize, &$totalSearchResults, &$attrs_applied, ...
0
votes
0answers
14 views

Magento2: How to move featured products first in search result? [duplicate]

I want to sort the product search results by featured attribute(Yes/No type) so featured product comer first then show non-featured products. Currently, my search result is mixing in featured & ...
2
votes
0answers
17 views

Logical “NOT” in SearchCriteria

I found how to use logical "AND" & "OR" in search criteria: https://devdocs.magento.com/guides/v2.3/extension-dev-guide/searching-with-repositories.html https://devdocs.magento.com/guides/v2.3/...
0
votes
1answer
73 views

Magento 2 : To show category with in the top search bar results

How to show categories on the top search bar results? Do not want to interact with ElasticSearch as using MySQL search engine. Any sort of note would be much helpful.
1
vote
1answer
106 views

Magento 2 how to pass if exist search criteria in rest api call

I need to filter getList records in my rest api call. I have following: searchCriteria[filter_groups][0][filters][0][field]=city_ref&searchCriteria[filter_groups][0][filters][0][condition_type]=...
0
votes
0answers
44 views

Magento 2: Add an attribute to global search

Is it possible to add an attribute from a custom module to the global Magento 2 search system? For context I've got a couple of custom attributes added to the sales order records (an external legacy ...
1
vote
0answers
24 views

Search using REST endpoints on two different columns with OR condition in Magento 2

I'm using Magento v2.3 and using API to search products. Following is the search criteria code. 'searchCriteria[filterGroups][0][filters][0][field]': 'name', 'searchCriteria[filterGroups][0][filters]...
1
vote
0answers
233 views

Magento 2 - REST API filter order data from shipping and billing address name and telephone number

I need to filter order data based on shipping and billing address name and telephone through rest api For example In order to filter data through status my request url would be something like this: ...
0
votes
1answer
144 views

How to custom search function in Magento 2

Because the search of Magento 2 works wrong with my shop, I want a custom search function in Magento 2 but I don't know it where. Please help me, where is function in vendor
1
vote
1answer
50 views

Magento 2: How to add multilevel AND and OR conditions to searchCriteria?

What i want to achieve is this - attr1 = 'val1' AND attr2 = 'val2' AND ((attr_s1 = 'val_s1' AND attr_d1 = 'val_d1' AND attr_t1 = 'val_t1') OR (attr_s2 = 'val_s2' AND attr_d2 = 'val_d2' AND ...
1
vote
1answer
52 views

Why quantity_and_stock_status is always 1 in /V1/products?searchCriteria in Magento-2.2.7?

I am using Magento-2.2.7 . If i call this endpoint /V1/products?searchCriteria , it always show each product having same quantity_and_stock_status . Whenever product is in_stock or out_of_stock it ...
1
vote
0answers
406 views

Magento 2 Rest Api - Is this searchCriteria filter correct?

I'm trying to retrieve virtual products, which have been modified before a certain date and which still are in stock I'm using this /rest/V1/products?searchCriteria[filter_groups][0][filters][0]...
1
vote
1answer
44 views

Fetch products from several SKUs where their price don't match from a list

I have a predefined list of SKUs with prices in an array, and I would like to return the products within Magento that matches those SKUs but not the price. As a quick solution, I have constructed an ...
1
vote
1answer
83 views

Escape initial percentage on Product Search Criteria REST API

I'm running the following request to search products by SKU using the Magento 2 REST API: curl -X GET "http://localhost/rest/V1/products?searchCriteria[filterGroups][0][filters][0][field]=sku&...
4
votes
1answer
263 views

Difference between SearchCriteria VS SearchResults Vs SearchCriteriaBuilder and when should we use it?

For searching in repositories we are using searchCriteriaInterface but i noticed sometimes we are using SearchCriteriaBuilder as well. In which case we should use searchCriteriaBuilder? What's the ...
2
votes
0answers
133 views

Joins on search criteria

Is thery any way to join other tables to SearchCriteriaInterface, while building it, before calling any getList method of any repository? I mean it should work more or less like joining tables on ...
1
vote
0answers
253 views

Magento 2 - Query Builder

I need to create a query with searchCriteriaBuilder with this condition: WHERE visibility = [value] AND status = [value] AND ((category_id = [value] AND designer = [value]) OR (category_id = [value]))...
3
votes
2answers
463 views

Search criteria builder does not filter an “out_of_stock” products

I am using Magento 2.3, Am filtering the product collection using the search criteria builder with a custom attribute as the filter. $filter1 = $this->_filterBuilder->setField('...
0
votes
1answer
43 views

Search type in Catalog don't search by Product's Name

I'm changed catalog search configuration to : System > Configuration > Catalog Search Type => Combine (Like and Fulltext) Product Listing Sort by => Name But when I search by name, the product ...
2
votes
1answer
577 views

CatalogSearch results looking for partial SKU

I need to be able to search by partial string of a SKU, for example, if a SKU of a product is "CUS123.5NYS" the customer may also be able to search by "123.5N", but currently, it only works if I ...
2
votes
1answer
2k views

How can we return an array of search results in APIs Magento 2

I need to return array of search results and so far I did this. DashBoardInterface.php <?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ ...
3
votes
2answers
414 views

Filtered response does not show total records in response of REST APIs in Magento 2

I am using GET V1/products endpoint to fetch product list. I want to fetch sku and name only. http://localhost/magento/rest/default/V1/products?searchCriteria[sortOrders][0][direction]=ASC&...
1
vote
0answers
14 views

Sphinx Search - How to Hide Archive Products

How I can Hide Archive Products appearing in Search results We are using Sphinx Search, Do anyone know how not to show some products pages showing in search results. Thanks.
1
vote
1answer
330 views

How to filter Multiselect in Magento 2 search Rest API?

I am using magento search rest api. Now i can filter attributes like neck, sleeve, etc.., but i need to give multiple values for same attribute (like mulitple select) My Request: rest/V1/search?...
1
vote
1answer
353 views

Use search_criteria to filter custom extension collection in Magento 2

I generated a custom extension with a custom model collection from mage2gen , is it possible to implement the search_criteria like when you retrieve product using rest api? what i know is the product ...
1
vote
1answer
901 views

Set Join in SearchCriteria select

I need to override the get orders list API call, and set a join with my custom table, but without loose the SearchCriteria terms, is this possible? Current Code: (I've created a plugin in Magento\...
1
vote
0answers
33 views

What is the proper way to perform a SEARCH with logic AND using the APIs?

I'm having trouble performing a search using the APIs. Below is the request I'm performing to my Magento backend: http://www.mybackend.com/rest/it/V1/products?searchCriteria[filterGroups][0][filters][...
2
votes
1answer
2k views

Customer Repository Interface, Limit Results

I'm trying to grab the oldest customer, using the customer repository from the database. Here's my code so far: // if custom is active $isActivefilter = $this->filter ->...
1
vote
0answers
175 views

order api search criteria

I have two magento accounts and i am fetching order with below route : ("/rest/V1/customers/search?searchCriteria[page_size]=20000&searchCriteria[current_page]=1&searchCriteria[...
3
votes
0answers
326 views

Magento 2 rest api: Ignore out of stock products in get products search criteria

I am using the following api call to get products. {{base_url}}/rest/V1/products?searchCriteria[filter_groups][0][filters][0][condition_type]=like&searchCriteria[filter_groups][0][filters][0][...
2
votes
1answer
1k views

Magento 2 filter products by price from Rest API

Magento-2 we would like to filter the products from REST API I have filtered product by price in the frontend please check the result in the below screenshot (24-MB02 price and special price we ...
7
votes
2answers
10k views

Magento2: How to add multiple AND and OR conditions to filter/filterGroups?

The question is too close to this topic: Magento 2: Product Repositories, Filter Groups, and `AND` but is it possible to create criteria with multiple OR and AND? In my case i would like to create ...
1
vote
1answer
919 views

filtering orderList with multiple filter searchCriteria in 'AND' logic

I am trying to filter the order list based on two filters. So far, all of my attempts failed and didn't work. The filter is not working properly and it returns very first order in list of orders in ...
1
vote
1answer
196 views

SearchCriteria Logical OR and AND search

I am trying to get a search criteria to become the following SQL: WHERE (a = 1 AND b = 2) OR (c = 3) Magento2 Documentation only has the example where AND and OR are reversed. Is this even possible? ...
2
votes
3answers
2k views

Magento 2 Search Rest API

I need to change the response of Search Rest API in Magento 2. Request:rest/V1/search?searchCriteria[requestName]=quick_search_container &searchCriteria[filterGroups][0][filters][0][field]=...
19
votes
2answers
13k views

What are the allowed condition types in Magento 2?

What is the list of allowed condition types while adding filter to search criteria in Magento 2? All of the examples about search criteria in the internet use eq condition type. Is there any other? ...
0
votes
2answers
360 views

Magento2: SearchCriteria OR/AND

use \Magento\CatalogSearch\Helper\Data as CatalogSearch; use \Magento\Catalog\Model\Layer\Category\FilterableAttributeList; use \Magento\Catalog\Api\ProductRepositoryInterface; use \...
1
vote
1answer
620 views

Magento2: setFilterGroups(array) SearchCriteria Error

I have the following code: $filter1 = $this->_filterBuilder->setField('name') ->setValue('%'.$searchTerm.'%') ->setConditionType("like") ->create(); $filter2 = $this->...
2
votes
1answer
4k views

Magento2: Collection to SearchCriteria

How to convert $products = $this->_catalogSearchAdvanced ->getProductCollection() ->addStoreFilter($storeId) ->setCurPage($page) ->setPageSize($...
0
votes
1answer
1k views

Search Criteria for the products in magento 2

I have gone through the Search Criteria functionality to filter the products, for this I have created the custom attributesmart_search multiselect attribute. And I have written some code for filter ...
1
vote
1answer
401 views

Retrieve extension_attributes with API searchCriteria working wrong

I created a new field on Creditmemos as an extension_attribute. I thought is working fine, when I create a Creditmemo, the field is saved correctly in the ddbb and when I get the creditmemo with the ...
1
vote
1answer
1k views

Magento2 Rest Api Search Criteria not working properly!

I am trying to get the sales orders from magento2 REST API. I am using the below query to get the complete orders within entity_id range: $ch = curl_init( Helper::getURL() . "orders?searchCriteria[...
0
votes
0answers
294 views

How to filter a product by a datetime attribute in Magento2?

I am trying to filter products on a search by an attribute of type 'datetime'. The problem is it does not filter by it, so it shows all the results. I have tested other attributes and it works fine, ...