I am trying to get the link of the product pages in prestashop. After going through the product class I found the function getLink() and using that I get a link but when I try to go to that link I get an error that page moved to a new link. How to solve this? Following below are the statements I am using to get the links.
$product = new Product(4);
$link = $product->getLink();
Try this:
$this->context->link->getProductLink($product_id);
If this doesn't work, try following:
$linkObj = new Link();
$productLink = $linkObj->getProductLink($product_id);