1

Is it possible to search for a category by a custom attribute?

I have added a custom attribute "category_code" that i would like to do a rest search on.

Is there a way to do this througt the V1/search interface?

/Thomas

  • 1
    There does not seem to be a way to achieve this for now, it is impossible for core attributes either. – Alex Paliarush Mar 23 '16 at 21:58
  • Thank Alex, now i know. – TNordkvist Mar 24 '16 at 10:24
  • Problem solved! – TNordkvist Mar 30 '16 at 11:55
2

Problem solved!

I did a cut'n'paste of the getList from the ProductRepository. Removed all unnecessary code and changed the constructor.

https://github.com/netrixab/magento2-search-category

| improve this answer | |
  • ur module wont compile - can u plz review it? – Sina Miandashti Jan 31 '17 at 19:25
  • Hi @SinaMiandashti I didn't intend to maintain this module. But i included this code in another module and it works fine on Magento 2.1.3 in default mode on php 7.0.14. – TNordkvist Feb 2 '17 at 7:27
  • try it ... it says missing interface class while compiling ... can u plz at least maintain it ? – Sina Miandashti Feb 3 '17 at 7:15
  • 1
    I've got a similar module here which I'm actively using so it should keep working github.com/lingwooc/flatCategory-magento2 Currently working in CE 2.1.7. I've not credited @TNordkvist as I wrote it before I found this. – Chris Lingwood Jun 30 '17 at 11:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.