I'm using this in my controller file to get the current product URL and insert it into database.
Tried this solution, but it works partially: instead of http://formodulecheck.dev/media/catalog/product/p/r/product.jpg it's returning http://formodulecheck.dev/index.php/catalog/product/view/
$product = Mage::getModel('catalog/product')->load($id);
$productUrl = $product->getProductUrl();
Version 2 - Also tried this:
$_product = Mage::getModel('catalog/product')->load($product_id);
$product_url=Mage::helper('catalog/image')->init($product, 'thumbnail');
echo $product_url." HERE IS THE PRODUCT URL";
And getting this error:
Fatal error: Call to a member function getData() on null in app\code\core\Mage\Catalog\Helper\Image.php on line 166
How can I fix this? (Thanks for the help)
$_product
in your code?