Search the Community
Showing results for tags 'rest api'.
-
Hi, 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?
- 4 replies
-
- REST API
- Web services
-
(and 3 more)
Tagged with:
-
webservice Transfer special prices conditions via webservice
aidiez posted a topic in Core developers
Hi, I'm trying to find a solution to tranfer special prices and promotions via webservice. But in the API, the fields where you specify restrictions for a special price rule or a cart rule such as country, category, produtc, etc. do not exist. Does anyone know how I can transfer those restictions in the rules method? Or something that could help? Thanks in advance!!- 1 reply
-
- 1
-
- restrictions
- conditions
- (and 8 more)
-
I am adding virtual product in PrestaShop using API and I am using PSWebServiceLibrary. I have successfully added product and its images but when I am trying to add file to download for this product, I didn't find any method in above library and API. So, I need any method to add downloadable file for virtual products in PrestaShop using API. Also, I am using Prestashop's Kit Module which generates product kit from other products. I also need a method to add Stack and its details under Kit Module of a product via webservice or API. I have attached the screenshot of Kit Module that displays while adding or editing a product in PrestaShop.
- 1 reply
-
- prestashop 1.6
- webservice
- (and 5 more)
-
I've been successful in creating an extra table in the prestashop products table throught rest api of webservice , however the api link http://127.0.0.1/prestashop/api/wb3d/1 wb3d is the new table which i have created in webservice . which holds a path to images directory somewhere on the web . this link when opened shows the data which has been saved in the database.. in the following image below model is directory name on the web,so this api(wb3d) has been associated with the product table in the webservice the link:http://127.0.0.1/prestashop/api/products/1 when i open this link . then entry of the association is shown but the data is not shown refer the below image the highlighted area shows the wb3d table associated with the product table through rest api of webservice . i.m unable to associate the wb3d table data with product table data. so i can use it in other devices through webservice i cant figure out what i,m missing here.. if anyone has achieved this . put some insights on this . this is what i have tried till now <?php class ProductMergeCore extends ObjectModel { public $product_id; public $id_wb3d; public $directory_name; public static $definition = array( 'table' => 'wb3d', 'primary' => 'id_wb3d', 'fields' => array( 'id_wb3d' => array('type' => self::TYPE_INT, 'required' => true), 'product_id' => array('type' => self::TYPE_INT, 'required' => true), 'directory_name' => array('type' => self::TYPE_STRING, 'required' =>false, 'size' => 64), ), ); protected $webserviceParameters = array(); } ?> ProductMerge.php is responsible for creating an associate table entry in product table <?php Class Product extends ProductCore { public $extrafield; public function __construct($id_product = null, $full = false, $id_lang = null, $id_shop = null, Context $context = null) { $this->webserviceParameters['associations']['wb3d'] = array('resource' => 'wb3d','fields' => array('directory_name' => array('required' => true))); parent::__construct($id_product, $full, $id_lang, $id_shop, $context); } } ?> in this product.php which is for overriding the product class for passing the extra parameters through webserviceparameters() and then calling the parent constructor of the product class <?php class WebserviceRequest extends WebserviceRequestCore { public static function getResources() { $resources=parent::getResources(); $resources['wb3d'] = array('description' => 'images path', 'class' => 'ProductMerge'); ksort($resources); return $resources; } } ?> WebserviceRequest.php class is a override class for the WebserviceRequest class which shows the description of the table entry in the webservice These are the files which are required to get the things done. what i,m trying to achieve is the associated table (wb3d) data should be available within products table through webservice rest api call. anyone who is familiar with this can give there thoughts.
-
- webservice
- php
- (and 8 more)
-
Good day, dear friends! Trying to solve the problem for several weeks with the import of thousands of Microsoft Word documents at the REST API I have not found the section of virtual files (table ps_product_download). Also I was not able to save the form products through the curl, since I could not deal with the of tokens and session in the backoffice. Prestashop always done a redirect (302) to "sitename/admin0401/index.php?controller=AdminLogin&token=d7218c4a4f379d3b455e5fd45fccefc1&redirect=AdminProducts" even the tokens and cookies have been right. Also I tried to login at AdminLogin controller (CURLOPT_COOKIEFILE and CURLOPT_COOKIEJAR) and after I send curl to AdminProducts Version prestashop 1.6. Please help with at least some of the functional implementation. presto.ru is a locale domain (DNS at my server) $url = 'http://presto.ru/admin0401/index.php?controller=AdminProducts&token=59576455bbd31e4bf712ede77c05a6d2'; rtrim($fields_string, '&'); $options = array( CURLOPT_RETURNTRANSFER => true, // return web page CURLOPT_HEADER => true, // don't return headers CURLOPT_FOLLOWLOCATION => true, // follow redirects CURLOPT_ENCODING => "", // handle all encodings CURLOPT_USERAGENT => "spider", // who am i CURLOPT_AUTOREFERER => true, // set referer on redirect CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect CURLOPT_TIMEOUT => 120, // timeout on response CURLOPT_MAXREDIRS => 10, // stop after 10 redirects CURLOPT_FRESH_CONNECT => true, CURLOPT_SSL_VERIFYPEER => false, // Disabled SSL Cert checks CURLOPT_COOKIE => 'ee71a5687e53d260a86f630d713c16c7=8n%2FM156B1IFMl6JyKvURwD5W%2FjQfsSE1ut6vFMzjFZ4CMgl2ErVV9NRS1dMVhKFoK6UJEmBi6j2S6rTpq4BPc1DrsVZgNOe%2B3%2BcPcXpvr69ejoJVe7ss1WvzBp6kxqhSMyCu9KJ%2B6uWFgp%2F90dz1guFo6WfULIks3iq6e%2BFEgVe4OMBFsLL5M%2FTd2wmNkMVtexu1HjwvIKLVL%2BOXFLJ%2FJmMXQlh6OYIoioNrqnxR1P82WUb%2Ft%2FDuh34nF%2B2cJ%2FV7rIJhHdSvkDgSKC8MDaFwwRep5Lt7LDsMdu73W%2BqHpKikWlyCIcNTqHzMKCUpVli%2BwgDTuM8GbLGSloqfIz7NU1ckBg6ZfGv%2FKzsYFNAO6%2F8ygShS6MVymXGnY6pwJ3tgvC%2FyAFBoJ7R7RkgwurhnwWMltghwnevR1p3KET5CN5INKaXBAtx4Yk8HH0u1PieitrNKG63N7tv6bS9sk732FWJmEvJ2pP0%2F4a4dHpuMCUI%3D000361; __utma=176580068.1616360627.1413726914.1413726914.1413726914.1; __utmc=176580068; __utmz=176580068.1413726914.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); 2a0f1a0291a189ec406f99a4c735e244=8n%2FM156B1IFMl6JyKvURwBcyxX%2F1li63hWLXICHOdvPyRkKBkYtSOZTWRILsBTDNgxX0IjdA2ukBzBVWBI%2BqTx3mlyiNDgwTcju5U181L0BG8%2BMEB%2Fcf1hP6SCRbcCZzw3ngUqlg0K3Gbl7Asvw5HwWc5o0nKFkD0DCunsF5aumxBKW6laQKs1U24FCXliH1bfy2yGHK7euIWdIyMcpCyXh12b9Ez3f2X2Sm8aCu%2Fxc3iToLS%2BDZAW0phFflvvSLIYCGZsvNVRdvxpYWa0TtyXnoMcSWk8AuyD%2FD5N8eWZk%3D000210', ); $ch = curl_init( $url ); curl_setopt_array( $ch, $options ); $content = curl_exec( $ch ); $err = curl_errno( $ch ); $errmsg = curl_error( $ch ); $header = curl_getinfo( $ch ); curl_close( $ch ); $header['errno'] = $err; $header['errmsg'] = $errmsg; $header['content'] = $content; var_dump($header); array(29) { ["url"]=> string(100) "http://presto.ru/admin0401/index.php?controller=AdminProducts&token=59576455bbd31e4bf712ede77c05a6d2" ["content_type"]=> string(24) "text/html; charset=utf-8" ["http_code"]=> int(302) ["header_size"]=> int(624) ["request_size"]=> int(131) ["filetime"]=> int(-1) ["ssl_verify_result"]=> int(0) ["redirect_count"]=> int(0) ["total_time"]=> float(0.074438) ["namelookup_time"]=> float(0.001165) ["connect_time"]=> float(0.001255) ["pretransfer_time"]=> float(0.001296) ["size_upload"]=> float(0) ["size_download"]=> float(0) ["speed_download"]=> float(0) ["speed_upload"]=> float(0) ["download_content_length"]=> float(0) ["upload_content_length"]=> float(0) ["starttransfer_time"]=> float(0.074392) ["redirect_time"]=> float(0) ["certinfo"]=> array(0) { } ["primary_ip"]=> string(12) "178.63.16.66" ["primary_port"]=> int(80) ["local_ip"]=> string(12) "178.63.16.66" ["local_port"]=> int(41922) ["redirect_url"]=> string(120) "http://presto.ru/admin0401/index.php?controller=AdminLogin&token=d7218c4a4f379d3b455e5fd45fccefc1&redirect=AdminProducts" ["errno"]=> int(0) ["errmsg"]=> string(0) "" ["content"]=> string(624) "HTTP/1.1 302 Found Server: nginx/1.2.1 Date: Wed, 29 Oct 2014 12:02:43 GMT Content-Type: text/html; charset=utf-8 Content-Length: 0 Connection: keep-alive X-Powered-By: PHP/5.4.4-14+deb7u11 Set-Cookie: 2a0f1a0291a189ec406f99a4c735e244=0; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/; domain=presto.ru; httponly Set-Cookie: 2a0f1a0291a189ec406f99a4c735e244=wk19Blz4NWrpyLvhiOOx5fxYzWjLnFSqlL9gk7mlrNA%3D000019; expires=Tue, 18-Nov-2014 12:02:43 GMT; path=/; domain=presto.ru; httponly Location: index.php?controller=AdminLogin&token=d7218c4a4f379d3b455e5fd45fccefc1&redirect=AdminProducts Vary: Accept-Encoding " }
-
Hello, I am trying to create a new category using the REST api and POST, I created an access key with privileges on categories. the command I use is curl -u 'myaccesskey:' -d @myxml 'http://myurl/shop/api/categories/' and myxml is a file containing xml='<category> <id_parent>5</<id_parent> <active>1</active> <name><language id="1">TestCategory</language> <language id="2">TestCategory</language> <language id="3">TestCategory</language> <language id="4">TestCategory</language> <language id="5">TestCategory</language> </name> <link_rewrite> <language id="1"/><language id="2"/><language id="3"/><language id="4"/><language id="5"/> </link_rewrite> <meta_title> <language id="1"/><language id="2"/><language id="3"/><language id="4"/><language id="5"/> </meta_title> <meta_description> <language id="1"/><language id="2"/><language id="3"/><language id="4"/><language id="5"/> </meta_description> <meta_keywords> <language id="1"/><language id="2"/><language id="3"/><language id="4"/><language id="5"/></meta_keywords> <description> <language id="1"/><language id="2"/><language id="3"/><language id="4"/><language id="5"/></description> <associations><categories/><products/></associations></category>' I get an error code 127 XML error : String could not be parsed as XML even if xml looks valid and is built from /api/categories?schema=blank my prestashop is version 1.4.6.2 PHP: 5.3.3 any hints? Thanks G.
-
- rest api
- categories
-
(and 1 more)
Tagged with: