Jump to content

Can't see products in home page category


Recommended Posts

Hi,

I have some issues with the products in home page.
I followed this tutorial to set the category as my landing page:

http://mypresta.eu/en/art/developer/category-page-as-landing-page-of-your-prestashop.html

First try, everything works fine, i can associate my products with the home page in my BO and i see them correctly in the front end.

Then i try to migrate the website from localhost to my domain,( exporting and importing the database with phpmyadmin) and the home page turns empty.
I did the same process on a new version of PS in local (so again with the database cloned with phpmyadmin) and nothing the list in home page is empty.

Do you guys have any ideas of the cause?

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

nope.
going here will show me no products and just the subcategories.

index.php?id_category=2&controller=category

In the back end i have set 3 products in home page and I can see them. One of them it's a brand new product created within the BO but still nothing. 

Link to comment
Share on other sites

IndexController.php

class IndexControllerCore extends CategoryController
{
 public $php_self = 'index';
/**
 * Assign template vars related to page content
 * @see FrontController::initContent()
 */
 public function init(){
 $_GET['id_category']=2;
 parent::init();
 }
 public function initContent()
 {
 parent::initContent();

 }
}
CategoryController.php
<?php
class CategoryController extends CategoryControllerCore {

    public function initContent()
	{
		parent::initContent();
		
		if ($this->category->id==2){
$this->setTemplate(_PS_THEME_DIR_.'category-home.tpl'); // template file for caregory id: 2 HOMEPAGE
} else {
$this->setTemplate(_PS_THEME_DIR_.'category.tpl'); // DEFAULT template
}
	}		

}

However the problem exist even if i delete these modification.

Also now I changed the products in homefeatured and it's not rendering anymore.

Link to comment
Share on other sites

I have these errors:

Undefined index: nb_products in /Applications/XAMPP/xamppfiles/htdocs/p156/cache/smarty/compile/32/09/bd/3209bd738280c4a1e40573f5faece0dcf2132188.file.category-count.tpl.php on line 28
 
Trying to get property of non-object in /Applications/XAMPP/xamppfiles/htdocs/p156/cache/smarty/compile/32/09/bd/3209bd738280c4a1e40573f5faece0dcf2132188.file.category-count.tpl.php on line 28
 
Non ci sono prodotti.
Link to comment
Share on other sites

  • 2 weeks later...
  • 1 year later...

I know it's an old topic, but maybe will help somebody: - new CategoryController (/controllers/front/CategoryController.php has a line 114:

if (!in_array($this->category->id, array(Configuration::get('PS_HOME_CATEGORY'), Configuration::get('PS_ROOT_CATEGORY'))))

 

Change it to:

if ($this->category->id != 1)

 

That should fix problem (especially for PS 1.5.6.3). For PS 1.6 there is another solution: http://forge.prestashop.com/browse/PSCSX-1360

 

What happens is that in old Prestashop e.g. 1.4 you've had categories selected as root category, but after update in 1.5 you get Root category as id_category 1 and there used to be home category earlier instead of root. So, changing categories by hand in database might have fixed future issues, but that's only my opinion...

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

  • 3 weeks later...
×
×
  • Create New...