[WPMU DEV Dashboard] Category Filter for Marketpress

It would be nice to be able to filter products by category as a feature of this plugin.

  • Ohidul Islam
    • Staff

    Hello Peter,

    Hope you are well today, thank you for coming to our support!

    Could you please specify that you want to have Filter products by category feature in your shop/products page?

    If that is yes, would you please navigate to Store Settings > Presentation and look for Hide Products Filter? under Product List/Grid Settings section and uncheck this then save settings. Check the image for further reference.

    Please let me know if the solution works for you, I would be happy to help you more if you have got any more questions.

    Kind regards,
    Ohid

  • Peter Barrett
    • WPMU DEV Initiate

    This works in a way, but it takes you to an entirely separate page that doesn't seem to show the images and has long descriptions of each product. I have attached a screenshot of both the store page, and the after category selection page so you can see the difference.

    Store Page

    Category Filter applied

  • Ohidul Islam
    • Staff

    Hey Peter,

    Glad to hear back from you, hope you are having a nice day!

    I have checked with that settings and yes, after selecting category from Products page it is displaying results in a different designed page.

    It is happening because of the lack of proper WordPress page templates in the current theme that you are using. If you switch to any default theme, your category page will look like this in Twenty Seventeen theme.
    That is the same design of the Shop Page

    So the solution for this issue is to either design your category page or switch to another good theme.

    Please let me know if you have any more questions.

    Kind regards,
    Ohid

  • Peter Barrett
    • WPMU DEV Initiate

    Okay, this makes sense. I think the best thing for me to do now is make my own template file to accomplish this.

    Can you tell me the template file that the twenty seventeen theme is using so I can look at that in order to further make my own template for these product categories?

  • Ohidul Islam
    • Staff

    Hey Peter,

    Thank you for understanding this. Creating custom templates to accomplishing goals is the best way. So that you can avoid conflicts by writing your own codes.

    MarketPress uses page.php file to render products by category and tags. I can share a standard full category page code what you can can use as your page.php file.

    I have shared the code using a code sharing website, you can get the codes from here .

    Hope this helps.

    Kind regards,
    Ohid

  • Peter Barrett
    • WPMU DEV Initiate

    <?php get_header();

    $args = array(
    'post_type' => 'product',
    'posts_per_page' => 12
    );

    $loop = new WP_Query( $args );

    while ( $loop->have_posts() ) : $loop->the_post();
    get_template_part( 'content', 'product' );
    comments_template( '', true );
    endwhile; // end of the loop. ?>

    <?php get_footer();?>

  • Peter Barrett
    • WPMU DEV Initiate

    Also I found another tutorial on the blog for theming marketpress which helped me to name the file "mp_category.php". I can see that after naming the file this way that it does modify the category pages I would like while not messing up other things. When I named it page.php it caused issues with all the pages on the website. I believe mp_category.php is correct for what I am trying to fix here, but please let me know if I am wrong.

  • Ohidul Islam
    • Staff

    Hello Peter,

    Glad to hear back from you, also asking apologizes for my late reply.

    It's the right way to customize the Products category page by using the mp_category.php file. Please duplicate your page.php file and rename it to mp_category.php. Then you can edit your HTML markups if you want but do not need to change the PHP loop codes, and so the existing loop of page.php will work for you in mp_category.php as well.

    I have tested your loop code that doesn't work. You do not need to use WP_Query for this, you can just use regular query that uses on any page.php file.

    Hope this helps, please let me know if you need any more assistance.

    Kind regards,
    Ohid

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.