I found this question, wondering the same. And just in case someone else needs this sometime, I'll post my own findings here.
I found two methods of getting the product URL without loading the complete product. Since I was working on a slow server, I needed to find the fastest loading method.
The first method:
The first get's a product collection based on the product ID:
$_item = Mage::getModel('catalog/product')->getCollection()
->addAttributeToSelect('product_url')
->addAttributeToFilter('entity_id', $productId)
->addUrlRewrite()
->load();
foreach($_item as $product){
echo $product->getProductUrl();
}
// returns string "http://www.your-domain.com/[category]/[product_url]"
The second method:
The second method, using Kalpesh Metha's method, would be this code:
Mage::getResourceSingleton('catalog/product')
->getAttributeRawValue($productId, 'url_key', Mage::app()->getStore());
// returns string "product-url-like-this"
For this method, you can either use 'url_key'
or 'url_path'
. I have not found out the difference though.
The difference between the methods:
The first method takes slightly more time (about 15% time extra). The second method however, only returns the final part of the URL. This means that if the shop uses the category in the URL, it won't work, since that part isn't shown. This was the case in the shop I was working on.