I have a database of products that I will need to import and re-import on a regular basis.
If a product is out of stock or no longer sold by our supplier I need to "sync" with our database.
I have been planning to write a script that would take care of that.
So my question is: Are there any tools or simplified API to do these tasks?
I have been unable to find any info in the docs.
Disclaimer: I know very little of Django and its database models.
Good issue, @OuTopos.
I am thinking about writing same tool for synchronizing stocks and prices from other CMS or ERP systems.
Also, it will be awesome feature, cos many e-commerce projects will want to use Saleor instead or "parallel with" current CMS like Opencart, Magento, Bitrix, Prestashop, etc.
How you will want to solve this task, @OuTopos? What data you have at the inlet? What are capabilities your system have?
My preferred solution would be to have an abstraction layer that would let you do similar things to what you can do in the dashboard.
Something like this:
import saleormanager as sm
certain_product = sm.get_product(id="123")
certain_product.description = "new description"
certain product.save() # Maybe unnecessary
new_prod = sm.add_product()
new_prod.description = "This is a new product"
books = sm.get_catagory(name="Books")
for book in books.products():
#do something
for product in sm.all_products():
#do something
In my case I have to go through a CSV-file with products, add or remove products, update descriptions, price and such things.
I don't know if this abstraction layer would be super useful for other use cases but at least it would be easy to batch add products and manipulate the catalog.
As for export, there is only ready integration with Google Merchant that allows exporting the products feed. As for the import, there is no such tool in Saleor, but in few projects, we had to write our custom tools for that, since we were exchanging data with various, not standard services.
The best way to solve such cases is to write a Django management command, where it is easy to have access to the application's database, input/output files or external APIs. If a periodic synchronization is required, it's a common practice to set up a Cron task that runs the command regularly.
We're going to add some features to support data import/export in Saleor (see the roadmap). Specific issues will be added in the future, once we start working on those features.
Did this move ahead at all since the issue being closed? I'd also like to import a bunch of products and would like to avoid learning a new framework to do it...
We have an issue for CSV import/export (#5174) and an open PR for CSV export of products. Once the export feature is done, we want to start working on import as a separate PR, but it's hard to give some dates when it'll be ready. Anyway this is one of our priorities for the next release of Saleor.
Most helpful comment
We're going to add some features to support data import/export in Saleor (see the roadmap). Specific issues will be added in the future, once we start working on those features.