Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. $product = Mage::getModel('catalog/product')->load($product_id);
  2. $site_url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
  3. $product_url = '';
  4. $cats = $product->getCategoryIds();
  5. if (sizeof($cats)) {
  6. $category = Mage::getModel('catalog/category')->load((int) $cats[0]);
  7. $product_url = $site_url.$product->getUrlPath($category);
  8. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement