akparade Posted April 23, 2012 Share Posted April 23, 2012 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 More sharing options...
Mike Kranzler Posted April 23, 2012 Share Posted April 23, 2012 Hi akparade, When you add a product, you can select under which categories it is listed here. Can you please post a link where I can see this for myself? -Mike Link to comment Share on other sites More sharing options...
akparade Posted April 23, 2012 Author Share Posted April 23, 2012 Sure. http://i40.tinypic.com/j586j6.jpg Are you going to say it needs to have "home" selected? Link to comment Share on other sites More sharing options...
Dh42 Posted April 24, 2012 Share Posted April 24, 2012 If you want to fix it globally in your categories.tpl file delete the reference to products-list.tpl Link to comment Share on other sites More sharing options...
akparade Posted April 24, 2012 Author Share Posted April 24, 2012 Surely you shouldn't have to do that, though? Will that actually just delete it for the root? I don't see how. Link to comment Share on other sites More sharing options...
Mike Kranzler Posted April 24, 2012 Share Posted April 24, 2012 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 More sharing options...
akparade Posted April 24, 2012 Author Share Posted April 24, 2012 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 More sharing options...
Dh42 Posted April 24, 2012 Share Posted April 24, 2012 You will manually have to add the category ids to your statement. There is no way to dynamically add them unless you reverse your if statement to make the default to hide them. Link to comment Share on other sites More sharing options...
akparade Posted April 24, 2012 Author Share Posted April 24, 2012 I know, I've put it to show everything in that IF tag if it's any category but the Mens root (ID of 5) - I just need one more category with ID of 17 to to be added to it to not show the product-list etc Link to comment Share on other sites More sharing options...
Dh42 Posted April 24, 2012 Share Posted April 24, 2012 {if $category->id !== 5 or $category->id !== 17} should work. Link to comment Share on other sites More sharing options...
akparade Posted April 24, 2012 Author Share Posted April 24, 2012 Unfortunately that doesn't work. Link to comment Share on other sites More sharing options...
Dh42 Posted April 25, 2012 Share Posted April 25, 2012 Copy the exact same statement and paste it below the original, just replace the 5 with 17 on the new one. Link to comment Share on other sites More sharing options...
akparade Posted April 25, 2012 Author Share Posted April 25, 2012 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 More sharing options...
akparade Posted April 25, 2012 Author Share Posted April 25, 2012 works with AND instead of or sorted. Thanks for the help guys! 1 Link to comment Share on other sites More sharing options...
ragnabt Posted May 17, 2012 Share Posted May 17, 2012 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 More sharing options...
namelesshachi Posted June 12, 2012 Share Posted June 12, 2012 On the other side, i want this to happen (subcategory products showing on main category) but it doesn't do it, any help? Link to comment Share on other sites More sharing options...
Bejo Posted October 9, 2012 Share Posted October 9, 2012 (edited) 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 October 9, 2012 by jesen (see edit history) Link to comment Share on other sites More sharing options...
Allan - Fungadgets.dk Posted February 13, 2013 Share Posted February 13, 2013 It is because you have the "Layerd navigation" installed. If you uninstall it, products will only show in the category you assigned them to Link to comment Share on other sites More sharing options...
desudura Posted April 9, 2013 Share Posted April 9, 2013 don't need to uninstall it. just modules->layered navigation and "Show products from subcategories" set to no, save and you're done Link to comment Share on other sites More sharing options...
Recommended Posts