Joined June 2014
·

Simone Paolucci

Application Developer, Web Developer, Semantic Web Developer at Joint Research Centre (JRC) - European Commission's Science Service (Outsourced Contractor by GFT Italia S.r.l.)
·
Milan, Italy
·
·
·

@bogdandin: Usually if the Token is empty it's a login problem. Check your credential.

I have detected a problem with version 1.5 of Prestashop. This version does not have the file upload Ajax, so you have to copy the csv files in the folder admin/import and pass the file name to the form of importCsv. A brief update of the script.

You have check if the header of csv (the $csv = "id;Active (0/1);Name*;reference;price;barcode".PHP_EOL; variable), the lines of the csv and your $matchColumn have to match.
If the csv headers not match the rows prestashop ignore its.

Active error display:
errorreporting(EALL);
iniset('displayerrors', 1);

the row:
echo "Token : ".$token.PHP_EOL;
print your token?

then try to use advises in my previous post and give me your feedback

I don't know. I believe there are some server specific problem.

Try to add curl verbose option in 'call' function of class.PSRequest.php file:
curlsetopt($this->ch,CURLOPTVERBOSE,true);

Also add in each file these instrunction to notify some errors:
errorreporting(-1);
ini
set('display_errors', 'On');

Detect if 'allowurlfopen' is enabled:
if( iniget('allowurl_fopen') ) {
echo 'Is enabled';
}

Give me some feedback

Thank you toanloau :)

You have to change this line with your url prestashop installation?
$adminUrl = 'http://prestashop.dev:8080/admin6596/';

You have to try to charge your url (your $adminUrl) in browser if it's ok?

Check in your apache errors log file if there are any other errors.

This script (or my version of this script https://coderwall.com/p/fwoaqq) works for prestashop 1.6.
Token invalid is because the login is failed or the script that split the response of the login page don't catch the token. Try to show all the response of login action.

Thanks for your code.
I have modified your code because it doesn't work to my.
Your code doesn't send csv file by post to prestashop server.

This is my code:
https://coderwall.com/p/fwoaqq

Achievements
101 Karma
10,347 Total ProTip Views