I've been trying to get correct product urls for orders. By that I mean that when an order is created, i want to get the product url which will correspond to the store in which the order was made. At first I've been using the getProductUrl() but this method sometime returned to me urls with admin path. My second try was using the following code:


However, sometimes I get invalid urls.

What is the correct way to get a valid product url for each order, which will correspond to the correct store?



try this code :

echo $this->getBaseUrl().$product->getUrlKey().".html";

OR this :

echo $this->getBaseUrl().$product->getUrlPath();

You can use this code snippet

echo Mage::getModel("catalog/product")->load($_item->getProductId())->getProductUrl()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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