Displaying Single Product via Shortcode with Marketpress

Hi.
I'm testing out global shortcodes and would like to display a single product, not the entire list.
I've used this:
[mp_list_global_products category="global-test-category"] but it will pull all products in that category.

I want the actual product page with full description to display, so that the visitor does their research on the specific site and only gets redirected to the global store after they've hit the 'buy now' button.

Are there more shortcodes apart from what is displayed in the Network Store Settings?

thanks
Paul

  • DavidM

    Hi Paul,

    The shortcodes are all detailed in that section, but you can also check out the template-functions.php file for more ways to customize things.

    Also, MarketPress currently works by initiating the checkout on whichever site the user happens to be on when clicking the checkout option.

    If you'd like anything further clarified, just let me know, I'll be happy to help! :slight_smile:

    Cheers,
    David

  • raymondmannion

    Hi,
    Yeah, I was looking for a similar thing so that I could feature a couple of products at the top of my products page. Since it is a new installation, they aren't "popular" yet.

    I was looking for a shortcode with ID="1"
    [mp_list_products ID="1"] something like that - I'll check the functions to see if this is a parameter, otherwise, I might just make a category called "Featured" or something and use the category.

    If I wanted to enhance this shortcode, where would I put it so that it doesn't get overwritten when I upgrade Marketpress?

  • DavidM

    Thanks guys, for your input on this. There's not an update safe way of altering the shortcode functionality I'm afraid.

    However, what you can do is use the same template functions that the shortcodes use and create your own shortcodes. It's rather easy, you can simply include the shortcode snippter in your theme's functions.php file, and the following gives you all the info you need to get started with that.
    http://wp-snippets.com/216/add-shortcodes/

    That said, you actually can use the individual template functions to display various product elements. For example, the following function from line 1497 of template-functions.php lets you display the product image based on the $post_id you provide.
    function mp_product_image( $echo = true, $context = 'list', $post_id = NULL, $size = NULL ) {

    There are various functions in that file you can use to that same effect.

    Ultimately though, the category method (placing featured products in a category of their own) is probably the very best way of doing this. It's the method most used in themes that have a featured section.

    Cheers,
    David

  • littlemkv

    Hi David,

    I'm actually trying to get the same "featured" function so one product from each of my categories can be marked as "featured" and display on the homepage.

    I'm using the shortcode in my index.php file to achieve that:

    echo do_shortcode('[mp_list_global_products paginate="1" page="0" per_page="1" order_by="date" order="ASC" category="children" text="none" tag="featured" as_list="0" thumbnail_size="184"]');

    But it seems like the code cannot filter BOTH category and tag, it is now showing the most recent product from the category "children".

    And I also noticed that the shortcode cannot take multiple categories if I have "Featured" as another category.

    Do you have any solution on this issue? Any help would be appreciated!

    Thanks!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.