Search code examples
magentomagento-1.5

Return wrong getUrl


i need print this url:

http://mysite.com/hello-world-product.html

i use this:

echo $this->getUrl('hello-world-product.html')

and that return this (see the last character wrong):

http://mysite.com/hello-world-product.html/

What can i do for return right value?!


Solution

  • See getUrl parameters for details.

    echo $this->getUrl('', array('_direct' => 'hello-world-product.html'));
    

    However if this product is an actual product then it's more resilient to use:

    echo $this->getUrl('catalog/product/view', array('id' => ID_OF_PRODUCT, '_use_rewrite' => true));