during importing products to magento I use
setUrlKey method for setting the
$products_name = "I am a test product";
This works fine, but when I open the product in the shop the
url is not
"i-am-a-test-product-1". When I restart my import script the url will be "i-am-a-test-product-2". Magento adds an ID after the
url_key and increases it for each run.
Of the course all products names are unique.
How can I stop
magento adding these ID's inside the
For categories I do not have these problems.
Try to make your own url key by this code:
$urlKey = preg_replace('#[^0-9a-z]+#i', '-', $products_name); $urlKey = strtolower($urlKey); $product->setUrlKey($urlKey);