Jump to content

Edit History

yeye412

yeye412

Hello everyone,

 

i'm facing an issue by using an Import CSV php script (i run this script every 5 hour by cron) that connect user in admin page and import csv file inside certain folder.

Prestashop version: 1.7.6.1

Steps: 

1)   $request->setPost(array("email" => $adminLoginEmail,"passwd" => $adminLoginPass, "submitLogin" => "Connexion")); 
      $request->call($adminUrl."/index.php?controller=AdminLogin");

  2)   $request->call($adminUrl."/index.php?controller=AdminImport");
         list(,$response) = explode("\r\n\r\n", $request->_webpage, 2);
         preg_match("/token=([a-z0-9]+)/", $response, $matches);
        $token = $matches[1];

   3) $request->setPost(array(
                "controller" => "AdminImport",
                "token" => $token,
                  'skip' => '1',
                'csv' => 'prodotti.csv',
                'entity' => '1',
                'separator' => ';',
                'multiple_value_separator' => ',',
                'iso_lang' => 'it',
                'match_ref' => '1',
                'regenerate' => '0',
                'sendemail' => '1',
                "type_value" => array(                                
                  0 => 'reference',
                  1 => 'name',
                  2 => 'price',
                  3 => 'quantity'
                )
        )
    );

4) curl to --> /index.php?controller=AdminImport&token=xxx"

 

All steps return a 200 http status , and i can see token got by admin login but anything was imported in my shop.

Step 4 response is the html content of the admin import page, i think there's a problem on import csv action..

Can anyone help me please?

 

Thanks a lot.

yeye412

yeye412

Hello everyone,

 

i'm facing an issue by using an Import CSV php script (i run this script every 5 hour by cron) that connect user in admin page and import csv file inside certain folder.

Prestashop version: 1.7.6.1

Steps: 

1)   $request->setPost(array("email" => $adminLoginEmail,"passwd" => $adminLoginPass, "submitLogin" => "Connexion")); 
      $request->call($adminUrl."/index.php?controller=AdminLogin");

  2)   $request->call($adminUrl."/index.php?controller=AdminImport");
         list(,$response) = explode("\r\n\r\n", $request->_webpage, 2);
         preg_match("/token=([a-z0-9]+)/", $response, $matches);
        $token = $matches[1];

   3) $request->setPost(array(
                "controller" => "AdminImport",
                "token" => $token,
                  'skip' => '1',
                'csv' => 'prodotti.csv',
                'entity' => '1',
                'separator' => ';',
                'multiple_value_separator' => ',',
                'iso_lang' => 'it',
                'match_ref' => '1',
                'regenerate' => '0',
                'sendemail' => '1',
                "type_value" => array(                                
                  0 => 'reference',
                  1 => 'name',
                  2 => 'price',
                  3 => 'quantity'
                )
        )
    );

4) curl to --> /index.php?controller=AdminImport&token=xxx"

 

All steps return a 200 http status , and i can see token got by admin login but anything was imported in my shop.

Step 4 response is the html content of the admin import page, i think there's a problem on import csv action..

Can anyone help me please?

 

Thanks a lot.

×
×
  • Create New...