Jump to content

Matt_

Members
  • Posts

    46
  • Joined

  • Last visited

Everything posted by Matt_

  1. Their OS is Debian but I'm using shared hosting and they probably have the final says about configuration. Although there's a section where I can select the PHP version and it seems I can edit the php.ini... They're using CGI/FastCGI, $_SERVER['SERVER_SOFTWARE'] says Apache/2. Whether they use Apache or Nginx, it most probably call PHP-fpm to execute any PHP. I'm still dubious if I can actually make changes to allow PUT, but I have hope.
  2. That's great Becquel! Unfortunately for me, we don't have a SSL certificate on our site. In a client (insomnia), when I used https, it gave an error. Although my host has an overall certificate, when I used https://mysite.their_address, it just returns my site and ignore the PUT request.
  3. Hi Using the XML you gave, it return '201 Created' - on my installation. Then when I did a GET for the latest customer it had details for today with firstname as becquel, so it seemed to have worked. If you don't get I assume there's some thing disabled by your host.
  4. Hi Can you view the creation XML? Can you view the XML from ps reply? Ensure the XML that you post doesn't contain the encapsulation "CDATA" and ensure the XML is valid code. The data should abide by the SCHEMA synopsis. Try to POST the same data as an existing user - bar an extra few letters... I have a different computer now and the project is in storage but I can remember most... I used an application called something REST client and it was useful to connect and see the XML code.
  5. Hi There's a few people with comments, but you seem to quote my post... I am unable to PUT correctly, so I'm not the best to advise. But I need to know where your problem is and I'll help where I can. Please provide more information about your issue.
  6. Hi I suspect my host is blocking PUT requests. Using a REST client I can test a variety of requests, only PUT is not working. I tried with "text/xml", "application/xml" and some other formats - no difference! Are you having a problem with POST?
  7. Hi In the past I remember pressing the CANCEL button and it returns to the previous screen - as expected. However it is no longer working. Other javascript actions are working, like the AJAX loading spinner in the top-left corner, AJAX form save, and others. Perhaps it because I'm using Safari, since Chrome and Firefox perform as expected. Here is the code Prestashop uses: I have another web-application but it's using: This works fine in all browsers (the ones listed above). I suggest the input-button-code replace the anchor-code.
  8. 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.)
  9. I am unable to successfully make a PUT request using Prestashop's webservice. GET, POST and DELETE work fine. Here is the output from debug on my modified CRUD (like the Prestashop examples https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=4&ved=2ahUKEwi_lc6Z6aHeAhVM64MKHSnTCaQQFjADegQIAhAB&url=http%3A%2F%2Fdoc.prestashop.com%2Fdownload%2Fattachments%2F327702%2F2-Update.php&usg=AOvVaw0GUs_SLEnNe8nxGvoQzIB-) HTTP REQUEST HEADER GET /api/customers/23 HTTP/1.1 Authorization: Basic VVVYWExHM1pTRExGSTg2SkMyVVNCOTE5VUhFUVU3QVA6 Host: example.com Accept: */* HTTP RESPONSE HEADER HTTP/1.1 200 OK Date: Thu, 25 Oct 2018 14:32:15 GMT Content-Type: text/xml;charset=utf-8 Content-Length: 1876 Connection: keep-alive Keep-Alive: timeout=30 Server: Apache Access-Time: 1540477935 X-Powered-By: PrestaShop Webservice PSWS-Version: 1.7.3.1 Execution-Time: 0.021 Content-Sha1: cbeb8d1c1ba601f49651a99d8753d60ed49e1761 RETURN HTTP BODY <?xml version="1.0" encoding="UTF-8"?> <prestashop xmlns:xlink="http://www.w3.org/1999/xlink"> <customer> <id><![CDATA[23]]></id> <id_default_group xlink:href="http://example.com/api/groups/1"><![CDATA[1]]></id_default_group> <id_lang xlink:href="http://example.com/api/languages/1"><![CDATA[1]]></id_lang> <newsletter_date_add><![CDATA[0000-00-00 00:00:00]]></newsletter_date_add> <ip_registration_newsletter></ip_registration_newsletter> <last_passwd_gen><![CDATA[2018-10-05 06:15:45]]></last_passwd_gen> <secure_key><![CDATA[fa9345d70e28bffb4182397ea63f5176]]></secure_key> <deleted><![CDATA[0]]></deleted> <passwd><![CDATA[$2y$10$J7aqIAyfMdQjZqSYAJwElOJIasNKCmSnPmzJGRjpPxHw2k49UJfJe]]></passwd> <lastname><![CDATA[dd]]></lastname> <firstname><![CDATA[aa]]></firstname> <email><![CDATA[ff@q.q]]></email> <id_gender><![CDATA[1]]></id_gender> <birthday><![CDATA[0000-00-00]]></birthday> <newsletter><![CDATA[0]]></newsletter> <optin><![CDATA[0]]></optin> <website></website> <company></company> <siret></siret> <ape></ape> <outstanding_allow_amount><![CDATA[0.000000]]></outstanding_allow_amount> <show_public_prices><![CDATA[1]]></show_public_prices> <id_risk><![CDATA[0]]></id_risk> <max_payment_days><![CDATA[0]]></max_payment_days> <active><![CDATA[1]]></active> <note></note> <is_guest><![CDATA[0]]></is_guest> <id_shop><![CDATA[1]]></id_shop> <id_shop_group><![CDATA[1]]></id_shop_group> <date_add><![CDATA[2018-10-05 12:15:45]]></date_add> <date_upd><![CDATA[2018-10-05 12:15:45]]></date_upd> <reset_password_token></reset_password_token> <reset_password_validity><![CDATA[0000-00-00 00:00:00]]></reset_password_validity> <associations> <groups nodeType="group" api="groups"> <group xlink:href="http://example.com/api/groups/1"> <id><![CDATA[1]]></id> </group> </groups> </associations> </customer> </prestashop> HTTP REQUEST HEADER PUT /api/customers/23 HTTP/1.1 Authorization: Basic VVVYWExHM1pTRExGSTg2SkMyVVNCOTE5VUhFUVU3QVA6 Host: example.com Accept: */* Content-Length: 1400 Content-Type: application/x-www-form-urlencoded HTTP RESPONSE HEADER HTTP/1.1 500 Internal Server Error Date: Thu, 25 Oct 2018 14:32:15 GMT Content-Type: text/xml;charset=utf-8 Content-Length: 282 Connection: keep-alive Keep-Alive: timeout=30 Server: Apache Access-Time: 1540477935 X-Powered-By: PrestaShop Webservice PSWS-Version: 1.7.3.1 Execution-Time: 0.017 XML SENT <?xml version="1.0" encoding="UTF-8"?> <prestashop xmlns:xlink="http://www.w3.org/1999/xlink"> <customer> <id>23</id> <id_default_group xlink:href="http://example.com/api/groups/1">1</id_default_group> <id_lang xlink:href="http://example.com/api/languages/1">1</id_lang> <newsletter_date_add>0000-00-00 00:00:00</newsletter_date_add> <ip_registration_newsletter></ip_registration_newsletter> <last_passwd_gen>2018-10-05 06:15:45</last_passwd_gen> <secure_key>fa9345d70e28bffb4182397ea63f5176</secure_key> <deleted>0</deleted> <passwd>kB670xK3sO</passwd> <lastname>Manager</lastname> <firstname>Yuma</firstname> <email>sales@example.com</email> <id_gender>1</id_gender> <birthday>0000-00-00</birthday> <newsletter>0</newsletter> <optin>0</optin> <website></website> <company>qwerty</company> <siret></siret> <ape></ape> <outstanding_allow_amount>0.000000</outstanding_allow_amount> <show_public_prices>1</show_public_prices> <id_risk>0</id_risk> <max_payment_days>0</max_payment_days> <active>1</active> <note></note> <is_guest>0</is_guest> <id_shop>1</id_shop> <id_shop_group>1</id_shop_group> <date_add>2018-10-05 12:15:45</date_add> <date_upd>2018-10-05 12:15:45</date_upd> <reset_password_token></reset_password_token> <reset_password_validity>0000-00-00 00:00:00</reset_password_validity> <associations></associations> </customer> </prestashop> RETURN HTTP BODY <?xml version="1.0" encoding="UTF-8"?> <prestashop xmlns:xlink="http://www.w3.org/1999/xlink"> <errors> <error> <code><![CDATA[127]]></code> <message><![CDATA[XML error : String could not be parsed as XML XML length : 0 Original XML : ]]></message> </error> </errors> </prestashop> Other errorThis call to PrestaShop Web Services failed and returned an HTTP status of 500. That means: Internal Server Error. Summary: It sends a GET request, for the supplied customer, and displays it in a form. When the UPDATE button is clicked, it issues a PUT request of the entered data. Can somebody test this on their installation to determine whether I'm doing it correctly. (You'll need to create an API webservice key [with all permissions] and a test customer [that can deleted later]. Then update that customer with some random data. Please share the debug output - remember to remove the Host or Authorization.) (Attached: CRUD Tutorial - Update example) 2-Update.php
  10. Hi There's a switch in `Advanced Parameters > WebService`: Enable CGI mode for PHP Before choosing "Yes", check that PHP is not configured as an Apache module on your server. Is there a method to check this via code? Like can it not be a silly value in the root .htaccess and test is a 500 error is returned... or whatever...? The operator at my web host, first said no then yes ... How can I know for sure?
  11. Can someone help me? I'm stuck on PUT, where I update a record and send it back. With POST - to insert a new record, I first GET the blank schema insert my details (in plain text) then POST the construction to the same URL and it does the magic and sends a response of the entire record with formatted details including the assigned id. Works fine! But with PUT - to update the details, I. first GET the record (by id) change as is needed then I PUT the XML back to the same URL. So it is similar to above, but it fails: <?xml version="1.0" encoding="UTF-8"?> <prestashop xmlns:xlink="http://www.w3.org/1999/xlink"> <errors> <error> <code><![CDATA[127]]></code> <message><![CDATA[XML error : String could not be parsed as XML XML length : 0 Original XML : ]]></message> </error> </errors> </prestashop> How is the PUT different, what extra steps are needed?
  12. I have further tests to go... but the problem seems to be that I added an extra line (and it's closer). Specifically `"<customers>"` One test worked with a REST client application (by WizTools.org) and its respond was as excepted. I assume that the extra wrapper caused the invalid XML error... testing properly UPDATE I successfully created a new customer! Found in the request, the data shouldn't be wrapped in CDATA (ie. <abc><![CDATA[input_data]]></abc> where I want insert input_data in abc) now to PUT...
  13. Hi I just tried to upgrade (from 1.7.1.1 -> 1.7.1.3). But a similar situation happens almost every time. (I guess the issue is due to a few rouge files that became corrupt from my FTP client - asked web host technical assistance.) Is there a way to manually place this file? After that can I instigate the database upgrade manually? (I assume this wasn't done...it may have...) Error logs show: PHP Fatal error: Uncaught exception 'Symfony\Component\Filesystem\Exception\IOException' with message 'Cannot rename ".../app/cache/prod/translations/catalogue.fr-QC.8739602554c7f3241958e3cc9b57fdecb474d508.php.me5czIG4" to ".../app/cache/prod/translations/catalogue.fr-QC.8739602554c7f3241958e3cc9b57fdecb474d508.php.meta".' in .../vendor/symfony/symfony/src/Symfony/Component/File 20180624T074854: .../index.php PHP Fatal error: Uncaught exception 'Symfony\Component\Filesystem\Exception\IOException' with message 'Cannot rename ...app/cache/prod/translations/catalogue.fr-QC.8739602554c7f3241958e3cc9b57fdecb474d508.phpMJH7iA" to ".../app/cache/prod/translations/catalogue.fr-QC.8739602554c7f3241958e3cc9b57fdecb474d508.php".' in .../vendor/symfony/symfony/src/Symfony/Component/Filesystem/F 20180624T124346: .../admin.../autoupgrade/ajax-upgradetab.php PHP Warning: filesize(): stat failed for .../simple/20170422/tutorial/images/download/download.pngZone.Identifier in .../modules/autoupgrade/AdminSelfUpgrade.php on line 3709 20180624T133113: .../admin.../autoupgrade/ajax-upgradetab.php PHP Fatal error: Call to a member function can() on a non-object in .../src/Adapter/Module/AdminModuleDataProvider.php on line 165
  14. Can anyone provide anything that may help?
  15. Hi How can I send a PUT / POST HTTP request, without PHP? I have used PHP a heap, but now I writing for a smartphone. (Using Swift, Java and was C#). (If asked, I can show the swift code that I use.) GET is simple, you can also just put the URL in a web browser to get a response. I have several functions to get customers, addresses, products, etc. and these work well. (I have many object models - like a database table structure - that store the data.). (Because JSON is much easier to decode/encode, I apply "&output_format=JSON". If only I could also PUT / POST JSON...) However when it comes to making a PUT / POST (and probably DELETE in the future...) request I keep getting errors. (I know this is probably the wrong way: but I created a module where you can POST the customer's email and password. The template would provide either the complete customer record - if validated - or "BAD" if no record with matching details was found. The request content is like "email=xxx&passwd=yyy" (application/x-www-form-urlencoded) and is translated to UTF-8; then the Content-Length is set.) Using Fiddler, I can view the exact transaction (request & response): [see: https://ibb.co/kC0QTy] When I attempt a PUT request and I send XML (wish I could send JSON instead): PUT http://example.com/api/customers?ws_ket=ABC..XYZ Content-Type: application/xml; charset=utf-8 Accept: */* ... <?xml version="1.0" encoding="UTF-8"?> <prestashop xmlns:xlink="http://www.w3.org/1999/xlink"> <customers> <customer> <id> ... </customer> </customers> </prestashop> It responds with: HTTP/1.1 500 Internal Server Error Content-Type: text/xml; charset=utf-8 ... <?xml version="1.0" encoding="UTF-8"?> <prestashop xmlns:xlink="http://www.w3.org/1999/xlink"> <errors> <error> <code><![CDATA[127]]></code> <message><![CDATA[XML error : String could not be parsed as XML XML length : 0 Original XML : ]]></message> </error> </errors> </prestashop> And much the same for a POST. What do I need to send XML, using PUT and POST?
  16. Hi When I attempted to modify the link list, an error appeared. The error seems to try to put custom cms content into the sql statement as a column - obviously this doesn't really exist. In the error section, I expanded the list of arguments. [PrestaShopDatabaseException]Unknown column 'custom_content' in 'field list' UPDATE `ps2_link_block_lang` SET `name` = 'Our company', `custom_content` = '[]' WHERE `id_link_block` = 2 AND `id_lang` = 1 at line 744 in file classes/db/Db.php 739. if ($webservice_call && $errno) { 740. $dbg = debug_backtrace(); 741. WebserviceRequest::getInstance()->setError(500, ' '.$this->getMsgError().'. From '.(isset($dbg[3]['class']) ? $dbg[3]['class'] : '').'->'.$dbg[3]['function'].'() Query was : '.$sql, 97); 742. } elseif (_PS_DEBUG_SQL_ && $errno && !defined('PS_INSTALLATION_IN_PROGRESS')) { 743. if ($sql) { 744. throw new PrestaShopDatabaseException($this->getMsgError().'<br /><br /><pre>'.$sql.'</pre>'); 745. } 746. 747. throw new PrestaShopDatabaseException($this->getMsgError()); 748. } 749. } DbCore->displayError - [line 378 - classes/db/Db.php] - [1 Arguments] DbCore->query - [line 554 - classes/db/Db.php] - [1 Arguments] DbCore->execute - [line 329 - modules/ps_linklist/src/LinkBlockRepository.php] - [1 Arguments] LinkBlockRepository->createOrUpdateLinkList - [line 298 - modules/ps_linklist/controllers/admin/AdminLinkWidgetController.php] - [4 Arguments] Argument [0] 2 Argument [1] 28 Argument [2] {"cms":["4"],"product":["new-products","best-sales"],"static":["contact","stores","authentication"]} Argument [3] Array ( [1] => [] [2] => [] )
  17. When I selected the appropriate domain (shop), it downloaded fine. Somehow the 'All shops' cause an incorrect check sum...????
  18. Hi When use "1 Click Upgrade" I get this, "Downloaded archive will come from https://www.prestashop.com/download/releases/prestashop_1.7.0.5.zipMD5 hash will be checked against a48191b3e46965548687535372bcc1df downloading from https://www.prestashop.com/download/releases/prestashop_1.7.0.5.zipfile will be saved in /.../autoupgrade/download/prestashop.zip download directory has been emptied Download complete but MD5 sum does not match (d41d8cd98f00b204e9800998ecf8427e)." Over and over again. What work-around is there?
  19. I did a manual upgrade from 1.7.0.3 to 1.7.0.4. I sortof followed the manual upgrade instructions that they recommend not to do. My live store was 1.7.0.3 and I wanted a working test copy. Sometimes in the past, I've had some hiccups with the 1-click upgrade module - sometimes it goes well. 1) I downloaded, unzipped and installed 1.7.0.4 and then check it worked OK, into a sub directory called /2. (BTW I created a new blank database). 2) Next I copied my backuped /img, /modules, /themes (no changes in /mail, /upload, /download or /classes) directories into the new install. 3) Then using PhpMyAdmin, I imported my backup database. (Because it has a different prefix, it was imported next to the original - I could have just installed 1.7.0.4 with the same prefix as the backup, but wanted a fallback option). 4) The only change here (using PhpMyAdmin) was the 'shop_url' table, where I altered the 'physical_uri' to '/2/' (the name of my sub directory). 5) Then I changed the installed file /app/config/parameter and changed the db_prefix to my new database import. 6) I didn't bother with upgrade script (was supposed to visit http://mydomain.com/2/install/upgrade/upgrade.php), but I decided to manually press the upgrade button next to each module - looking back, it would have better to use the script. 7) Then for some unknown reason I had to re-hook my custom modules: Using Design > Positions, I transplanted each custom module to the relevant hook. 8) All seem to function OK. This was more like duplicate, but you should be able to use similar steps to upgrade your store. Perhaps do the above and if it works, delete then copy these file into your root (or wherever your live site exists). Always have a backup! If want to reference the Prestashop doc: http://doc.prestashop.com/display/PS15/Manual+update Remember the reference instructions are old and not recommended
  20. I was in a similar situation. Because so much has changed in 1.7, there seems no possibilities yet. I have manually upgraded sites before with success, but never tried 1.6 -> 1.7! Although several methods have been left in to use some older modules, not all will function as intended. And themes will almost always fail. Even the Prestashop.com promotes 1.6 and it is preferred. New stores should begin with 1.7 and upgrades is not advised! All existing installs (1.6 or below), should upgrade to the latest 1.6 or stay there. Like many others, I have run into problems with 1.7. Guess it's so new that not all bugs have been ironed-out.
  21. Hi I've installed 1.7 several times, using 0 - 4. Never have I managed to get the Welcome to function. After I install and go to the dashboard, it says "Welcome to your shop!", I click the button and hangs. I've tried this on my desktop using Firefox and Chrome and IE (latest versions). No go. I suspect this module only works on mobile devices... Can anyone get this to work? If so how..what device..what browser?
  22. Actually I have discover that when you click "Save" or "Go to Catalog" or "Add New Product", sometimes it works and sometimes it doesn't. So without changing anything, if it says not saved, click again and may work! This is very erratic behavior!
  23. Thank you that is good to know for backup needs. However I would still like to know how to multiple associate categories to a product. Please help.
  24. Hi Using the upgrade module I tried to upgrade from 1.6 and it failed. (Since it got stuck in Maintenance mode...) Again when I self installed 1.7.0.0, it again failed. (Side note: I have over 100,000 files -outside PS- that don't need backup, 1-click-upgrade take hours to back them up.) So I decided to erase all files and install 1.7.0.2 fresh, this issue relates to this version. Upon creating a new product it saves OK when I add it to the Home (tier1) category and a tier2 category. But if I create a product and try to associate it to Home category, a trier2 category and a tier3 category, it fails! (Eg. Tier1 would be 'Home'; a tier2 would be 'Footwear'; a tier3 would be 'Men's runners'. Other tier2 categories may be 'Summer dresses', 'Accessories', etc.) Additionally I set each product to a tier2 category as the default/main category. How can I add a product to many categories?
  25. Hi I wish to report a typo in BO > Design > Theme & Logos, it says: SELECT A THEME FOR THE "HTMLSPECIALCHARS" SHOP. Theme & Logo > Theme It should say the shop name where it has HTMLSPECIALCHARS...
×
×
  • Create New...