JustSaying Posted March 31, 2022 Share Posted March 31, 2022 Is it considered bad practice to update tables with goods (such as for instance changing prices and quantities) directly via SQL requests to the database (if there exists direct access to it)? Is it maybe better to use REST requests to the backend instead? And any specific reasons for the latter or the former? In my view it's easier to just use SQL but maybe I'm missing something. Like maybe there's more than one table to update? Link to comment Share on other sites More sharing options...
knacky Posted April 1, 2022 Share Posted April 1, 2022 (edited) 1. yes, there are more tables 2. There is a Webservice API for importing from xml Product: * without combinations and discounts or special prices = 6 tables * with combinations + 5 tables * with special price + 4 tables * with discount + 2 tables etc.https://devdocs.prestashop.com/1.7/webservice/ Whatever method you want to use, you need to study the documentation. If you want to know which functions and relevant parameters to use, you will find the information in the folder. /classes/*.* Need to know what you need to add a product to the script? Find the add () function. Do you need to modify the product? Look for the update () function. For a programmer who controls Prestashop, it is better to use the Prestashop function. If you put sql in the database and forget something, either the product will not work for you or the loading will be long. For Webservice Api it is necessary to study ws parameters for classes. A lot of beginning programmers or artists who can only use Ctrl + C and Ctrl + V return here with the questions "it doesn't work, I have my own module, what should I do etc ....." I have been programming for Prestashop for 11 years and I don't know everything yet. With each new version of Prestashoo there are new features and old ones do not work, documentation for changes is minimal, it must be studied .... Edited April 1, 2022 by knacky (see edit history) Link to comment Share on other sites More sharing options...
BS TEAM Posted April 1, 2022 Share Posted April 1, 2022 57 minutes ago, knacky said: artists who can only use Ctrl + C and Ctrl + V return here with the questions "it doesn't work, 🤣🤣sad but true 1 Link to comment Share on other sites More sharing options...
JustSaying Posted April 1, 2022 Author Share Posted April 1, 2022 (edited) I see. Well, thanks for the general tips. I'm looking to do syncs from FileMaker and obviously looking for the simplest method to transfer the table data there to Prestashop. I've done that with Shopify, but we created products separately and then linked them together using Shopify product IDs. Then just calling REST requests like "put product 1234: price: 10, qty: 5". So looking for something similar with Prestashop, but instead of re-creating products manually, push/create new ones from FileMaker to Prestashop, establish sync via ids and then re-sync nightly. So obviously I can generate XML or JSON or even issue direct SQL requests as well. Either method will require some learning, so I'm looking for the best one at the moment. Edited April 1, 2022 by JustSaying (see edit history) Link to comment Share on other sites More sharing options...
knacky Posted April 2, 2022 Share Posted April 2, 2022 Each solution has its pros and cons. It might be better to use a ready-made solution such as https://addons.prestashop.com/en/data-migration-backup/44409-shopify-to-prestashop-catalog-synchronization-import.html 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