PrestShop: Import from XLS? - php

Is there a possibility to import XLS Files into Prestashop? I would imagine myself a Script where I define which rows (as an Example A1-A300 should be Names of the articles, etc...) are what (Like name, price, Tax, etc...).
How could I realise that? I hope there is a possibility and I would appreciate if anyone could get ma on the right path.

PrestaShop doesn't support excel files, only simple data tables like .csv. This is because excel files are too complicated, they can by whole programs by themselves.
However, if you're working for a client or your XLS files are just simple data, then surely you can convert XLS to CSV before import.
You just need to make an override for AdminImportController::ajaxProcessUploadCSV
and basically "intercept file upload". Get the uploaded file and convert it to CSV using this library:
https://github.com/PHPOffice/PHPExcel
Then just return are the right values in your override to simulate that "everything is running normal" (basically trick PrestaShop :)) .
It is definitely doable, I've created such module for a client, PHPExcel gave us the ability to work with cells before saving them to CSV.

If you need to import products form Excel without converting to CSV, there is extension, Store Manager for PrestaShop - https://www.prestashopmanager.com/free-download/
It is paid, but you can do the task with 2-week version without any fees.

Related

How to export data to Excel template, retaining VBA code and data validation, using PHP?

I need to export data to an Excel template that contains VBA code and data validation in PHP.
I tried using PHPExcel library but it is removing the VBA code and data validations from the template.
I tried using PHPReport library, didn't get proper solution.
The template contains multiple worksheets and they are interdependent.
E.g.: Worksheet 1 contains employee data, then worksheet 2 contains salary with respect to employee name.
I have spent a great deal of time working on this problem, and the problem of memory consumption for large data sets. All of the PHP libs I have found keep all of the cells in memory, which is not viable for anything more than a small sheet.
What I ended up doing was writing a set of Java utilities using Apache POI and packaged them with PHP/Java Bridge so I can call them from PHP. This will allow you to create a new workbook based upon a template, keeping the macros intact. You can also use POI's streaming API, so you can handle massive data sets without crashing your server.
If you have Java chops, I highly recommend going this route, it's really the only way to do brain surgery on Excel files from PHP.
If you have any questions about how to do this or would like some example code, I'll be glad to help.

Importing databases in prestashop

I have a big database in Access with products I want to insert in Prestashop!
I've read about the database import in prestashop but didnt find anything about access db import. Is there a way to import this database in prestashop?
Or am I supposed to write sql queries to add these products. I have read the source code of prestashop like Products.php or ObjectModel.phplike said here:http://stackoverflow.com/questions/16068141/prestashop-insert-products-script. So is the only way to write sql queries?
Thanks!
PrestaShop have tools to import products from CSV, you can check it in BO > Advanced Parameters > CSV Import. You can choose what you want to import, products, categories, attributes etc. If your file is too big you supposed to split it to few small files.
As Agnes said CSV will be the option.
Since I still don't have enough rep I can comment on his response but I'd like to add that in the CSV import page you can find templates for the CSV may be useful if you are not used to Prestashop Product Fields.
Also if you upload the images to a temporal folder and add the URLS in the product CSV the images will be imported and added to the product.
If is the first product upload I'll also recommend you to set up the IDs for the products this way if something doesn't fit or you want to change the uploaded products you can do it just by ID or simply delete all previous products and import the new ones.
Good luck.
Import is very complecated in PrestaShop, and not really fonctionnal.
I recommand to use the module Migration pro. Is a paid module, but it works really fine, i've used it a lot.
Otherwise, you can read this article (in french), you have the list of table to import. After that, you can import images and regenerate them.
Good luck ;)
Modern Prestashop can directly import xls/xlsx files
It is much better choice than CSV because you don`n have mess with field delimiters.
Export from Access to Excel should not be problem.
Native Import through web admin GIU is very good.
But you need some practice:
Make file with few products - you can delete them later if you not satisfied with results of import.
Look carefuly at field mappings. Maybe you will fail at first attempt or miss some mapping - thats why you need to import few products first.
If possible try to use the built in webservice api or you can make your own custom import module

Import products from Excel file

I am new to Magento and I have a question about products import. I have the xls file with over 9K positions (products) wich I need to import. For each product in this file there are basically sku, name, price and descriprion attributes. I am familiar with the basics of import/export in Magento. I’ve already exported some test products into csv file to get the structure for import csv. This file of course contains much more attributes than the one i need to import. So my obvious question is: how can I create valid import csv from my xls file (not by hand of course)? The only solution I can see right now is to write some php code that will extract data from the xls file, add required attributes from export csv and save it as csv. Are there other solutions to my problem? Sorry if I am asking some obviuos questions. Googled, searched, found nothing.
Better way is to save excel as simple csv file and use Magmi for import to Magento. http://sourceforge.net/apps/mediawiki/magmi/index.php?title=Main_Page

How to open an existing excel document, enter data into specific cells then save the file as a new excel document with PHP

I'm currently using PHP with the PEAR extension, as well as the Spreadsheet_Excel_Writer package. I am able create a new excel file with PHP and save it to disk, but I can't find a stable Excel reader package.
Even if I do find a valid reader package I don't think this will be suitable as I want to be able to modify a complex excel document which contains its own formulas and graphs(on seperate spreadsheets) based on the content already saved in the data table.
Ideally, I'd like to enter data from the browser which will then, with PHP, modify only certain cells and then save the file again, the excel document itself will then update its own graphs etc. based on the modified data in the table.
Any ideas? Or have more experience with PEAR and know of packages for working with excel documents in this manner?
Thanx a lot!
You probably don't want separate reader and writer libraries, otherwise you're going to have to transfer all data between them manually, which limits you to libraries that can both read and write.
There's a comprehensive list of Excel libraries for PHP here
However, unless you use COM or PUNO, you'll have problems with graphs... even PHPExcel doesn't support charts yet, and (while planned for the the next release) will still only work with charts in OfficeOpenXML (.xlsx) files.

Save php web info to an excel spreadsheet

Ok we have this prefilled excel spreadsheet that we just update our name, mileage, and location on once a month. The spreadsheet calculates our millage with the built in formulas. What I would like to do is have this page on our website. I would pull from a sql database depending on the options you select prefill my labels on the web and save it to the correct spot on the excel spreadsheet once submitted. Sounds easy in theory but I'm not sure how to go about doing this or if it is even possible? Can someone help me out or get me started in the right direction. Thanks
Take a look at PHPExcel. It allows you to read and write Excel documents (and PDFs, and OpenOffice.org Calc documents and more).

Categories