Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $product = Mage::getModel('catalog/product')->load($product_id);
- $site_url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
- $product_url = '';
- $cats = $product->getCategoryIds();
- if (sizeof($cats)) {
- $category = Mage::getModel('catalog/category')->load((int) $cats[0]);
- $product_url = $site_url.$product->getUrlPath($category);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement