Hi David!
I have some questions about the importing part, especially when we already imported one feed and are looking to update that.
1. Let's suppose I have the feed megastore.csv and I have imported it. Tomorrow the store updates their feed and I want to import it again. Basically what I would do is delete the megastore.csv and upload the new megastore.csv (with the same exact name) and then press import on /admin?
2. How does this updating works, does it overwrite each product name, price, etc... on the database? Or does it check the fields on the rows for changes and only updates the changed ones? What is dupe_hash for?
3. Imagine that I have a feed whose product names are in another language and I translate it to the english. Then I import this feed. Tomorrow the store changes the prices and adds more products. If I wanted to import these products again would I have to translate all the product names to english again?
Thank you very much for reading David. I'm very satisfied with the script!
Regards,
Pedro
Thank you very much for the clear response, David.
Also let me say that the search and replace feature is a very good suggestion for the purpose.
Hi Pedro,
Thanks for your comments!
> 1. Let's suppose I have the feed megastore.csv and I have imported it.
> Tomorrow the store updates their feed and I want to import it again.
> Basically what I would do is delete the megastore.csv and upload
> the new megastore.csv (with the same exact name) and then press
> import on /admin?
Exactly right! You only need to register the first time. After that, whenever you update a feed you only need to click Import in /admin/
> 2. How does this updating works, does it overwrite each product name,
> price, etc... on the database? Or does it check the fields on the
> rows for changes and only updates the changed ones? What is
> dupe_hash for?
The updating actually starts by DELETEing every product for the feed being imported. This is the most efficient way to do it, since it doesn't involve checking to see whether every product being imported already exists (requiring a SELECT query). This guarantees that the database is fully up to date with the latest feed.
The dupe_hash field is an efficient mechanism for preventing the importing of duplicate products, as for the script to work a product name must be unique per merchant. The dupe_hash value is calculated as an MD5 of the combination of merchant name + product name, and has a UNIQUE key applied to it in the database, so again, no checking needs to be done to see if a product already exists for that merchant, as the SQL will simply fail if there is already the same dupe_hash value in the database.
> 3. Imagine that I have a feed whose product names are in another
> language and I translate it to the english. Then I import this
> feed. Tomorrow the store changes the prices and adds more
> products. If I wanted to import these products again
> would I have to translate all the product names to
> english again?
Assuming that you have to go through a manual process to translate the product names anyway, I would suggest implementing this using a series of Search and Replace filters. Click Filters alongside the non-English feed and add as many Search (foreign name) and Replace (English name) filters against the Product Name field as you need.
These filters will then stay in place whenever you update / re-import the feed, and then you simply need to add new ones whenever a new product is added (or the name of an existing product changes slightly causing the search and replace not to be applied).
If you use this approach and have spent lots of time on your translations, don't forget to use the Database Tool (/admin/ menu) to backup feed registration / filters to a file that you keep safely on your local computer just in case!
Cheers!
David.