Jump to content

Categories block - how to show products without a category?


Recommended Posts

I only have a small number of products (5), that fall into one category. So I don't need to create any subcategories.

I want all my products to show up in the "Categories block" under the "Home" category.

I tried assigning all my products to the "Home" category, but they are not showing.

Please advice on how to resolve this.

Link to comment
Share on other sites

  • 9 months later...

I too have this problem.

If i go to the "home" category page, there are no products visible.

For example, take a look here:
http://bettafootwear.com/CrownYourFeet/shop/1-home

No products are visible. How can I change it so that if the user visits the "home" category page, that it will show ALL products?

Please not that i've made sure i put a checkmark next to "home" when creating all the products, but that has no effect.

Link to comment
Share on other sites

It looks like PrestaShop purposely doesn't display "Home" category products. Change lines 62-68 of category.php from:

if ($category->id != 1)
{
   $nbProducts = $category->getProducts(NULL, NULL, NULL, $orderBy, $orderWay, true);
   include(dirname(__FILE__).'/pagination.php');
   $smarty->assign('nb_products', $nbProducts);
   $cat_products = $category->getProducts(intval($cookie->id_lang), intval($p), intval($n), $orderBy, $orderWay);
}



to:

$nbProducts = $category->getProducts(NULL, NULL, NULL, $orderBy, $orderWay, true);
include(dirname(__FILE__).'/pagination.php');
$smarty->assign('nb_products', $nbProducts);
$cat_products = $category->getProducts(intval($cookie->id_lang), intval($p), intval($n), $orderBy, $orderWay);

Link to comment
Share on other sites

Thank you rocky! This is exactly what I was looking for!!

Perhaps that should be an option somewhere in the preferences?

I think it would at least be better to remove that if{} wrapper so if a customer lands on the "home" category page they will at least see product and it will be that much closer to a potential purchase.

Link to comment
Share on other sites

  • 5 months later...
The code is the same, but it's been moved to lines 135-141 of controllers/CategoryController.php in PrestaShop v1.4.3.


Is there any way can just get rid of that from the source? Having zero products appear on the "home" category page seems like a bad idea.... You'd think that displaying all products would be much better...

I bet hardly anyone would then ask how to hide all products (and thus lessen their chance of selling).
Link to comment
Share on other sites

  • 1 month later...
Tried the code in 1.44, not work. :wub:

 

Likewise here, and I'm sadly not yet familiar enough with PrestaShop to figure this out for myself yet (only been plugging away at this for a couple of weeks!)

 

I appreciate I'm just being a greedy noob here, but I don't suppose anyone's able to shed any light on the subject are they?

 

I suspect I'll just end up hard-coding direct links (oh no!) as the shop I'm working on only has a handful of products.

 

Thanks!

Link to comment
Share on other sites

  • 11 months 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...