Jump to content

[SOLVED] Major issue - sub-category products showing in root category


Recommended Posts

Hey - I have 12 products on my site as testers they are ALL just in:

 

Mens > T Shirts

 

but... they are also showing in Mens root, too.

 

This is a major issue and i'm yet to find out how to sort this. Can anyone look at this? Must be a bug or something?

Link to comment
Share on other sites

  On 4/23/2012 at 11:17 PM, akparade said:

Sure.

 

http://i40.tinypic.com/j586j6.jpg

 

Are you going to say it needs to have "home" selected?

 

Hi akparade,

Thanks for clearing that up. That is actually completely normal behavior for PrestaShop, if you don't want them to show up there you'll likely need to do code customizations as DesignHaus42 suggested above.

 

-Mike

Link to comment
Share on other sites

It's actually really easy now you've thought of that, DesignHaus42. However, how do I hide from multiple categories? I have hidden just the one root (Mens) at the moment with the below code:

 

   {if $category->id !== 5}
 {include file="$tpl_dir./product-compare.tpl"}
 <div class="cattopsorting">
  {include file="$tpl_dir./pagination.tpl"}
  {include file="$tpl_dir./product-sort.tpl"}
  <div style="clear: both;"></div>
 </div>
 {include file="$tpl_dir./product-list.tpl" products=$products}
   {/if}

Link to comment
Share on other sites

I may not be understanding you correctly, but this is what I have and it doesn't work?

 

   {if $category->id !== 17  or  $category->id !== 5}
 {include file="$tpl_dir./product-compare.tpl"}
 <div class="cattopsorting">
  {include file="$tpl_dir./pagination.tpl"}
  {include file="$tpl_dir./product-sort.tpl"}
  <div style="clear: both;"></div>
 </div>
 {include file="$tpl_dir./product-list.tpl" products=$products}
   {/if}

Link to comment
Share on other sites

  • 4 weeks later...

Hi, i have spent the whole day searching for an answer to this question, finally I gave up and tried to figure it out in the code.

 

I commented one line in the categorycontroller.php file in the Productlistassign function:

 

 

//Module::hookExec('productListAssign', array('nbProducts' => &$this->nbProducts, 'catProducts' => &$this->cat_products, 'hookExecuted' => &$hookExecuted));

 

And now my parentcategories only show the products connected to them and not the products in my subcategories.

 

Have no idea if it gives some consequences but i´m taking a chance :) and i can continue to work on my shop

Link to comment
Share on other sites

  • 4 weeks later...
  • 3 months later...
  On 5/17/2012 at 9:04 PM, ragnabt said:

Hi, i have spent the whole day searching for an answer to this question, finally I gave up and tried to figure it out in the code.

 

I commented one line in the categorycontroller.php file in the Productlistassign function:

 

 

//Module::hookExec('productListAssign', array('nbProducts' => &$this->nbProducts, 'catProducts' => &$this->cat_products, 'hookExecuted' => &$hookExecuted));

 

And now my parentcategories only show the products connected to them and not the products in my subcategories.

 

Have no idea if it gives some consequences but i´m taking a chance :) and i can continue to work on my shop

 

Already did you guide above but di product list still display on main category.!! pls! on ps 1.5.1

 

public function assignProductList()
{
 $hookExecuted = false;
 Hook::exec('actionProductListOverride', array(
  'nbProducts' => &$this->nbProducts,
  'catProducts' => &$this->cat_products,
  'hookExecuted' => &$hookExecuted,
 ));
 // The hook was not executed, standard working
 if (!$hookExecuted)
 {
  $this->context->smarty->assign('categoryNameComplement', '');
  $this->nbProducts = $this->category->getProducts(null, null, null, $this->orderBy, $this->orderWay, true);
  $this->pagination((int)$this->nbProducts); // Pagination must be call after "getProducts"
  $this->cat_products = $this->category->getProducts($this->context->language->id, (int)$this->p, (int)$this->n, $this->orderBy, $this->orderWay);
 }
 // Hook executed, use the override
 else
  // Pagination must be call after "getProducts"
  $this->pagination($this->nbProducts);
 $this->context->smarty->assign('nb_products', $this->nbProducts);
}
}

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

  • 4 months later...
  • 1 month later...
×
×
  • Create New...