Custom Template for Product Listing Page

I need to make a custom template for the product listing page
I am using the product theme
I am assuming I start by adding a file to theme dir called mp_productlis.php that is based of the archive page
but they is where I get stock how do I find the coded needed to display the product information in the correct loop?

  • DavidM

    Hi hcgdiet,

    I believe what you're looking for is mp_product_list(). It's detailed in:

    And I believe you'll be able to include it in your mp_productlist.php file as follows:
    <?php mp_product_list() ?>

    And for reference, the following is from the template-functions.php file:

     * Displays a list of products according to preference. Optional values default to the values in Presentation Settings -> Product List
     * @param bool $echo Optional, whether to echo or return
     * @param bool $paginate Optional, whether to paginate
     * @param int $page Optional, The page number to display in the product list if $paginate is set to true.
     * @param int $per_page Optional, How many products to display in the product list if $paginate is set to true.
     * @param string $order_by Optional, What field to order products by. Can be: title, date, ID, author, price, sales, rand
     * @param string $order Optional, Direction to order products by. Can be: DESC, ASC
     * @param string $category Optional, limit to a product category
     * @param string $tag Optional, limit to a product tag
    function mp_list_products( $echo = true, $paginate = '', $page = '', $per_page = '', $order_by = '', $order = '', $category = '', $tag = '' )

    Also perhaps of relevance is the mp_list_categories() and mp_popular_products() functions. Customizing the template files means you get precise control of how everything's displayed.

    If you have any questions on this, let me know and I'll see how I can help. :slight_smile:


  • hcgdiet

    so from your first point the functions is actually:
    <?php mp_list_products() ?>
    and replacing the calls to excerptloop in the archive template does give the results
    however my problem is that I don't like the layout that comes from mp_list_products
    so I have copied the entire function contents in to my mp_productlist.php page with a couple of modifications seems to work fine
    having a little trouble with my active nav styling correctly now
    will post solution when I am finished

  • DavidM

    Hi hcgdiet,

    This one just came to my attention. You can take a look at the following thread where nickd32 has given away some very awesome additions for MarketPress, the more relevant item being a grid based version of mp_products_list().

    Let us know how your solution goes, will be glad to see it all work well for ya. :slight_smile:

  • hcgdiet

    I found that link after I replied and am thinking about customizing that plugin to my liking
    that will allow me to create a new page that will display how I want and fix the menu problem, plus this is better flexibility for my client

    Aaron the loop thing works but for some reason is sets both the product and the home page as the "current page" in the css
    so my active page in the nav is both home and products
    this also causes a problem because I am conditionally loading some js for the home slider I use and the condition is resulting to true and I am getting a js error
    thinking the custom short code may be the best approach

    thanks for the feedback

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.