byhero41 Posted August 24, 2021 Share Posted August 24, 2021 Hello, I'm developing an api module and I need to filter. For this, I need to get the attributes of all products in the category, as in the ps_facetedsearch module I need. I did some research on how to do this but couldn't find a solution. for example; https://prnt.sc/1qgwqor I tried return a json object. Link to comment Share on other sites More sharing options...
byhero41 Posted August 24, 2021 Author Share Posted August 24, 2021 6 minutes ago, ndiaga said: Hi, You can at first get all the available attributes in the shop and then filter them by comparing ids with the ids that the products in the current category have. I thought of doing this, but since there are so many products, the queries I will write may be a bit cumbersome. ps_facetedsearch works very well in this regard. I can use the structure found in the module (I've researched this but couldn't figure out exactly how it works) or I can try more simplified structures. Link to comment Share on other sites More sharing options...
byhero41 Posted August 25, 2021 Author Share Posted August 25, 2021 19 hours ago, ndiaga said: The module uses the default search class by just sending and getting data. This query shows the features used in the specified category. select pc.id_attribute,agl.id_attribute_group ,agl.name, al.name from ps_product_attribute as pa, ps_product as p, ps_product_attribute_combination as pc, ps_attribute_group as ag, ps_attribute_lang as al, ps_attribute as a, ps_attribute_group_lang as agl WHERE pa.id_product = p.id_product AND pa.id_product_attribute = pc.id_product_attribute AND a.id_attribute = pc.id_attribute AND a.id_attribute_group = ag.id_attribute_group AND a.id_attribute_group = agl.id_attribute_group AND a.id_attribute = al.id_attribute AND al.id_lang = 1 AND p.id_category_default = 46 AND a.id_attribute_group = 2 GROUP BY al.id_attribute ORDER BY agl.name ASC, al.name ASC Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now