is it possible to quickly get a products URL from it's id? We're having an issue where the product URLs of configured (simple child) products are overlapping. By this I mean when 2+ configurations (simple children) of a configurable product are added to the cart the URLs always divert to the first option

  • A sidenote: Magento will create a URL for not visible simple products of configurables: dnd.fr/2012/09/… – B00MER Apr 18 '15 at 3:59

You can get product url by loading catalog product model object using product id

$product = Mage::getModel('catalog/product')

$productUrl = $product->getProductUrl();
| improve this answer | |

Change $productId with your product ID below. You can also specify different store (or store ID will also work) in the 3rd argument.

$urlKey = Mage::getResourceSingleton('catalog/product')
  ->getAttributeRawValue($productId, 'url_key', Mage::app()->getStore());
$productUrl = Mage::getBaseUrl() . $urlKey;
| improve this answer | |

This works for me.

$url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB).$_product->getUrlKey();
| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.