Shani1351, I've encountered the same issue than you.
I did the same operations:
- Set the "Use Categories Path for Product URLs" to "no".
- Clear the cache.
- Truncate ´core_url_rewrite´.
- Clear the cache.
- Then check my url rewrites data (from backend). And I saw many url for each product (one url for each related linked category).
BUT if you check on your frontpage, you'll see that there is only one url used by product AS EXPECTED.
I think Magento need to generate the "whole package" urls but do not use them on frontend.
EDIT (more than 3 years later):
My initial answer was wrong. Product urls are returned with category path.
To help magento getting rewrited product url without category path, i recommend you to override the following method as follow (here is a POC, just for demonstration. Don't modify core file, never!):
Mage_Catalog_Model_Product_Url::getUrl()
public function getUrl(Mage_Catalog_Model_Product $product, $params = array())
{
$routePath = '';
$routeParams = $params;
$storeId = $product->getStoreId();
if (isset($params['_ignore_category'])) {
unset($params['_ignore_category']);
$categoryId = null;
} else {
$categoryId = $product->getCategoryId() && !$product->getDoNotUseCategoryId()
? $product->getCategoryId() : null;
}
if ($product->hasUrlDataObject()) {
$requestPath = $product->getUrlDataObject()->getUrlRewrite();
$routeParams['_store'] = $product->getUrlDataObject()->getStoreId();
} else {
$requestPath = $product->getRequestPath();
if (empty($requestPath) && $requestPath !== false) {
$idPath = sprintf('product/%d', $product->getEntityId());
if ($categoryId) {
// $idPath = sprintf('%s/%d', $idPath, $categoryId);
}
Look at the commented line (194 on my CE 1.7.0.2).
This is the guilty one!
Just remove this line in your overwrite module:
$idPath = sprintf('%s/%d', $idPath, $categoryId);
Hope it could help someone.