$productId = 406;
$categoryId=5;
$product = Mage::getModel('catalog/product')->load($productId);
$storeId = Mage::app()->getStore()->getStoreId();
$coreUrl = Mage::getModel('core/url_rewrite');
$idPath = sprintf('product/%d', $productId);
if ($categoryId) {
$idPath = sprintf('%s/%d', $idPath, $categoryId);
}
$coreUrl->setStoreId($storeId);
$coreUrl->loadByIdPath($idPath);
if ($coreUrl->getId()) {
echo $coreUrl->getRequestPath();
}
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment