Market Press Template Hierarchy

If I understand the "Theming MarketPress" text file correctly the functions.php I create will just add to or over-ride the functionality to the base marketpress functions. Is that correct or do I have to copy them into each of my templates. In Addition I will need the following pages to complete the theme:

Single Product Page
mp_product-PRODUCTNAME.php
mp_product-PRODUCTID.php
mp_product.php
single-PRODUCT_POST_TYPE.php (post type may be "product" or "mp_product" depending on your site's settings) - WHAT SETTING WOULD EFFECT THIS?

Store Page
mp_store.php

Cart/Checkout Page
mp_checkout.php
mp_cart.php

Order Status Page
mp_orderstatus.php

Product List Page
mp_productlist.php

Product Category List Page
mp_category-CATEGORYSLUG.php
mp_category-CATEGORYID.php
mp_category.php
mp_taxonomy.php
taxonomy-product_category-CATEGORYSLUG.php
taxonomy-product_category.php
mp_productlist.php
taxonomy.php

Product Tag List Page
mp_tag-TAGSLUG.php
mp_tag-TAGID.php
mp_tag.php
mp_taxonomy.php
taxonomy-product_tag-TAGSLUG.php
taxonomy-product_tag.php
mp_productlist.php
taxonomy.php

Are there base pages in Market Press to refer to for these?

I will be documenting this in my git repo to use over and over so if you could please help me there I would appreciate it. Or perhaps someone already has?

Once I get all this down I will be a lean mean template making machine for marketpress.

Thanks Very Much,

Bradley

  • Luís

    Hi Bradley ,

    Hope you're doing well today!

    If I understand the "Theming MarketPress" text file correctly the functions.php I create will just add to or over-ride the functionality to the base marketpress functions. Is that correct or do I have to copy them into each of my templates. In Addition I will need the following pages to complete the theme:

    Some things in MarketPress can be overridden via theme functions.php or mu-plugin, however, if you are changing the default HTML markup, you need to create the page templates and add the functions to those page templates, like "mp_product_price" or "mp_buy_button".

    MarketPress searches your current theme folder for template files specific to store pages. If they don't exist, it will use the default theme templates. So, you just need to create the specific page templates (like "mp_product.php") that you want to override.

    We have a tutorial in your blog about Theming MarketPress, that I think it may interest you:

    https://premium.wpmudev.org/blog/the-easy-guide-to-theming-marketpress/

    However, some functions were changed and you will need to check the "wp-content/plugins/marketpress/includes/common/template-functions.php". If you are having doubts/difficulties in this proccess, you can always use our Support Forum and we will always try to help you in this proccess.

    Cheers, Luís

  • Bradley

    That was very very helpful. It's a start. To give you an example of what I am trying to do with a loop to format the data in a mp_product entry into a card which google is so in love with. In this example this would be a card found on the store page.

    In my current stage of the building process the image is hard coded and I need to pull and format it out of the database. In this example I would need to get the image out for the card image section, the "category and title" would be the the category name and the title would be the product name or vide versa. I need to insert there, and finally the excerpt from the product would go into the description. Ah and the price. So that's five loop statements in five divs for each card?

    With those five things in the order they appear here and each in it's appropriate div I won't have to monkey with shortcodes (something I am working with in another ticket) and be 75% done with the template. hmmm. As I look at it it would also have to be conditional on something like a tag to know that that product card is to be displayed in this section. I can then reuse the query in multiple sections and even on an all products page anywhere in the theme really. I am just not getting the format of the query as outlined in that article.

    I actually want to see all products in a card everywhere they are displayed.

    <!--First column-->
    <div class="col-lg-4 col-md-6 mb-r wow fadeIn" data-wow-delay="0.2s">
    <!--Card-->
    <div class="card card-cascade wider">
    <!--Card image-->
    <div class="view overlay hm-white-slight">
    <img src= "img/vertical/img20(9).jpg" class="img-fluid" alt="it broke">

    <div class="mask"></div>

    </div>
    <!--/.Card image-->
    <!--Card content-->
    <div class="card-block text-xs-center">
    <!--Category & Title-->
    <h5>Shorts</h5>
    <h4 class="card-title">Denim light shorts</h4>
    <!--Rating-->
    <ul class="rating">

  • <i class="fa fa-star"></i>
  • <i class="fa fa-star"></i>
  • <i class="fa fa-star"></i>
  • <i class="fa fa-star"></i>
  • <i class="fa fa-star-o"></i>
  • <!--Description-->
    <p class="card-text">Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe voluptates.
    </p>
    <!--Card footer-->
    <div class="card-footer">
    <span class="left">49$</span>
    <span class="right"> <i class="fa fa-shopping-cart"></i> <i class="fa fa-share-alt"></i> <i class="fa fa-heart"></i> </span>
    </div>
    </div>
    <!--/.Card content-->
    </div>
    <!--/.Card-->
    </div>
    <!--/First column-->

    It's the syntax of the query that has me at this point I can layout a bootstrap grid and create classes now pretty easily. It's this one thing. AT least it's this one thing at this moment the next will be the buy button. I already have one in that card. I need the function call for that.
    So ok it's just these TWO things I need :wink:

    This is the most complex wp thing i have yet to do to date it's easy to see that. It sure looks slick though.

    Bradley

    P.S. I didn't invent this it's all over the internet and I have a copy of the whole page as it is now in html in my git repo if your interested.

  • Bradley

    Oh good you are the one who answered originally brought this up

    Reply by: Luís

    Hi Bradley ,
    Hope you're doing well today!
    I checked the folder structure in the new version of MarketPress (3.1.2) and the "template-functions.php" file should be found inside the "wp-content/plugins/marketpress/includes/common" folder.
    I already flagged the developer so they can get it fixed up asap. Either myself or the developer will reply back here once we have pushed a fix out.
    Cheers, Luís

    I am getting my engineers mixed up as I asked alot of questions today. I was making sure two people over there weren't answering the same thing if I could.

    If you can help me with this thing I wrote out I'll give you all my rep points or whatever if it will get you a raise. I'll go back to being a "child of a know nothing" status or whatever you start out as here. I'll never get three months free anyways. :slight_smile:

  • Luís

    Hi Bradley ,

    Hope you're doing well today!

    If I understood well your question, you will need to add the MarketPress functions in the div's. These are the most commom functions to be used. They need to be inside the default "post" loop from WordPress:

    while ( have_posts() ) : the_post();

    Product title

    mp_product_title($product_id);

    Product excerpt

    the_excerpt();

    Product price

    mp_product_price(true);

    Buy Button

    mp_buy_button(true, 'single');

    Product Category

    echo mp_category_list($post->ID);

    Product Image

    From what I tested in my install, to get the product image we will need to add some extra code. So, firstly, we will need to add this code before the post loop:

    $align = null;
    if ( 'list' == mp_get_setting( 'list_view' ) ) {
    	$align = mp_get_setting( 'image_alignment_list' );
    }
    $img = $product->image( false, 'list', null, $align, true );

    Then, inside the loop, you just need to call the "$img" inside the div where you want to display the image:

    echo $img;

    I hope this information has been helpful. If I can help you in this or other questions, please let me know!

    Cheers, Luís

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.