Jump to content

get categories from webservices, sort by position but doesnt work


tidjean
 Share

Recommended Posts

Hello everyone

I am trying to get the categories through the web-service. This is working well, now i want to sort them by position to get the same order than the website with &sort=[position_ASC]
 

here my request :
https://www.lespinards.com/api/categories?output_format=JSON&display=[name,id,id_parent]&filter[active]=1&filter[level_depth]=[2,3]&sort=[position_ASC]

sadly, I got an SQL error :

 

{"errors":[{"code":97,"message":"[SQL Error] Column 'position' in order clause is ambiguous. From ObjectModelCore->getWebserviceObjectList() Query was : \n\t\tSELECT DISTINCT main.`id_category` FROM `ps_category` AS main\n\t\t LEFT JOIN `ps_category_shop`\n\t\t\t\t\t\t\t\t\t\tAS `multi_shop_category`\n\t\t\t\t\t\t\t\t\t\tON (main.`id_category` = `multi_shop_category`.`id_category`) \n\t\tWHERE 1 AND `multi_shop_category`.id_shop = 1  AND `main`.`active` LIKE \"1\"\n AND `main`.`level_depth` BETWEEN \"2\" AND \"3\"\n\n\t\t ORDER BY ``.`position` ASC\n\n\t\t"}]}

 

Looks like the table category_shop and category have both the field position.  I think we should be able to sort by position from the webservice, do you have any idee how to do it?

 

Share this post


Link to post
Share on other sites

  • 10 months later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More