Search code examples
smartyprestashop

How to get friendly URL variable in Prestashop template?


I am looking help about smarty global variables. How to get friendly URL variable for using it in smarty template of the Prestashop. I have found this {$smarty.server.REQUEST_URI} , but I got only full URL. It looks like: /en/our-products/73-lighted-mirror-tokyo-70-x-32.html

I need to get only 73-lighted-mirror-tokyo-70-x-32 sting.

Help, please.


Solution

  • You can also use the getUrlRewriteInformations() function from the Product class in PrestaShop.

    It can return the information about the URL Rewrites of any product using the following line of code:

    $rewrite_info = Product::getUrlRewriteInformations($id_product);