silki Posted September 30, 2010 Share Posted September 30, 2010 Dear Forum,i'm working on optimising my simplied URLs. They are working but now there is always the EAN number behind each link and i have no idea why. I deleted the URL simplified on the databse because i wanted to improve it. But now i have this problem.Any ideas? Thanks Silki Link to comment Share on other sites More sharing options...
rocky Posted September 30, 2010 Share Posted September 30, 2010 So you want to remove the EAN13 from the friendly URL? To do that, change lines 53-56 of classes/Link.php from: if (is_object($id_product)) return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.$lang_link.(($id_product->category != 'home' AND !empty($id_product->category)) ? $id_product->category.'/' : '').intval($id_product->id).'-'.$id_product->link_rewrite.($id_product->ean13 ? '-'.$id_product->ean13 : '').'.html') : (_PS_BASE_URL_.__PS_BASE_URI__.'product.php?id_product='.intval($id_product->id)); elseif ($alias) return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.$lang_link.(($category AND $category != 'home') ? ($category.'/') : '').intval($id_product).'-'.$alias.($ean13 ? '-'.$ean13 : '').'.html') : to: if (is_object($id_product)) return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.$lang_link.(($id_product->category != 'home' AND !empty($id_product->category)) ? $id_product->category.'/' : '').intval($id_product->id).'-'.$id_product->link_rewrite/*.($id_product->ean13 ? '-'.$id_product->ean13 : '')*/.'.html') : (_PS_BASE_URL_.__PS_BASE_URI__.'product.php?id_product='.intval($id_product->id)); elseif ($alias) return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.$lang_link.(($category AND $category != 'home') ? ($category.'/') : '').intval($id_product).'-'.$alias/*.($ean13 ? '-'.$ean13 : '')*/.'.html') : 1 Link to comment Share on other sites More sharing options...
silki Posted September 30, 2010 Author Share Posted September 30, 2010 Great! Works perfect :-) Thanks a lot for the quick help. Silke Link to comment Share on other sites More sharing options...
yourdaddy Posted October 1, 2010 Share Posted October 1, 2010 So you want to remove the EAN13 from the friendly URL? To do that, change lines 53-56 of classes/Link.php from: if (is_object($id_product)) return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.$lang_link.(($id_product->category != 'home' AND !empty($id_product->category)) ? $id_product->category.'/' : '').intval($id_product->id).'-'.$id_product->link_rewrite.($id_product->ean13 ? '-'.$id_product->ean13 : '').'.html') : (_PS_BASE_URL_.__PS_BASE_URI__.'product.php?id_product='.intval($id_product->id)); elseif ($alias) return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.$lang_link.(($category AND $category != 'home') ? ($category.'/') : '').intval($id_product).'-'.$alias.($ean13 ? '-'.$ean13 : '').'.html') : to: if (is_object($id_product)) return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.$lang_link.(($id_product->category != 'home' AND !empty($id_product->category)) ? $id_product->category.'/' : '').intval($id_product->id).'-'.$id_product->link_rewrite/*.($id_product->ean13 ? '-'.$id_product->ean13 : '')*/.'.html') : (_PS_BASE_URL_.__PS_BASE_URI__.'product.php?id_product='.intval($id_product->id)); elseif ($alias) return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.$lang_link.(($category AND $category != 'home') ? ($category.'/') : '').intval($id_product).'-'.$alias/*.($ean13 ? '-'.$ean13 : '')*/.'.html') : Dont kow if its similar to my problem, but i actually want it to show the EAN13 number at the end of the link, i generate the google base feed and links show up without the EAN13 at the end? Looked everywhere, sorry for asking here, hope i can atleast get directed to the proper place. Link to comment Share on other sites More sharing options...
jfriday Posted October 5, 2010 Share Posted October 5, 2010 Interesting - this seems to have no effect for me.This is the code in the original Link.php: public function getProductLink($id_product, $alias = NULL, $category = NULL, $ean13 = NULL) { if (!isset($this->allow)) $this->allow = 0; if (is_object($id_product)) return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.$lang_link.(($id_product->category != 'home' AND !empty($id_product->category)) ? $id_product->category.'/' : '').intval($id_product->id).'-'.$id_product->link_rewrite/*.($id_product->ean13 ? '-'.$id_product->ean13 : '')*/.'.html') : (_PS_BASE_URL_.__PS_BASE_URI__.'product.php?id_product='.intval($id_product->id)); elseif ($alias) return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.$lang_link.(($category AND $category != 'home') ? ($category.'/') : '').intval($id_product).'-'.$alias/*.($ean13 ? '-'.$ean13 : '')*/.'.html') : (_PS_BASE_URL_.__PS_BASE_URI__.'product.php?id_product='.intval($id_product)); else return _PS_BASE_URL_.__PS_BASE_URI__.'product.php?id_product='.intval($id_product); } And this is what I changed it to: public function getProductLink($id_product, $alias = NULL, $category = NULL, $ean13 = NULL) { if (!isset($this->allow)) $this->allow = 0; if (is_object($id_product)) return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.(($id_product->category != 'home' AND !empty($id_product->category)) ? $id_product->category.'/' : '').intval($id_product->id).'-'.$id_product->link_rewrite.($id_product->ean13 ? '-'.$id_product->ean13 : '').'.html') : (_PS_BASE_URL_.__PS_BASE_URI__.'product.php?id_product='.intval($id_product->id)); elseif ($alias) return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.(($category AND $category != 'home') ? ($category.'/') : '').intval($id_product).'-'.$alias.($ean13 ? '-'.$ean13 : '').'.html') : (_PS_BASE_URL_.__PS_BASE_URI__.'product.php?id_product='.intval($id_product)); else return _PS_BASE_URL_.__PS_BASE_URI__.'product.php?id_product='.intval($id_product); } I've gone over it several times in WinMerge and can't seem to figure out what I'm missing, and why, if I'm missing something, the site wouldn't be broken... Link to comment Share on other sites More sharing options...
jfriday Posted October 5, 2010 Share Posted October 5, 2010 Oh, how silly of me. Now that I see the code on the forum I noticed the commenting out of the important part. I'm blonde at heart! Link to comment Share on other sites More sharing options...
guest* Posted October 20, 2010 Share Posted October 20, 2010 great Rocky you are my HERO.Thx. Link to comment Share on other sites More sharing options...
maestrobo Posted October 20, 2010 Share Posted October 20, 2010 thanks for the info. Link to comment Share on other sites More sharing options...
corint1 Posted March 16, 2011 Share Posted March 16, 2011 for me not working ... after comment ean13 code , in navigation bar in browser rest : www.mysite.com/categorie/product-123456789.html... need make more modification ? .hteacces file ?use 1.3.1.1 Link to comment Share on other sites More sharing options...
guest* Posted March 19, 2011 Share Posted March 19, 2011 for me not working ... after comment ean13 code , in navigation bar in browser rest : www.mysite.com/categorie/product-123456789.html... need make more modification ? .hteacces file ?use 1.3.1.1 Did you cleared browser chache and also complie cache at /tools/smarty/compile ? Link to comment Share on other sites More sharing options...
ukbaz Posted May 20, 2011 Share Posted May 20, 2011 Hi Rocky - I've tried commenting out in Link.php in v1.4.1 and then placing Link.php in overrides/classes - I then get a totally blank page :-( Have I missed something in the commenting out somewhere? Thanks, Baz public function getProductDeletePictureLink($product, $id_picture){ if (is_object($product)) return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.$this->getLangLink().((isset($product->category) AND !empty($product->category) AND $product->category != 'home') ? $product->category.'/' : '').(int)$product->id.'-'.$product->link_rewrite/*.($product->ean13 ? '-'.$product->ean13 : '')*/.'.html?deletePicture='.$id_picture) : (_PS_BASE_URL_.__PS_BASE_URI__.'product.php?id_product='.(int)$product->id).'&deletePicture='.$id_picture; else return _PS_BASE_URL_.__PS_BASE_URI__.'product.php?id_product='.(int)$product.'&deletePicture='.$id_picture; } /** * Return the correct link for product/category/supplier/manufacturer * * @param mixed $id_OBJ Can be either the object or the ID only * @param string $alias Friendly URL (only if $id_OBJ is the object) * @return string link */ public function getProductLink($id_product, $alias = NULL, $category = NULL, $ean13 = NULL, $id_lang = NULL) { if (is_object($id_product)) return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.$this->getLangLink((int)$id_lang).((isset($id_product->category) AND !empty($id_product->category) AND $id_product->category != 'home') ? $id_product->category.'/' : '').(int)$id_product->id.'-'.$id_product->link_rewrite./*($id_product->ean13 ? '-'.$id_product->ean13 : '')*/.'.html') : (_PS_BASE_URL_.__PS_BASE_URI__.'product.php?id_product='.(int)$id_product->id); elseif ($alias) return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.$this->getLangLink((int)$id_lang).(($category AND $category != 'home') ? ($category.'/') : '').(int)$id_product.'-'.$alias/*.($ean13 ? '-'.$ean13 : '')*/.'.html') : (_PS_BASE_URL_.__PS_BASE_URI__.'product.php?id_product='.(int)$id_product); else return _PS_BASE_URL_.__PS_BASE_URI__.'product.php?id_product='.(int)$id_product; Link to comment Share on other sites More sharing options...
subulica Posted April 4, 2012 Share Posted April 4, 2012 So you want to remove the EAN13 from the friendly URL? To do that, change lines 53-56 of classes/Link.php from: if (is_object($id_product)) return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.$lang_link.(($id_product->category != 'home' AND !empty($id_product->category)) ? $id_product->category.'/' : '').intval($id_product->id).'-'.$id_product->link_rewrite.($id_product->ean13 ? '-'.$id_product->ean13 : '').'.html') : (_PS_BASE_URL_.__PS_BASE_URI__.'product.php?id_product='.intval($id_product->id)); elseif ($alias) return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.$lang_link.(($category AND $category != 'home') ? ($category.'/') : '').intval($id_product).'-'.$alias.($ean13 ? '-'.$ean13 : '').'.html') : to: if (is_object($id_product)) return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.$lang_link.(($id_product->category != 'home' AND !empty($id_product->category)) ? $id_product->category.'/' : '').intval($id_product->id).'-'.$id_product->link_rewrite/*.($id_product->ean13 ? '-'.$id_product->ean13 : '')*/.'.html') : (_PS_BASE_URL_.__PS_BASE_URI__.'product.php?id_product='.intval($id_product->id)); elseif ($alias) return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.$lang_link.(($category AND $category != 'home') ? ($category.'/') : '').intval($id_product).'-'.$alias/*.($ean13 ? '-'.$ean13 : '')*/.'.html') : Is there any way to work for PS 1.4.7.0(2) ???????? Link to comment Share on other sites More sharing options...
subulica Posted April 4, 2012 Share Posted April 4, 2012 Hi Rocky - I've tried commenting out in Link.php in v1.4.1 and then placing Link.php in overrides/classes - I then get a totally blank page :-( Have I missed something in the commenting out somewhere? Thanks, Baz public function getProductDeletePictureLink($product, $id_picture){ if (is_object($product)) return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.$this->getLangLink().((isset($product->category) AND !empty($product->category) AND $product->category != 'home') ? $product->category.'/' : '').(int)$product->id.'-'.$product->link_rewrite/*.($product->ean13 ? '-'.$product->ean13 : '')*/.'.html?deletePicture='.$id_picture) : (_PS_BASE_URL_.__PS_BASE_URI__.'product.php?id_product='.(int)$product->id).'&deletePicture='.$id_picture; else return _PS_BASE_URL_.__PS_BASE_URI__.'product.php?id_product='.(int)$product.'&deletePicture='.$id_picture; } /** * Return the correct link for product/category/supplier/manufacturer * * @param mixed $id_OBJ Can be either the object or the ID only * @param string $alias Friendly URL (only if $id_OBJ is the object) * @return string link */ public function getProductLink($id_product, $alias = NULL, $category = NULL, $ean13 = NULL, $id_lang = NULL) { if (is_object($id_product)) return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.$this->getLangLink((int)$id_lang).((isset($id_product->category) AND !empty($id_product->category) AND $id_product->category != 'home') ? $id_product->category.'/' : '').(int)$id_product->id.'-'.$id_product->link_rewrite./*($id_product->ean13 ? '-'.$id_product->ean13 : '')*/.'.html') : (_PS_BASE_URL_.__PS_BASE_URI__.'product.php?id_product='.(int)$id_product->id); elseif ($alias) return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.$this->getLangLink((int)$id_lang).(($category AND $category != 'home') ? ($category.'/') : '').(int)$id_product.'-'.$alias/*.($ean13 ? '-'.$ean13 : '')*/.'.html') : (_PS_BASE_URL_.__PS_BASE_URI__.'product.php?id_product='.(int)$id_product); else return _PS_BASE_URL_.__PS_BASE_URI__.'product.php?id_product='.(int)$id_product; Same here ... a white page in PS 1.4.7.0 Link to comment Share on other sites More sharing options...
swissmark Posted April 4, 2012 Share Posted April 4, 2012 Same same.. PS 1.4.4.1 Link to comment Share on other sites More sharing options...
subulica Posted April 5, 2012 Share Posted April 5, 2012 Any suggestion? Link to comment Share on other sites More sharing options...
cyremia Posted July 3, 2012 Share Posted July 3, 2012 For the more recent version (I am on 1.4.4), you just need to apply the same logic to all the mention of EAN in the classes/Link.php file. I found 3 lines in total: Line 53, 69 & 72 in the Link.php file. Then you just need to comment out the part about EAN13. For this, just have a look at what Rocky did above. Link to comment Share on other sites More sharing options...
giuly Posted July 6, 2012 Share Posted July 6, 2012 please I have 1.4.8.2 I tried to modify that file, but I do wrong some code, if I use file modified by me it doesn't work (500 error), please could you give to me file right for that version of ps? Thanks Link to comment Share on other sites More sharing options...
cyremia Posted July 11, 2012 Share Posted July 11, 2012 Here are the changes on the file classes/Link.php Line 53 return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.$this->getLangLink().((isset($product->category) AND !empty($product->category) AND $product->category != 'home') ? $product->category.'/' : '').(int)$product->id.'-'.$product->link_rewrite/*.($product->ean13 ? '-'.$product->ean13 : '')*/.'.html?deletePicture='.$id_picture) : Line 69 return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.$this->getLangLink((int)$id_lang).((isset($id_product->category) AND !empty($id_product->category) AND $id_product->category != 'home') ? $id_product->category.'/' : '').(int)$id_product->id.'-'.$id_product->link_rewrite/*.($id_product->ean13 ? '-'.$id_product->ean13 : '')*/.'.html') : Line 72 return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.$this->getLangLink((int)$id_lang).(($category AND $category != 'home') ? ($category.'/') : '').(int)$id_product.'-'.$alias/*.($ean13 ? '-'.$ean13 : '')*/.'.html') : 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