alirot Posted June 26, 2019 Share Posted June 26, 2019 Hello I tried this documentation https://webkul.com/blog/how-to-add-new-tables-in-rest-api-of-prestashop/ for exposing category_group table in webservice (two fields, id_category and id_group, creating in override folder class Category_Group and WebserviceRequest.php in webservice folder) but when I call localhost/local_site/api/category_group, the xml returned is empty please help Link to comment Share on other sites More sharing options...
alirot Posted June 26, 2019 Author Share Posted June 26, 2019 Prestashop version is: 1.6.1.23 Files used: WebserviceRequest.php <?php class WebserviceRequest extends WebserviceRequestCore { public static function getResources() { $resources=parent::getResources(); $resources['category_group'] = array('description' => 'Expose category_group table', 'class' => 'CategoryGroup'); ksort($resources); return $resources; } } ?> CategoryGroup.php class <?php class CategoryGroupCore extends ObjectModel { public $id_category; public $id_group; public static $definition = array( 'table' => 'ps_category_group', 'primary' => 'PRIMARY', 'fields' => array( 'id_category' => array('type' => self::TYPE_INT), 'id_group' => array('type' => self::TYPE_INT) ) ); protected $webserviceParameters = array(); } ?> Link to comment Share on other sites More sharing options...
alirot Posted June 26, 2019 Author Share Posted June 26, 2019 seems to be my mystake on 'table' => 'ps_category_group', if I remove prefix "ps_", everything were ok thanks 1 Link to comment Share on other sites More sharing options...
Webkul Modules Posted July 2, 2019 Share Posted July 2, 2019 Hello, How are you doing? Glad to hear that our blog has resolved your issue, 🙂 feel free to ask if you need any assistance we would happy to assist you. Regards, Amit Kushwaha 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