Jump to content

Import CSV Script Array Problems


Recommended Posts

If you use csv import from backoffice url images import ok, from script you have to add a line to AdminImportController in fuction productImport().

 

where its the diferenci between internal prestashop call and from script call?

 

trying to undestand the diference I add temporallya line

echo "<br><br>fabricante: " ;var_dump($manufacturer);

after line (2878) AdminImportController::arrayWalk($info, array('AdminImportController', 'fillInfo'), $manufacturer);

into manufactureImport();

 

if I import from backoffice a csv file with only one manufacturer all ok and get this var_dump output

 

fabricante: object(Manufacturer)#59 (33) {
    ["id"]=> string(1) "2"
    ["id_manufacturer"]=> NULL
    
["name"]=> string(4) "NIKE"
    ["description"]=> array(1) {
        [1]=> string(4) "NIKE"
    }
    ["short_description"]=> array(1) {
        [1]=> string(4) "NIKE"
    }
    ["id_address"]=> NULL

 

but if I set an import from script i get this output from var_dump

 

fabricante: object(Manufacturer)#25 (34) {
     ["id"]=> string(1) "2"
     ["id_manufacturer"]=> NULL

     ["name"]=> array(1) {
         [1]=> string(4) "NIKE"
     }

     ["description"]=> array(1) {
         [1]=> string(4) "NIKE"
     }
     ["short_description"]=> array(1) {
         [1]=> string(4) "NIKE"
     }
     ["id_address"]=> NULL

Warning: preg_match() expects parameter 2 to be string, array given in /home/erpecdes/public_html/classes/Validate.php on line 295

 

why they are diferent! if I use the same csv file and same arraywalk function to set the $manufacturer array?

Edited by kronoszx (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...