Rawwood Posted January 16, 2014 Share Posted January 16, 2014 Hello there. I'm trying to export some data here. I have a Product object that i call getlink() on. This returns the url to prestashop plus en/1-ipod-nano.html But when i request the url i get a page which says: [Debug] This page has moved Please use the following URL instead: (prestashop url)/en/music-ipods/1-ipod-nano.html What is wrong? Thank you Link to comment Share on other sites More sharing options...
vekia Posted January 16, 2014 Share Posted January 16, 2014 can you show how your code looks like? btw. message that you see it's an internal prestashop message, if you will turn off error reporting, you will be redirected properly - without this message. Link to comment Share on other sites More sharing options...
Rawwood Posted January 20, 2014 Author Share Posted January 20, 2014 (edited) $p = new Product(1); $url = $p->getLink(); That is my code Edited January 20, 2014 by Rawwood (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted January 20, 2014 Share Posted January 20, 2014 this is wrong method. use "Link" object and function: /** * Create a link to a product * * @param mixed $product Product object (can be an ID product, but deprecated) * @param string $alias * @param string $category * @param string $ean13 * @param int $id_lang * @param int $id_shop (since 1.5.0) ID shop need to be used when we generate a product link for a product in a cart * @param int $ipa ID product attribute * @return string */ public function getProductLink($product, $alias = null, $category = null, $ean13 = null, $id_lang = null, $id_shop = null, $ipa = 0, $force_routes = false) Link to comment Share on other sites More sharing options...
Rawwood Posted January 21, 2014 Author Share Posted January 21, 2014 this is wrong method. use "Link" object and function: /** * Create a link to a product * * @param mixed $product Product object (can be an ID product, but deprecated) * @param string $alias * @param string $category * @param string $ean13 * @param int $id_lang * @param int $id_shop (since 1.5.0) ID shop need to be used when we generate a product link for a product in a cart * @param int $ipa ID product attribute * @return string */ public function getProductLink($product, $alias = null, $category = null, $ean13 = null, $id_lang = null, $id_shop = null, $ipa = 0, $force_routes = false) Okay now i used that function, but i'm still not getting the correct url. This is what i get: prestashop/en/1-ipod-nano.html This is what it redirects to: prestashop/en/music-ipods/1-ipod-nano.html $p = new Product(1); $link = new Link(); $url = $link->getProductLink($p); Link to comment Share on other sites More sharing options...
vekia Posted January 21, 2014 Share Posted January 21, 2014 so why url isn't correct? it's correct, this is how this function works, you've got url to product page Link to comment Share on other sites More sharing options...
chirag_0110 Posted November 7, 2017 Share Posted November 7, 2017 On 1/21/2014 at 4:56 PM, vekia said: so why url isn't correct? it's correct, this is how this function works, you've got url to product page Hi Vekia, Rawwood is right. I am facing same issue in PS-1.7.2.2. My product link url is: https://unshy.dev-applications.net/home/8-54-paypal-fee.html When i try to get product url using below code it looks different. $product = $this->context->controller->getProduct(); $proLink = this->context->link->getProductLink($product); I get below url: https://unshy.dev-applications.net/home/8-paypal-fee.html Default ps_sharebutton module also have this issue. You can check by clicking any share button from product page. Can you please help us to resolve this issue. Thanks in advance, Link to comment Share on other sites More sharing options...
Nishith Nesdiya Posted August 27, 2019 Share Posted August 27, 2019 On 11/7/2017 at 11:30 AM, chirag_0110 said: Hi Vekia, Rawwood is right. I am facing same issue in PS-1.7.2.2. My product link url is: https://unshy.dev-applications.net/home/8-54-paypal-fee.html When i try to get product url using below code it looks different. $product = $this->context->controller->getProduct(); $proLink = this->context->link->getProductLink($product); I get below url: https://unshy.dev-applications.net/home/8-paypal-fee.html Default ps_sharebutton module also have this issue. You can check by clicking any share button from product page. Can you please help us to resolve this issue. Thanks in advance, Hi.. same problem here can you have solved your problem ? Thanks 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