Before you ask please READ THIS

How to exclude certain categories from appearing within the Related Products section?

edited December 2014 in Fame Posts: 4
Hello :-)

Right now we're developing an e-commerce store that will let people filter through certain products. We're using a genre as a sort of overview of all the products shown, with each specific product (works page) showing a list of other colors available at the bottom.

E.g.:
http://maestaitalia.com/genre/ties/ <- Overview of all Tie products available
http://maestaitalia.com/products/messina-black/ <- They click into one they are interested in

Then at this part, we would like the visitors to only be able to see related products of that category only. In that example, we would ideally like the visitors to ONLY see products that contain the "Messina" category/tag.

As it is right now, the visitors can see the related products that share the same category tag (i.e. Messina), but in addition to that, they can ALSO see other products from the other tag (i.e. Ties). Is there a way we can exclude certain categories from showing up in the related products?

In general, under the "Similar Works" category we would like to be able to exclude certain categories from appearing.

Thanks for your help!
Post edited by PrimalHK on

Comments

  • AirAir
    Posts: 10,970
    Hello:-)

    As much as I would like to help it is rather woocommerce question, and should be asked to them:-) You can also try to google it, cause I believe, that some people before might have asked for same thing.

    Good luck!

    With regards.
  • Hi again! :)

    I think I may have phrased my question a bit incorrectly since we are not using the woocommerce platform at all!

    I believe this is a function that is part of the actual wordpress theme since it's using the "Works (Portfolio)" section.

    Basically, we would like to be able to exclude certain categories from showing up from a genre result.

    Example:

    http://maestaitalia.com/genre/ties/
    Any images with the category "Ties" shows up here

    When the visitors click on one of the pictures, for example "Messina - Black", they will go to this page
    http://maestaitalia.com/products/messina-black/

    Note that they have two category tags, 'Ties' and 'Messina'

    Under the "Other Available Colors" (Which is basically the same thing as "Similar Works" in the original theme, we've just renamed it to that), we can see other works which contain the same category, both 'Messina' and 'Ties'.

    We would like to know if you could help us in figuring out how to exclude certain categories from appearing under the "Other Available Colors" (Old: Similar Works) section so that we can only display related works with the tag 'Messina' without displaying 'Ties' as well.

    Thank you!

  • AirAir
    Posts: 10,970
    Hello again:-)

    Sorry, I got mislead by "products" name. You are right this is part of theme.

    This feature is rather simple addition, so it wont behave as flexible as you would wish.

    However you can make such change for filtering by adding this code in fame\advance\utilities\post__work__gallery__blog.php line ~500 . Change this
    
                                array(
                                    'taxonomy' => A13_CPT_WORK_TAXONOMY,
                                    'field' => 'slug',
                                    'terms' => $__search,
                                    'operator' => 'IN'
                                ),
    
    to
    
                                array(
                                    'taxonomy' => A13_CPT_WORK_TAXONOMY,
                                    'field' => 'slug',
                                    'terms' => $__search,
                                    'operator' => 'IN'
                                ),
    	                        array(
    		                        'taxonomy' => A13_CPT_WORK_TAXONOMY,
    		                        'field' => 'slug',
    		                        'terms' => 'category_name', //category of works you want to filter out
    		                        'operator' => 'NOT IN'
    	                        ),
    
    Interesting part is terms' => 'category_name', //category of works you want to filter out
    You can also change this part to something like this to add more categories
    terms' => array( 'action', 'comedy' ),

    Hope this helps.

    With kind regards.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!