fitgura Posted November 14, 2011 Share Posted November 14, 2011 Hi presta users! As I use to generate (update) day to day my sitemap.xml, and watch my google webmaster tools, I find a strange thing: I have some inactive categories with active products (just finded by customers via google index) not searchable directly on the shos site also I have some inactive products in active categories what google find out as a 404 error On the sitemap generator module there is an option: "Default: only products in active categories are included on Sitemap" Can I decrease the 404 errors on google webmaster tools if I take out the tick from this sentence?? It means this option leave out only the inactive categories including active products, or the switched off products too.... I hope it can be undersandable Thanks for advise Link to comment Share on other sites More sharing options...
fitgura Posted November 18, 2011 Author Share Posted November 18, 2011 Is there any idea please? Link to comment Share on other sites More sharing options...
fitgura Posted November 29, 2011 Author Share Posted November 29, 2011 please give me some answer Link to comment Share on other sites More sharing options...
fitgura Posted December 5, 2011 Author Share Posted December 5, 2011 I cannot belive this! Link to comment Share on other sites More sharing options...
Shhhh Posted January 20, 2012 Share Posted January 20, 2012 On 11/14/2011 at 8:10 PM, fitgura said: Hi presta users! As I use to generate (update) day to day my sitemap.xml, and watch my google webmaster tools, I find a strange thing: I have some inactive categories with active products (just finded by customers via google index) not searchable directly on the shos site also I have some inactive products in active categories what google find out as a 404 error On the sitemap generator module there is an option: "Default: only products in active categories are included on Sitemap" Can I decrease the 404 errors on google webmaster tools if I take out the tick from this sentence?? It means this option leave out only the inactive categories including active products, or the switched off products too.... I hope it can be undersandable Thanks for advise Hi there, Simplest solution is to generate your sitemap and see the result. If on the other hand you were thinking about how to avoid Google linking your inactive products just to show visitors a 404 page, the you should read this: http://www.prestashop.com/forums/topic/114270-solved-how-to-remove-products-from-products-list-but-keep-the-products-page/ and this http://www.mcanerin.com/en/articles/301-redirect-404-error.asp In my case, I went for modifying the productController.php like this: Header( "HTTP/1.1 301 Moved Permanently" ); Header( "Location: http://www.yoursite.com"); //header('HTTP/1.1 404 page not found'); //$this->errors[] = Tools::displayError('Product is no longer available.'); This would tell google that a page of a disabled product is not missing (404) but rather moved permanently to the main page of your site. You could also try redirecting to the old product category eventually... Benefit is that you could keep the pr of that site. Better read through the second article I linked before doing anything though Link to comment Share on other sites More sharing options...
fitgura Posted January 20, 2012 Author Share Posted January 20, 2012 It look so great! but where to put he "Header (...." lines in the php fiel exactly ??? thanks for advise! Link to comment Share on other sites More sharing options...
Shhhh Posted January 21, 2012 Share Posted January 21, 2012 Hi fitgura, In my case it was around line 100 in the process function of that php file. Here is a bigger code excerpt so you can identify the exact place. PS: the two lines with // in front are the originals I commented out so you can look in your file for those two lines too. public function process() { global $cart, $currency; parent::process(); if (!Validate::isLoadedObject($this->product)) $this->errors[] = Tools::displayError('Product not found'); else { if ((!$this->product->active AND (Tools::getValue('adtoken') != Tools::encrypt('PreviewProduct'.$this->product->id)) || !file_exists(dirname(__FILE__).'/../'.Tools::getValue('ad').'/ajax.php'))) { Header( "HTTP/1.1 301 Moved Permanently" ); Header( "Location: http://www.yoursite.com"); //header('HTTP/1.1 404 page not found'); //$this->errors[] = Tools::displayError('Product is no longer available.'); } elseif (!$this->product->checkAccess((int)self::$cookie->id_customer)) $this->errors[] = Tools::displayError('You do not have access to this product.'); else { Link to comment Share on other sites More sharing options...
fitgura Posted January 23, 2012 Author Share Posted January 23, 2012 Thanks so much Dude! It is just works fine Link to comment Share on other sites More sharing options...
Recommended Posts