Jump to content

Import: same manufacturer name created every time with differet id's


Recommended Posts

Hi,

I've got the .cvs-imort-thing working, but there's one big thing that's really bugging me: manufacturers with the same name (well, actually it is the same manufacturer) are created for every product with a different id:

Product 1; Manufacturer 1
Product 2; Manufacturer 1
...
Product 100; Manufacturer 1



results in 100 manufacturers with the same name and id's from 1 to 100

I really need to get this going the way it should - same name, same id!

Link to comment
Share on other sites

I'm sorry, it's me again..

I think I found the problem (/admin/tabs/AdminImport.php, Line 490):

            if (isset($product->manufacturer) AND is_numeric($product->manufacturer) AND Manufacturer::manufacturerExists(intval($product->manufacturer)))
               $product->id_manufacturer = intval($product->manufacturer);
           elseif (isset($product->manufacturer) AND is_string($product->manufacturer) AND !empty($product->manufacturer))
           {
               $manufacturer = new Manufacturer();
               $manufacturer->name = $product->manufacturer;
               if ($manufacturer->validateFields(UNFRIENDLY_ERROR) AND $manufacturer->validateFieldsLang(UNFRIENDLY_ERROR))
                   if ($manufacturer->add())
                       $product->id_manufacturer = intval($manufacturer->id);
                   else
                       $this->_errors[] = mysql_error().' '.$manufacturer->name.(isset($manufacturer->id) ? ' ('.$manufacturer->id.')' : '').' '.Tools::displayError('cannot be saved');
           }



There is only the check if the id exists if the value is numeric, but no check if the string exists - is it possible to add this?

Link to comment
Share on other sites

Hi,
I had the same problem.
Simply replace in your file import your manufacturer by its ID, if there is only one it is easily done with any text editor with the replace function.
Of course you have to import before the manufacturer.csv with the correct id.
I do not think this is a bug in my opinion they expected to have several manufacturers with the same name.

Link to comment
Share on other sites

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