Jump to content

How to create relation between category and group using PS-REST API


Recommended Posts



I'm developing a connector between my ERP and Prestashop. I'm sending my customers, categories, products and groups to Prestashop API and works OK. The problem is that one customer can only see the products of his group, and by default, when you add a customer he is in group 1,2 and 3.  

Using the admin page I can go to categories and allow access to groups, one by one, but I haven't found a way to do that using REST API.

This relation is in DB table "category_group"


Another option I was thinking about, It is to disable this restriction on Prestashop Core, and allow every group to see every category, but I dont really want to rewrite PS code.


Any help please?



Link to comment
Share on other sites

I had a look at the Webservice documentation and tested on my shop with categories where I have assigned access to specific non-default groups only. Unfortunately, the API does not seem to expose the relation you're looking for, for the time being at least.


I'm guessing that you have to resort to a custom PHP script which will update the database accordingly.

Edited by parsifal (see edit history)
Link to comment
Share on other sites

  • 2 years later...


in 2016, in version 1.6.3, it's seems that it is not possible to connect groups on category whith REST API,

I have the same problem that hectorgomis,


how have you solve this problem  ?



Link to comment
Share on other sites

  • 2 years later...


I've got the same problem in version

Categories API doesn't return client groups in the get call, and in the put/push override with the standard Visitor, Guest and  Customer's group. So if the user changes the group access in the back office, the next update of the category go back to the standard Visitor, Guest, and Customer, losing user's work.

I open a GitHub Issue and pull request, and in the meanwhile, as a workaround, I manually change in the Category.php class. to avoid updating category's group in the put/post

In the classes/Category.php file, function update (line 240 approx.) change from



global $webservice_call;
if (!$webservice_call) {


So when updating from the web service, it avoids overriding the actual groups.

Edited by Nicolás Jiménez (see edit history)
Link to comment
Share on other sites

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
  • Create New...