lordad Posted November 9, 2020 Share Posted November 9, 2020 (edited) Hi everyone, I'm using prestashop 1.6.1.24 I want to customize Prestashop web service for my own usage but I don't know how I made the Webservice key for product i want a json output like this : a page with all product json { "count": "150", // Total number of products "max_pages": "2", // Total number of pages considering 100 products per page "products": [ { "title": "10 Pro", "subtitle": "10 Pro" "page_unique": "34", // product id "current_price": "5000000", "old_price": "5500000", "availability": "instock", "category_name": "mobile", "image_link": "https://domain.com/images/test.jpg", "page_url": "https://domain.com/product/34/", "short_desc": "A good phone", "spec": { "memory": "4GB", "camera": "12mp", "color": "black", ... }, }, "products": [ { "title": "10 max", "subtitle": "10 max" "page_unique": "314", // product id "current_price": "5000000", "old_price": "5500000", "availability": "instock", "category_name": "mobile", "image_link": "https://domain.com/images/test2.jpg", "page_url": "https://domain.com/product/314/", "short_desc": "A good phone2", "spec": { "memory": "8GB", "camera": "20mp", "color": "white", ... }, }, ... ... ... ... } Edited November 9, 2020 by lordad add tag (see edit history) Link to comment Share on other sites More sharing options...
Razi Posted November 9, 2020 Share Posted November 9, 2020 Hello, yes you can return response like this. $this->response['response'] = array( 'status' => 'success', 'message' => 'Update', 'data' => $data ); return $this->fetchJSONResponse(); protected function fetchJSONResponse() { $response = array(); if (!empty($this->response)) { $response = $this->response; } header('Content-Type: application/json'); return $response; } 1 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