the.rampage.rado Posted January 8, 2013 Share Posted January 8, 2013 (edited) Hello PrestaTeam! As the whole community sees things are getting better, there's action in github and your product is on the right way. I'm building mi site for 5-6 months now and I'm on the final stretch - edited the default theme, imported products, updated to 1.5.3.1, the site is working fine with no major FO flaws so I would like to migrate it asap. But there's one thing that stops me - Prestashop's sitemap and it's current condition. Let me describe my configuration: 1. Friendly URLs turned ON on shared hosting runing mod_rewrite in CGI so as we know 'it's working' but the message in BO stays there. 2. I have 2 languages - EN and BG Sitemap issues: 1. When Friendly URLs enabled - product links in the sitemap are not rewritten. If I enter that address in my browser it redirects me to the Frienly URL but would that effect Google's craw rate? 2. Product pages are indexed in the sitemap only with language ID=1 and product pages with Bulgarian link are missing. Why? This is what troubles me most because at the moment I'm selling localy only and I don't want to loose my rankings in Bulgarian serps 3.Picture names are also included only in English - currently it's very good for google to have product images with names - it gives very good results on long keyword searches and drags good amount of users to your shop. When I click on 'save image' in FO it rewrites it for both languages but only English is indexed in the sitemaps. This is very important also. I think there should be more clarity about the sitemap. I'm posting this here to be seen by more people. If you consider appropriate you can move it under SEO section. Best regards Edited January 12, 2013 by the.rampage.rado (see edit history) 1 Link to comment Share on other sites More sharing options...
the.rampage.rado Posted January 10, 2013 Author Share Posted January 10, 2013 Somebody on this one? Thanks! Link to comment Share on other sites More sharing options...
El Patron Posted January 11, 2013 Share Posted January 11, 2013 (edited) just ran sitemap for new 1.5.3.0 shop...unfriendly url's... did they not even test this? not only that the shop default language is ES and I had EN enabled for the BO. The sitemap only created the products in EN...good lawd.. I am sad Edited January 11, 2013 by elpatron (see edit history) 1 Link to comment Share on other sites More sharing options...
the.rampage.rado Posted January 12, 2013 Author Share Posted January 12, 2013 (edited) This issue is presented in all 1.5 versions, it's not only 1.5.3 specific and there's still no solution. Obviously they don't know how to fix it... Edited January 12, 2013 by the.rampage.rado (see edit history) Link to comment Share on other sites More sharing options...
sofoklis Posted January 23, 2013 Share Posted January 23, 2013 (edited) 1. open gsitemap.php 2. go to line 180 and there you'll find the following part of SQL LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (ps.id_category_default = cl.id_category AND pl.id_lang = X AND cl.id_shop = '.(int)$id_shop.') at the point of bold replace the variable with your lang id 3. go to line 208 and find the following line (my proposal include at the end of line something very useful, 3 extras parameters) $tmpLink = $this->context->link->getProductLink((int)($product['id_product']), $product['link_rewrite'], $product['category'], $product['ean13'], X ,null,0,true); at the point of bold replace the X with your lang id. With those modifications you'll have a sitemap.xml with friendly URL's in your prefered language This issue is presented in all 1.5 versions, it's not only 1.5.3 specific and there's still no solution. Obviously they don't know how to fix it... Edited January 23, 2013 by sofoklis (see edit history) 2 Link to comment Share on other sites More sharing options...
jorgemartin Posted January 27, 2013 Share Posted January 27, 2013 Some improvements to the comment of sofoklis With my test I have achiveded to get products with friendly url and with all languages I haven't use the point 2 in sofoklis instructions. Then I get the products in all languages In point 3 I have added the 3 extra arguments but I haven't change the language reference. Maintain the (int)($product['id_lang']) Then in line 201 more or less you have // if the product has not been added $id_product = $product['id_product']; Below, you must add the line $id_lang = $product['id_lang']; and edit the next with if (!isset($done[$id_product][$id_lang]['added'])) In line 215 more or less, in the same loop you find: // considers the product has added Then you must replace the next line with: $done[$id_product][$id_lang]['added'] = true; With this 2 changes you add the product in every languagesto the array with friendly url I haven't used the same logical for the image loop because then you duplicate the images in the sitemap, I don't know the efect in SEO For the classic pages I have change temporaly Dispatcher.php . In the function __construct () I have change the line 207-208 from: $this->default_controller = 'adminhome'; $this->use_routes = false; to $this->default_controller = 'adminhome'; $this->use_routes = true; Then I update the sitemap manually in the admin section: modules>gsitemap>configure>Update sitemap file It make the urls correctly with my custom Format in SEO&URL,then I return the 208 line from dispatcher to false, because I don't know if it will make a fail in other places. Apologies for my english Fernando 1 Link to comment Share on other sites More sharing options...
Chris2012 Posted February 2, 2013 Share Posted February 2, 2013 Did anybody tested methods of Sofoklis and Jorgemartin. Any conclusions? Link to comment Share on other sites More sharing options...
guest* Posted February 4, 2013 Share Posted February 4, 2013 @Chir2012 - I found the following solution in the forum, BUT it is still adding the EAN to the link, which I 've disabled for showing in BO. Somebody knows how to change the line for it ? fix is modifying gsitemap.php in line 209 and change it to: $tmpLink = $this->context->link->getProductLink((int)($product['id_product']), $product['link_rewrite'], $product['category'], $product['ean13'], (int)($product['id_lang']),null,0,true); 2 Link to comment Share on other sites More sharing options...
Chris2012 Posted February 4, 2013 Share Posted February 4, 2013 @cd2500 - Thank you very much for your solution. It works for me. I don't use EAN yet, so I can't try it, but what if you delete: " $product['ean13'], " from that line 209? Thank you very much again! Link to comment Share on other sites More sharing options...
guest* Posted February 5, 2013 Share Posted February 5, 2013 Yes already done. I've deleted EAN everywhere, also in /classes/link.php. By doing this the URL is again with productcontroller, instead of friendly. Link to comment Share on other sites More sharing options...
Trip Posted February 5, 2013 Share Posted February 5, 2013 (edited) Hi there, made just a rough test but set a null for $product['ean13'] should do the trick: $tmpLink = $this->context->link->getProductLink((int)($product['id_product']), $product['link_rewrite'], $product['category'], null, (int)($product['id_lang']),null,0,true); Best regards, trip Edited March 16, 2013 by Trip (see edit history) Link to comment Share on other sites More sharing options...
guest* Posted February 10, 2013 Share Posted February 10, 2013 Hi Trip, thank you very much, yes this solves my problem. Best regards Link to comment Share on other sites More sharing options...
SteliosAl Posted February 11, 2013 Share Posted February 11, 2013 Hi Trip, thank you very much, yes this solves my problem. Best regards I have replaced line 209 with the code you provided and when i try to update my sitemap i get this error:[PrestaShop] Fatal error in module gsitemap: Call to a member function addChild() on a non-object Any help? Thanks Link to comment Share on other sites More sharing options...
BL_promo Posted March 14, 2013 Share Posted March 14, 2013 I have modified some line $this->_addSitemapNode($xml, Tools::getShopDomain(true, true).__PS_BASE_URI__.$lang['iso_code'].'/', '1.00', 'daily', date('Y-m-d')); in $this->_addSitemapNode($xml, Tools::getShopDomain(true, true).__PS_BASE_URI__."it".'/', '1.00', 'daily', date('Y-m-d')); This fix the iso code, in my case. Then, I change LEFT JOIN '._DB_PREFIX_.'lang l ON (pl.id_lang = l.id_lang) with LEFT JOIN '._DB_PREFIX_.'lang l ON (pl.id_lang = 6) and this fix the language of the product. Now, my sitemap.xml is generated without apply the rules of rewriting and if I click in the link I have a 404 error. Wrong sitemap: http://mysite/it/index.php?controller=product_rule&id=2&rewrite=mini-piscina-idromassaggio-nuoto-controcorrente-bl858 Right sitemap: http://mysite/it/index.php?controller=product_rule&id=2&rewrite=mini-piscina-idromassaggio-nuoto-controcorrente-bl858-p-2.html Any suggestion? I need to open the new store... we lost a lot of money every day... Link to comment Share on other sites More sharing options...
BL_promo Posted March 14, 2013 Share Posted March 14, 2013 (edited) I have modified some line $this->_addSitemapNode($xml, Tools::getShopDomain(true, true).__PS_BASE_URI__.$lang['iso_code'].'/', '1.00', 'daily', date('Y-m-d')); in $this->_addSitemapNode($xml, Tools::getShopDomain(true, true).__PS_BASE_URI__."it".'/', '1.00', 'daily', date('Y-m-d')); This fix the iso code, in my case. Then, I change LEFT JOIN '._DB_PREFIX_.'lang l ON (pl.id_lang = l.id_lang) with LEFT JOIN '._DB_PREFIX_.'lang l ON (pl.id_lang = 6) and this fix the language of the product. Now, my sitemap.xml is generated without apply the rules of rewriting and if I click in the link I have a 404 error. Wrong sitemap: http://mysite/it/ind...ocorrente-bl858 Right sitemap: http://mysite/it/ind...-bl858-p-2.html Any suggestion? I need to open the new store... we lost a lot of money every day... Not necessary modifying this: $langs = Language::getLanguages(); ->>>>> $langs[] = Language::getLanguage(6); But the link to product and cms are still wrong. The link to images works fine. Edited March 14, 2013 by BL_promo (see edit history) Link to comment Share on other sites More sharing options...
charlie123 Posted March 14, 2013 Share Posted March 14, 2013 Hi there, made just a rough test but set a null for $product['ean13'] should do the trick: $tmpLink = $this->context->link->getProductLink((int)($product['id_product']), $product['link_rewrite'], $product['category'], 'null', (int)($product['id_lang']),null,0,true); Best regards, trip I tried this but now instead of EAN13 number i have "-null" added to the end of my URL /id-product-name-null.html How to get a rid of it? Link to comment Share on other sites More sharing options...
Trip Posted March 16, 2013 Share Posted March 16, 2013 At Charlie, trie using null without the ' ' ... a maybe cleaner solution might look like $tmpLink = Configuration::get('PS_REWRITING_SETTINGS') ? $this->context->link->getProductLink((int)($product['id_product']), $product['link_rewrite'], $product['category'], null, (int)($product['id_lang']),null,0,true): $this->context->link->getProductLink((int)($product['id_product']), $product['link_rewrite'], $product['category'], $product['ean13'], (int)($product['id_lang'])); At the moment I am trying to get this up with multiple languages. It seems they did not have that in mind designing the module. What I have so far is // adds the product if(count($langs) > 1) foreach($langs as $lang){ $id_lang = $lang['id_lang']; $tmpLink = Configuration::get('PS_REWRITING_SETTINGS') ? $this->context->link->getProductLink((int)($product['id_product']), $product['link_rewrite'], $product['category'], null, (int)($id_lang),null,0,true): $this->context->link->getProductLink((int)($product['id_product']), $product['link_rewrite'], $product['category'], $product['ean13'], (int)($id_lang)); $sitemap = $this->_addSitemapNode($xml, $tmpLink, $priority, 'weekly', substr($product['date_upd'], 0, 10)); } else{ $tmpLink = Configuration::get('PS_REWRITING_SETTINGS') ? $this->context->link->getProductLink((int)($product['id_product']), $product['link_rewrite'], $product['category'], null, (int)($product['id_lang']),null,0,true): $this->context->link->getProductLink((int)($product['id_product']), $product['link_rewrite'], $product['category'], $product['ean13'], (int)($product['id_lang'])); } but I have to add a function to get $product['link_rewrite'] in the right language and the image:caption and image:title are wrong too. Maybe I find a smarter way on doing this. 2 Link to comment Share on other sites More sharing options...
radus Posted March 17, 2013 Share Posted March 17, 2013 @Trip don't forget adding multilanguage rel=canonical for all enabled language pages, while using default language as default hreglang canonical url. I cannot write code, but can contribute with some knowledge. Link to comment Share on other sites More sharing options...
charlie123 Posted March 19, 2013 Share Posted March 19, 2013 Thank you Trip, I've implemented this code and it's working fine now $tmpLink = Configuration::get('PS_REWRITING_SETTINGS') ? $this->context->link->getProductLink((int)($product['id_product']), $product['link_rewrite'], $product['category'], null, (int)($product['id_lang']),null,0,true): $this->context->link->getProductLink((int)($product['id_product']), $product['link_rewrite'], $product['category'], $product['ean13'], (int)($product['id_lang'])); 1 Link to comment Share on other sites More sharing options...
BL_promo Posted March 20, 2013 Share Posted March 20, 2013 Thank you, charlie123, this code works fine. Now, I have the last problem with sitemap: the link included are not correct, because they don't follow the directives of rewriting. This is very important for me. Then, if was possible to remove from sitemap the EAN... this is like a cherry on the top of the cake. Link to comment Share on other sites More sharing options...
charlie123 Posted March 20, 2013 Share Posted March 20, 2013 Thank you, charlie123, this code works fine. Now, I have the last problem with sitemap: the link included are not correct, because they don't follow the directives of rewriting. This is very important for me. Then, if was possible to remove from sitemap the EAN... this is like a cherry on the top of the cake. The URL rewriting doesn't work with latest buggy PrestaShop 1.5.3.1 What I did, I've just edit the core file (which is not recommended but this is the only way for now) and I removed EAN13 from the link generator. Than the code above for sitemap will work fine and all your sitemap and product links will be correct (make sure you refresh your sitemap and htaccess file, cache etc). To see which code you will need to edit visit: http://www.prestashop.com/forums/index.php?/topic/215984-schema-of-urls-not-updating/page__view__findpost__p__1148382 1 Link to comment Share on other sites More sharing options...
zabojad Posted May 1, 2013 Share Posted May 1, 2013 Hi ! With the above fixes, products have now friendly URLs in the sitemap.xml. However the classic pages (news products, ...) don't. How to fix it for them too ? Thanks Tom Link to comment Share on other sites More sharing options...
marcis Posted June 26, 2013 Share Posted June 26, 2013 Wow, I can't believe something so basic for SEO (and for the shop!) as a sitemap doesn't work properly! Same problem here, customized URLs are ignored by the gsitemap module. Link to comment Share on other sites More sharing options...
Toni Mármol Posted June 26, 2013 Share Posted June 26, 2013 This is module is so needed. I have no sitemaps for 3 months and that is affecting to my SEO. I'm on a multishop+multilanguange environment... If someone code a new third party module, it will have quite sales and money. I don't know why Prestashop Team is not working on this. To have sitemaps on these days is indispensable for success. Link to comment Share on other sites More sharing options...
bannerclick Posted September 10, 2013 Share Posted September 10, 2013 The problem still exists...Anyone from Presta?? Link to comment Share on other sites More sharing options...
bannerclick Posted September 11, 2013 Share Posted September 11, 2013 Anyone an idea? I have tried to generate sitemap on localhost, and see a wrong URL for the second shop; the directory contains a duplicate: http://localhost:8888/prestest/prestest/2_index_sitemap.xml This probably is where things go wrong? Link to comment Share on other sites More sharing options...
benjamin utterback Posted September 19, 2013 Share Posted September 19, 2013 Hello! Can everybody make sure that they have this change in their classes/dispatcher.php The code change is here, it's a one line deletion. https://github.com/PrestaShop/PrestaShop/commit/3607c2264fb7ba9a3dae0e173098ecc0f6b16488 Make sure to take all backups before touching the code. Thank you! Link to comment Share on other sites More sharing options...
Guest Posted April 10, 2014 Share Posted April 10, 2014 Hello there. I am using Prestashop 1.5.4 and solution of Benjamin Utterback for sitemap worked for me, so changing classes/dispatcher.php from given URL and updating gsitemap.php from https://github.com/PrestaShop/PrestaShop-modules/commit/86266f4251220853f413404a579c651926ad5071 did work for me as I had .html links instead of product_id or category_id. Link to comment Share on other sites More sharing options...
Recommended Posts