Jump to content

Will Product ID still be required on CSVs in version 3 of prestashop? (BUG?)


Recommended Posts

hi there

the fact that it is compulsory to use a product ID when importing via csv files is causing me problems with updates from my dropshipper as she does not use a product ID. This means when she makes updates I cant just upload her updated CSV on using names alone, instead I have to go through and add every product ID.

I'm not sure if this is a bug because on the import screen it does not say you have to put a product ID, but if you don't it causes big problems. (like product duplication when you try and update things)

Thanks

Link to comment
Share on other sites

Of course the product ID will be required. It is the only way to determine whether the product already exists in the database. I don't understand how you could decide whether to update an existing product or insert a new one without providing the product ID, unless you use another field like the reference field, but that field is not guaranteed to be unique. The product ID field is the only field in the product table that is guaranteed to be unique.

Link to comment
Share on other sites

Thanks for the reply - well I was hoping that the reference and name would be enough - the problem is that it makes it very difficult for those of us that have lots of products and use drop shippers, to update their stores. I don't think zen cart have a product ID field so must be possible to do it without it.

Thanks

Link to comment
Share on other sites

I'll try to come up with a solution for you. Try changing lines 533-534 of admin/tabs/AdminImport.php (in Prestashop v1.2.5) from:

else
   $product = new Product();



to:

elseif (array_key_exists('reference', $info) AND $info['reference'] != '' AND Product::getByReference($info['reference']) != false)
   $product = new Product(Product::getByReference($info['reference']));
else
   $product = new Product();



This code will check whether the reference already exists and update that product before deciding to create a new product.

Link to comment
Share on other sites

  • 1 month later...
×
×
  • Create New...