indigo380 Posted May 30, 2018 Share Posted May 30, 2018 I have about a thousand products that we will be importing via csv. Each of these products has a different data sheet (PDF). How can I import the product with the file/attachment? I didn't see a way to do it via import or API. I would be open to any modules that could do this as well. Has anyone had any success with this before? I'm on Prestashop 1.7. Link to comment Share on other sites More sharing options...
Samson Posted June 5, 2018 Share Posted June 5, 2018 Hi! You can refer to this thread - https://www.prestashop.com/forums/topic/349844-uploadable-files-pdf-attachment-in-csv-import/ However, code there is for Presta 1.6, so not sure if this works for 1.7. Alternatively, here is tutorial ho to import attachments with module - https://www.prestashopmanager.com/useful-articles/how-to/how-to-import-prestashop-product-attachments/ Link to comment Share on other sites More sharing options...
dirtrider118 Posted September 9, 2021 Share Posted September 9, 2021 (edited) I'm sure the same logic may work for 1.7 but for my shop on 1.6.1.17 I can confirm the following works. I seen a few other ways but seemed quite complicated and involved modifying core files. Not sure how this works with multi-shops. If you look at the below three tables you can fill out the data via excel and import the csv into phpMyAdmin for your site. ps_attachment - Details on file name and format ps_attachment_lang - Attachment name and description to display on front end ps_product_attachment - Ties the ID of the attachment to the product ID !!!!!!!!!!!!!BACKUP ALL 3 TABLES ABOVE BEFORE IMPORTING!!!!!!!!!!!!! How to import attachments with CSV and assign to product: Place all your files (JPG, ZIP, PDF etc.) into the downloads folder in the main shop directory. In my folder the filenames are encoded without an extension like "be7e7fa051951cf". Fill out the attached template and export each tab as CSV. You may notice previously uploaded files added through the back end will show encoded text values under the column "file" in the phpMyAdmin database. For this just match these values to exactly the same as the filenames you uploaded to the download folder (YOURFILENAME.zip). Make sure to fill out the mime field. If you are unsure about the value needed, upload the file through the backend and then check the phpMyAdmin ps_attachment database for the latest ID. Your mime type value will be in the mime column such as "application/zip". To get the file sizes I used the following: https://discussions.apple.com/thread/2674721 - cd (drag folder into Terminal window, press return). Then: ls -l > ~/Desktop/list.txt BACKUP ALL 3 TABLES ABOVE BEFORE IMPORTING CSV INTO PHPMYADMIN MAKE SURE ALL 3 TABLES HAVE MATCHING IDs FOR EACH ATTACHMENT AND PRODUCT VOLA! Import-Attachment-Template.xlsx Edited September 9, 2021 by dirtrider118 (see edit history) 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