Jump to content

[Solved] How to Remove products from products list, but keep the product's page?


4140

Recommended Posts

I am getting too many 404's and that's not very good in google's eyes.
I want to be able to remove products from the catalog, without deleting their page. This way the products list would display only products which could be purchased, but the ones not available would still be there for Google to crawl.

Suggestions?

Link to comment
Share on other sites

You do it as following

1. disable the product in back office.

2. change this file to make the product page still show it.

prestaShop 1.4x in following
YourSiteRoot/controllers/productController.php

Find this code

            if (!Validate::isLoadedObject($this->product)
               OR (!$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 404 page not found');
               $this->errors[] = Tools::displayError('Pproduct 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.');



And removed following code

            if (!Validate::isLoadedObject($this->product)
               OR (!$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 404 page not found');
               $this->errors[] = Tools::displayError('Pproduct is no longer available.');
           }
           else



You are all set.

This way, the product is displayed, but user still not able to order it.
hope is works for you

Link to comment
Share on other sites

  • 3 months later...
  • 1 month later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...