Search the Community
Showing results for tags 'web services'.
-
Hi, I am trying to make a web request to a site made with Prestashop (v.1.7.3 with dummy content) in order to show the list of products and the product details (including images) within a table view of an iOS app I am currently prototyping using SWIFT 4. No intention so far to put new products nor make purchases through the app, just mirror the shop in the app. I have checked the Prestashop Web Services documentation, created an auth key and I have found that it is possible to get the products in JSON format using an url formatted as: http://access_key@my_website.com/api/products?output_format=JSON What I get is the following JSON file: {"products":[{"id":2},{"id":4},{"id":8},{"id":1},{"id":16},{"id":17},{"id":18},{"id":6},{"id":7},{"id":9},{"id":10},{"id":11},{"id":15},{"id":19},{"id":3},{"id":5},{"id":12},{"id":13},{"id":14}]} It seems something like a dictionary, with only the identifiers of each product. Now I am stuck, since I do not know how to extract more info about each product from this JSON file. The Prestashop Web Services documentation is not very clear and it is basically php oriented. Thanks for any suggestion or reference to study!
-
Hi, and thanks and appreciate any help, debug report attached.: My error: testyOther errorThis call to PrestaShop Web Services failed and returned an HTTP status of 400. That means: Bad Request. <?php define('DEBUG', false); // Debug mode define('PS_SHOP_PATH', 'Taken out'); // Root path of your PrestaShop store http://www.myshop.com/ define('PS_WS_AUTH_KEY', 'Taken out); // Auth key (Get it in your Back Office)ZQ88PRJX5VWQHCWE4EE7SQ7HPNX00RAJ require_once('./PSWebServiceLibrary.php'); try { $webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG); $opt = array('resource' => 'products'); if (isset($_GET['id'])) $opt['id'] = $_GET['id']; $xml = $webService->get($opt); // Here we get the elements from children of customer markup which is children of prestashop root markup $resources = $xml->children()->children(); } catch (PrestaShopWebserviceException $e) { // Here we are dealing with errors $trace = $e->getTrace(); if ($trace[0]['args'][0] == 404) echo 'Bad ID'; else if ($trace[0]['args'][0] == 401) echo 'Bad auth key'; else echo 'Other error<br />'.$e->getMessage(); } if (isset($_GET['id']) && isset($_POST['id'])) // Here we check id cause in every resource there's an id { // Here we have XML before update, lets update XML with new values foreach ($resources as $nodeKey => $node) { $resources->$nodeKey = $_POST[$nodeKey]; } // And call the web service try { $opt = array('resource' => 'products'); $opt['id'] = $_GET[ 'id' ]; $opt['putXml'] = $xml->children()->asXML(); $xml =$webService->edit($opt) ; // if WebService don't throw an exception the action worked well and we don't show the following message echo "Successfully updated."; } catch (PrestaShopWebserviceException $ex) { // Here we are dealing with errors echo "testy"; $trace = $ex->getTrace(); if ($trace[1]['args'][0] == 404) echo 'Bad ID'; else if ($trace[0]['args'][0] == 401) echo 'Bad auth key'; else echo 'Other error<br />'.$ex->getMessage(); } } if (isset($_GET['id'])) echo '<form method="POST" action="?id='.$_GET['id'].'">'; ?> <br> <table class="table table-striped table-bordered table-hover" data-provide="datatable" data-info="true" > <?php if(isset($resources)) { if(!isset($_GET['id'])) { ?> <thead> <tr> <th data-filterable="true">Product's Id</th> <th data-filterable="true">Manufacturer</th> <th data-filterable="true">Supplier</th> <th data-filterable="true">Price</th> <th data-filterable="false" class="hidden-xs hidden-sm">Update</th> </tr> </thead> <tbody> <?php foreach ($resources as $resource ) { $opt['id'] = $resource->attributes(); $xml = $webService->get($opt); $r = $xml->children()->children(); //print_r($r2); //print_r($r); echo '<tr>'; echo '<td>'.$r->id.'</td>'; echo '<td>'.$r2->name.'</td>'; echo '<td>'.$r3->name.'</td>'; echo '<td>'.$r->price.'</td>'; echo '<td><a href="?id='.$resource->attributes().'">Update</a></td>'; echo '</tr>'; } } else { foreach ($resources as $key => $resource) { echo '<tr>'; echo '<th>'.$key.'</th><td>'; echo '<input type="text" id="name" name="'.$key.'" value="'.$resource.'" class="form-control" data-required="true" >'; echo '</td></tr>'; } } } ?> </tbody> </table> <?php if (isset($_GET['id'])) echo '<input type="submit" class="btn btn-success" value="Update"></form>'; ?> </div> <!-- /.table-responsive --> </div> <!-- /.portlet-content --> </div> <!-- /.portlet --> </div> <!-- /.col --> </div> <!-- /.row --> I have searched every corner of the web and tried everything. I am sure its something simple I can not see. So frustrating. Thanks. debugreport.txt
-
Bonjour à tous, Je suis en train de développer un module spécifique sur mon Prestashop (1.6) pour la gestion de mes commandes en marque blanche, directement lié à mon fournisseur mais je coince un peu. Je me suis fais un petit workflow que voici : Page de paiement > Passage de la commande à un statut "Vérification de la commande en cours", qui en fait est l'étape où je vais créer la commande chez mon fournisseur via un webservice. Si c'est ok, je redirige le client vers la banque, pour lui, c'est transparent. Si il y a une erreur lors de la création de la commande (produit non dispo ou autres erreurs), je redirige le client vers son panier avec une notice explicative. La suite du process est classique, le client paie, je valide la commande dans Prestashop et chez mon fournisseur, ou alors il y a une erreur de paiement, et je le renvoi sur son panier. Le coin où je bloque, c'est sur l'étape AVANT le paiement, il n'y a pas de hook "beforePayment" par exemple, du coup je ne sais pas comment gérer ma commande fournisseur entre le choix du mode de paiement, et l'envoi directement sur le paiement. Si quelqu'un à une idée pour débloquer mon problème, une astuce pour la création d'un hook avant le paiement ou autre, je suis preneur ! (La finalité, c'est que si il y a une erreur de commande, le client n'est pas payé avant, pour ne pas avoir à le rembourser etc) Merci d'avance, Thymotep
-
Hi, Is Prestashop suitable for sales of web services : domain, hosting, etc? If so, can you kindly direct me to some sample websites please. Thanks
-
Hello, i am looking for a way to make our business ERP & PS store to communicate and update each other for specific items. I read the web services documentation but because of luck on experience i will need some help from the community. I tested the basic examples that are shared on github and i am surprised why more examples are not shared. What we try to accomplish is: From ERP to ESHOP : 1. update product availability 2. order status update From ESHOP to ERP : 1. New order export (customer info should be extracted separately?) I bet someone must have already completed similar tasks. Any help or how to guide would be appreciated. If i have understand the logic correctly, it goes like this: A. We export an xml, csv (any kind of file) from erp db with product_id & availability , lets say test.xml B. We use PSWebServiceLibrary.php and a custom function (inside another php file) to read values from test.xml and update availability that meets product_id to PS db via the web service. C. We set a cron job for these php files.
-
- 1
-
-
- web services
- api
-
(and 2 more)
Tagged with:
-
Hi, I'm working on an application to manage stock using Prestashop Webservices. I'm trying to get the "associations" element for several "combinations" in only one request, so I'm trying the following: /api/combinations?display=[id,associations]&filter[id]=[id1,id2] This idea works for other elements such as: api/stock_availables?filter[id]=[id1|id2]&display=[id,id_product_attribute,quantity] (That request allows me to get information about several "stock_availables" elements in only one request). My app works if I query each combination element one by one but that is far from being efficient. Any ideas?
-
- web services
- api
-
(and 3 more)
Tagged with:
-
Bonsoir, Je crée un webservice de mettre à jour les produits dans le magasin. http://doc.prestashop.com/display/PS15/Chapter+5+-+Modification+-+Update+client miodominio/shop' 'valueKey', true); try { // Define the resource $opt = array( 'resource' => 'products' ); // Define the resource id to modify $opt[ 'id' ] = 2; // Call the web service, recuperate the XML file $xml = $webService->get( $opt ); // Recuperate resource elements in a variable (table) $resources = $xml->children()->children(); foreach ( $resources as $nodeKey => $node ) { if($nodeKey=='price'){ $resources->$nodeKey = '330'; } } $opt = array( 'resource' => 'products' ); // Resource definition $opt[ 'putXml' ] = $xml->asXML(); //XML file definition $opt[ 'id' ] = 2; // Definition of ID to modify // Calling asXML () returns a string corresponding to the file $xml = $webService->edit( $opt ); // Call } catch (PrestaShopWebserviceException $ex) { // Shows a message related to the error echo 'Other error: <br />' . $ex->getMessage(); } Je me montre ce message d'erreur, "Autre erreur: Cet appel aux services Web PrestaShop a échoué et renvoyé un état HTTP 400. Cela signifie: Bad Request ". Quelqu'un peut m'aider. Merci.
-
Hello, I am trying to use Prestashop Web Services in a specific port for long execution time operations. This port is 8111. The problem is when I try acces to myWebsite.com:8111/api?ws_key=ADWE415... it redirect me to myWebsite.com/?ws_key=ADWE415... How can I do to access to the Web Services using this port? All your help will be apreciate. Thanks, Samuel
-
- Web services
- Redirections
-
(and 1 more)
Tagged with:
-
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:
-
Доброго времени суток коллеги. Возможно кто то уже сталкивался с проблемой, никак не возьму в толк что не так. В Админке включен Web сервис, включен ЧПУ, создан ключ с определенными правами доступа. Однако, при попытке соединиться с сервисом через скрипт получаю 401 ошибку "не верный ключ", а при попытке подключиться через браузер, выбрасывает повторно форму авторизации. В документации написано что такая ситуация может быть когда для ключа не заданны права доступа, однако админка показывает обратное. Версия Престы 1.5.5 Заранее благодарен Вам за помощь.
-
I know the topic of integrating prestashop into another website with a common login has been discussed before in the forums, but I wanted to revive the discussion and see if there are any new ideas. I have an existing website with its own user database that already has already has all the existing fields that would normally exist in the prestashop user database. A user would arrive to prestashop only through this existing website and only while already being logged onto it. One of the new options for him/her will be something like "Access the Shop". My thoughts are as follows: 1. Activate web services in my prestashop 2. Allow my existing website to consult if the user already exists in Prestashop (via the API) or if his/her existing record has any changes 3. Create a new record if the user does not exist or amend it if there are changes. This would occur without the user noticing by just reading data from my existing table and inserting into Prestashop via the API. 4. Log the user onto Prestashop seamlessly (thereby creating a new Prestashop cookie) 5. Disable all forms of access to the Prestashop login and Prestashop User area 6. On future logins I would also have to check if the user is already logged into Prestashop Am I more or less on the right track? After spending a day investigating webservices, and downloading the PHP webservice library and some very useful PHP example files from https://github.com/PrestaShop/PrestaShop-webservice-lib I am comfortable with stages 2 and 3. I then perform the login in stage 4 using the email and password from the existing session and sending it via POST to /index.php?controller=authentication Is there an easier way to do all of this such as with a single sign on? Does anybody else have any leads or experience with doing something like this? Thank you very much in advance. p.s. The posts in the forum that I have consulted so far are: http://www.prestashop.com/forums/topic/204227-webservice-and-check-if-user-is-logged-in/ http://www.prestashop.com/forums/topic/156218-solvedish-integrating-prestashop-into-a-pre-developed-website/ http://www.prestashop.com/forums/topic/230605-is-it-possibile-to-integrate-login-and-user-address-from-external-app/ http://www.prestashop.com/forums/topic/231938-forcing-access-to-prestashop-via-another-website/
- 4 replies
-
- login
- web services
-
(and 6 more)
Tagged with:
-
Hi buddies, I've recently created a prestashop website working with the multi-shop service implemented since version 1.5. I created some shops and one employee by shop with limited access. I'm currently developping an admin plateform using the prestashop web service (no database). The authentification uses the employee table by webservice and works fine. But, once logged, i can't access to the list of allowed shops for this specific employee. I found the link table in the database but nothing in the list of available entities by webservice. the only datas given by the webservice are these: <employee> <id>2</id>[/indent] <id_lang xlink:href="*********">1</id_lang>[/indent] <last_passwd_gen>2013-08-19 05:47:36</last_passwd_gen>[/indent] <stats_date_from>2013-08-19</stats_date_from>[/indent] <stats_date_to>2013-08-19</stats_date_to>[/indent] <passwd>******************</passwd>[/indent] <lastname>default</lastname>[/indent] <firstname>default</firstname>[/indent] <email>*********@gmail.com</email>[/indent] <active>1</active>[/indent] <id_profile>2</id_profile>[/indent] <bo_color/>[/indent] <default_tab>1</default_tab>[/indent] <bo_theme>default</bo_theme>[/indent] <bo_width>0</bo_width>[/indent] <bo_show_screencast>0</bo_show_screencast>[/indent] </employee> My final goal is to find orders of the day for all shops allowed for the authentified employee. If anybody has a solution to display available shops, it should be very fine . Thank's in advance,
- 3 replies
-
- 1
-
-
- webservice
- web services
-
(and 1 more)
Tagged with:
-
Bonjour, Je suis un étudiant en alterance et je rencontre un gros problèmes pour l'utilisation des Web Services de prestashop avec WinDev. J'ai bien entendu lu les autres post sur le sujet mais je n'arrive pas à utiliser ces Web Services étant début en WinDev. Si quelqu'un pouvait me montrer quelques pistes, pour que je puisse avancer. Je ne comprends pas quel fichier xml envoyé pour un ajout ou même une modification ? et encore moi comment les envoyer ? Merci d'avance Paul
- 1 reply
-
- web services
- prestashop
-
(and 2 more)
Tagged with:
-
Hi, Could anyone please point me in the direction of a tutorial that explains how to create custom web service? I'm not after the tutorial that teaches the basics of using the web services but how to create and list them. I have some custom functionality required and I need to access it from an other web site, hence the requirement to create some web services from scratch. If there is not a tutorial I would appreciate some information on the subject. Thanks, Lance
- 3 replies
-
- Web Services
- Customise
-
(and 1 more)
Tagged with:
-
Hola a todos, soy nuevo como usuario de Prestashop y escribo este post para ver si alguien que me pueda echar una mano: Mi pregunta es la siguiente: Creeis que es posible atacar la base de datos de prestashop en un servidor remoto desde una máquina cliente utilizando los webservices? Me explico: Mi objetivo es desarrollar una aplicación para gestionar productos y demás desde un ordenador cliente de forma automatizada. Éste debería modificar, eliminar y/o añadir datos a la base de datos de un Prestashop (en un servidor). El programa estará desarrollado en .NET y no estoy seguro que desde una aplicación .NET pueda utilizar los webservices de Prestashop. ¿Alguna idea? ¿Alguien sabe algo al respeto? Gracias de antemano.
- 2 replies
-
- web service
- web services
-
(and 2 more)
Tagged with:
-
Hi! First of all, thank you for your work, is an amazing project. I have a problem while trying to Activate the Web Service, by default the radiobuttons is selected in OFF but when I press ON, nothing happends and there's no "Save" button, so if I navigate or try to reload is OFF again. ¿Any idea? If it's a file or a table in whick i can turn this option to TRUE manually would be great because i want to test the Web Service in 1.5. Thank you again!!!
-
Hi! I am new to Prestashop, and am wanting to automate my product inventory using a third party vendors XML-API code they emailed to me to perform various specific functions: 1. Be able to send the Order Processing data from my store to the distributor and receive a confirmation in return. 2. Be able to Auto-Update my Catalog/Products and attributes such as price, availability, etc. NOTE: I have imported CSV files into my store successfully. I am familiar with HTML/Java, and have read up on SOAP, WSDL, and Web Services. I have enabled Web Services and was able to view the generated XML's after logging in with the Generated Key. ...however; 1. After setting up web services for my site, I am not certain about the process to integrate the XML files I received from the distributor...I have at least 5 XML files that include (a) enter order ( query inventory © query order status....etc, etc Can someone point me to the next step in my process to get these XML API files integrated into my store so that I can direct my customer purchases directly to my distributor via the XML API and receive/verify same in return? Thank You in Advance for ANY assistance you can provide! Kind regards, axetone
- 4 replies
-
- Web Services
- Order Processing
-
(and 1 more)
Tagged with: