Jump to content

Show not active products page


Kerm

Recommended Posts

Hello, can some one help with this problem:

 

My client have shop, and for seo need change prestashop to show not active products pages.

 

disabled.gif

 

Client have prestashop 1.4 and his products periodically become inactive and this products hide from category product list, but he want to have these items remain accessible for a direct link for seo.

 

Can some1 tell me how can i do that?

 

Link to comment
Share on other sites

you can create custom url with get variable

http://domain.com/categoryPage?showInactive
http://domain.com/category/productPage?showInactive

and then modify the related Controller files

 

For example :

CategoryController.php  - function assignProductList()  - set param $active = false

// set param $active = true
if(Tools::isSubmit('showInactive'))
      $this->cat_products = $this->category->getProducts($this->context->language->id, (int)$this->p, (int)$this->n, $this->orderBy, $this->orderWay, false, false);
else
      $this->cat_products = $this->category->getProducts($this->context->language->id, (int)$this->p, (int)$this->n, $this->orderBy, $this->orderWay);

 
ProductController.php - function init() - force to set inactive product as active before object validation

if ($id_product = (int)Tools::getValue('id_product'))
  $this->product = new Product($id_product, true, $this->context->language->id, $this->context->shop->id);

// force to set inactive product as active
if(Tools::isSubmit('showInactive'))
    $this->product->active = true;
Edited by gonebdg - webindoshop.com (see edit history)
  • Like 1
Link to comment
Share on other sites

First very big thx for your answer and your desire to help me!

 

I think this link:

site.com/category/12807-product.html

 

not the same link for seo with that:

site.com/category/12807-product.html?showInactive

 

or im wrong?

 

Or in .htaccess i must do 301 redirect from site.com/category/12807-product.html?showInactive to site.com/category/12807-product.html some how?

 

Just what happen if "search robot" go on site by old link? or customer press that link in search result?

Edited by Kerm (see edit history)
Link to comment
Share on other sites

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...