I have some of the products already added in magento admin. And now i am trying to create same name product with the use of script that time i am facing error "URL key for specified store already exists". Why it is not taking as per magento rule? Have anyone idea about that?
If i set like below then i can easily save product.
$url_key = $productName."-".rand(1,100);
$product->setUrlKey($url_key);
But above way is not proper for SEO perspective.
If we create same name product from admin then URL will automatically create even if the product name is already exist in other products.
Any suggestions please?