Market Press Show products and Posts related by tags - Do Able?

Ok a new question for the masses :slight_smile:

I am running a sorta magazine style blog and integrated store.

I would like to have "related products" look at both products and posts to show products on the posts that people might find good for further reading..

Is is something I can do - does anyone know how, or tried it themselves.

I am using MarketPress with a theme called Hueman

Very curious!

Thanks

  • Vinod Dalvi

    Hi @Miz Cozma,

    I hope you are well today and thank you for your question.

    You can use the following MarketPress shortcode to display products related to the product being viewed.

    [mp_related_products] - Displays a products related to the one being viewed.
    Optional Attributes:
    "product_id" - The product to show related items for.
    "relate_by" - Whether to limit the related items to products in the same category, tags or both. Defaults to the value set in presentation settings..
    "limit" - How many related items to show. Defaults to the value set in presentation settings.
    "simple_list" - Whether to display the items as a simple list or based on the list/grid view setting. Defaults to the value set in presentation settings.
    Example: [mp_related_products product_id="12345" in_same_category="1" in_same_tags="1" limit="3" simple_list="0"]

    Kind Regards,
    Vinod Dalvi

  • Miz Cozma

    Hey there :slight_smile: Thanks for the quick response

    I do have the related products set up - but it seems to only work on products in the marketpress plugin. What I was hoping for is this...

    If we have a book in the store
    and a blog post reviewing the book
    or another post that talks about simular topics

    Can we have Related link all items together by tag.

    I did try similar to what you posted, I tweaked the shortcode just to try to match tags - I put it at the end of an article - hoping it would show the book that we have in our store - as related - but no luck
    This is what I tried

    [mp_related_products in_same_tags="1" limit="3" simple_list="0"]

    So any idea, am I missing info. The product (product page) and the article (post) have a few tags in common but no linkage.

    Thanks

  • Vinod Dalvi

    Hi @Miz Cozma,

    Thank you for your reply.

    The shortcode mp_related_products only works on the product page as itdisplays products related to the one being viewed and takes the current product id as a parameter for the shortcode, if you want to use it on non product page then you will have to explicitly pass the product id as parameter to the shortcode using product_id argument.

    Can we have Related link all items together by tag.

    The product uses tags using taxonomy called "product_tag" and the default posts uses tags as post_tag taxonomy. These two are different so it won't work as you are trying.

    You will have to develop custom code to achieve it.

    You can just change the code of mp_related_products function by overwriting it creating mu plugins. You will find this function in the following MarketPress plugin file.

    marketpress\marketpress-includes\template-functions.php

    Best Regards,
    Vinod Dalvi

  • Miz Cozma

    Interesting, I feel a challenge has been made :slight_smile:

    It will be my first ever plugin if I succeed! and if I do I will surely share as I can't be the only one who wanted to have this kind of relation between products and posts :slight_smile:

    Thanks for the feedback - I will let you know how it works out!

    I did respond to you in my other thread - if you can take a peek and get back to me on those matters that would be lovely.

    Thanks Vinod

    I will leave this post open a little bit in case someone out there already tried to do this and can show me the way :slight_smile:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.