slesh Posted October 24, 2018 Share Posted October 24, 2018 (edited) hi all, We are creating an auto parts store and we need to display products based on filters like make, model year, in real time from manufacterer database via API call. Is there any extension for this? Edited October 24, 2018 by slesh (see edit history) Link to comment Share on other sites More sharing options...
joseantgv Posted October 24, 2018 Share Posted October 24, 2018 29 minutes ago, slesh said: hi all, We are creating an auto parts store and we need to display products based on filters like make, model year, in real time from manufacterer database via API call. Is there any extension for this? This is a custom development, you won't find any module. Link to comment Share on other sites More sharing options...
slesh Posted October 24, 2018 Author Share Posted October 24, 2018 hi, thanks for your response. whould you be able do develop such a module? thanks Link to comment Share on other sites More sharing options...
Matt_ Posted October 25, 2018 Share Posted October 25, 2018 Hi You need to be familiar with PHP and SQL and JSON. Create a PHP to perform database queries. <?php require_once 'db.class.php'; DB::$user = 'username'; DB::$password = 'password'; DB::$dbName = 'database'; DB::$host = 'host'; if (isset($_REQUEST['query'])) { $decoded = urldecode($_REQUEST['query']); if (isset($_REQUEST['debug']) && (strtolower($_REQUEST['debug']) == 'on' || $_REQUEST['debug'] == '1')) echo $decoded. " =><br />"; $results = DB::query($decoded); if (isset($results)) { if (isset($_REQUEST['output']) && strtolower($_REQUEST['output']) == 'print_r') echo print_r($results); else { header("Content-Type: text/json"); echo json_encode($results); } } } This code requires your database name, host, username and password to be place in the first few lines. It accept a SQL query has has been URL encoded. It performs the query, using Prestashop's database classes. The result is displayed in JSON format. The code is quite basic but will show you details if you supply good SQL. eg. <my shop url>/querycode.php?query=SELECT * FROM `ps2_module`m JOIN `ps2_module_carrier`mc ON (m.id_module %3D mc.id_module) WHERE m.active %3D '1' AND mc.id_shop %3D '1' (The forum removed most of the encoding from the example above.) 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