10

I'm importing products from a CSV-file. The categories-column of the import file has a value like this:

Store Amsterdam/Lunchbox;Store Amsterdam/Lunchbox/Hot Sandwiches

I've set ";" as a Multiple value separator in the Magento 2 import settings.

Somehow Magento only adds the Store Amsterdam (root) categorie and imports 0 products (Probably because it doesn't reach the destination category).

When I create the sub categories by hand all products import correctly. But I don't want to do this for every 34 remaining stores.

In the report it says: Category "Store Amsterdam/Lunchbox" has not been created. URL key for specified store already exists.

What is going wrong here? Maybe writing permissions on category table? Different Magento user?

Rick
  • 463
  • 7
  • 18
  • We have fixed that issue with "URL key for specified store" error on products and categories import on our commercial paid M2 extension https://firebearstudio.com/the-improved-import.html – FireBear Jul 18 '18 at 10:40

2 Answers2

1

Try to set url key in your import code this way

$_product = $this->_objectManager->create('Magento\Catalog\Model\Product');

$url = <yourcatname>.'_'.$sku;// just to make it unique
$url = strtolower($url);
$_product->setUrlKey($url); 

//now save your product
$_product->save();

This should resolve your issue! Happy customizing!

Pallavi
  • 347
  • 1
  • 4
  • 12
0

You have to use "," instead of ":" to separate values, Can i know what version you were using right now?

ex:Store Amsterdam/Lunchbox, Store Amsterdam/Lunchbox/Hot Sandwiches

Varma
  • 75
  • 1
  • 12
  • 1
    I used ";" because there are comma's in some values (product descriptions, etc.). Magento's import module let's you choose a "Multiple value separator" which I've set to ";". (Using v. 2.1.6) – Rick Aug 10 '17 at 07:08