Pecatum Posted April 27, 2018 Share Posted April 27, 2018 Hi all, I'm trying to implement AMP in our shop with Leopold's module (https://www.prestashop.com/forums/topic/669944-free-module-amp-accelerated-mobile-pages-2011-ps-16-17/). However, the default links provided by the module are not so "friendly". I'm not an expert programmer and I've been investigating for a couple of days, but I haven't reached yet a final solution. The default links looks like this: https://www.pecatum.com/es/module/amp/product?idProduct=156 And I want go get something like this: https://www.pecatum.com/es/jamon-iberico/156-jamon-iberico-de-cebo-campo-charro-8kg.html The only advance I got so far is a link like this: https://www.pecatum.com/es/amp?idProduct=156 I've been having a look at Link.php to check whether any of its classes could give me what I want, unsuccessfully. Right now I'm "playing" with getModuleLink(), but I'm a bit lost. I'm also thinking about using substr() and things like that, but I don't see it clear (the length of the default link will be variable, I think, since sometimes it will include "https", sometimes "http"). I haven't found any kind of deep documentation, with examples for someone like me, on Link functions. Could any of you give me some clue about this? Thanks a lot in advance! Link to comment Share on other sites More sharing options...
Nishith Nesdiya Posted April 27, 2018 Share Posted April 27, 2018 Hi... you can use this way link your module $link->getProductLink($product) // here $product is object of product $link->getModuleLink() $link->getPageLink() $link->getCategoryLink() $link->getCmsLink() $link->getCatImageLink() Thanks 1 Link to comment Share on other sites More sharing options...
Pecatum Posted April 27, 2018 Author Share Posted April 27, 2018 1 hour ago, Nishith said: Hi... you can use this way link your module $link->getProductLink($product) // here $product is object of product $link->getModuleLink() $link->getPageLink() $link->getCategoryLink() $link->getCmsLink() $link->getCatImageLink() Thanks Thanks Nishith, What I've finally used is this: $ampLink = $this->context->link->getModuleLink('amp', 'product', array('idProduct' => $product->id."-".$product->link_rewrite), true, $this->context->language->id, $this->context->shop->id, true); Instead of: $ampLink = $this->context->link->getModuleLink('amp', 'product', array('idProduct' => $product->id), true, $this->context->language->id, $this->context->shop->id, true); This is, adding the link_rewrite. By now, this is enough for me. There's soooo much to learn... Regards, Manuel Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now