Tips and Tricks HQ Support

Support site for Tips and Tricks HQ premium products

  • Home
  • Contact Us
  • Documentation
  • Forum Home
    • Forum
    • Forum Search
    • Forum Login
    • Forum Registration

estore- custom product display grouped by category

by

Tips and Tricks HQ Support Portal › Forums › WP eStore Forum › WP eStore Tweaks › estore- custom product display grouped by category

Tagged: custom display, custom product display, product category, Product Display

  • This topic has 3 replies, 2 voices, and was last updated 10 years ago by admin.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • May 2, 2015 at 7:24 pm #12584
    kayjayone
    Member

    Trying to do a custom product display using the following…

    [wp_eStore_product_details id=1 info=”name”]

    [wp_eStore_product_details id=1 info=”description”]

    [wp_eStore_product_details id=1 info=”price”]

    [wp_eStore_product_details id=1 info=”available_copies”]

    [wp_eStore_add_to_cart id=1]

    Because we only want the cart button to show if the user is logged in. We would like to group the products by category for listing, how might this be possible?

    Output would be…

    Category1 Name

    Product1- image, name, description, price and add to cart button if user is logged in

    Product2- same

    Category2 Name

    etc.

    Thank you for your help.

    May 3, 2015 at 12:12 am #69853
    admin
    Keymaster

    Which part are you having trouble with? You should be able to enter your category name on the page then below it, put the shortcode for all the products.

    If you have a lot of products, it is best to use the “show all products from a category” shortcode. See the shortcode guide for explanation on that shortcode:

    https://www.tipsandtricks-hq.com/ecommerce/wp-estore-shortcodes-and-functions-reference-460

    May 3, 2015 at 12:46 am #69854
    kayjayone
    Member

    Thank you for your quick reply! I’m unable to use the show all products from a category shortcode, although that is what I want to display, because created a custom product display to format the output further and display the add to cart button conditionally for this implementation (code below). I’d like to put a loop around the code below to loop through all categories and display all products in each category. Thank you for your help!

    --loop all categories--

    <h2>Category Name</h2>

    --loop all products within category--

    <div class="prodbox">

    <div class="prodimg"><img src="<?php echo do_shortcode('[wp_eStore_product_details id=41 info="thumbnail_url"]')?>" alt="Tomato Empire" /></div>

    <h3><?php echo do_shortcode('[wp_eStore_product_details id=41 info="name"]')?></h3>

    <div class="prodinfo">

    <div class="proddesc"><?php echo do_shortcode('[wp_eStore_product_details id=41 info="description"]')?></div>

    <div class="prodavail">Available Quantity: <?php echo do_shortcode('[wp_eStore_product_details id=41 info="available_copies"]')?> Pounds</div>

    <div class="largetext">Price per Pound: $<?php echo do_shortcode('[wp_eStore_product_details id=41 info="price"]')?></div>

    <?php if (wp_emember_is_member_logged_in()) { echo do_shortcode('[wp_eStore_add_to_cart id=41]'); }?>

    </div><!--prodinfo-->

    </div><!--prodbox-->

    --end loops--

    May 4, 2015 at 1:50 am #69855
    admin
    Keymaster

    Here is an example loop code:

    global $wpdb;
    $cat_table_name = WP_ESTORE_CATEGORY_TABLE_NAME;
    $cat_prod_rel_table_name = WP_ESTORE_CATEGORY_RELATIONS_TABLE_NAME;
    $products_table_name = WP_ESTORE_PRODUCTS_TABLE_NAME;

    $resultset = $wpdb->get_results("SELECT * FROM $cat_table_name ORDER BY cat_id ASC", OBJECT);
    foreach ($resultset as $row)
    {
    $cat_id = $row->cat_id
    $category_products = $wpdb->get_results("SELECT * FROM $cat_prod_rel_table_name where cat_id=$cat_id ORDER BY prod_id ASC", OBJECT);
    foreach ($category_products as $item_row)
    {
    $prod_id = $item_row->prod_id;
    //TODO - Show this product's info
    }
    }

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Log In

Forum Related

  • Forum Home
  • Forum Search
  • Forum Registration
  • Forum Login

Support Related Forms

  • Contact Us
  • Customer Support
  • Request a Plugin Update
  • Request Fresh Download Links

Useful Links

  • Plugin Upgrade Instructions
  • WP eStore Documentation
  • WP eMember Documentation
  • WP Affiliate Platform Documentation
  • Tips and Tricks HQ Home Page
  • Our Projects

Quick Setup Video Tutorials

  • WP eStore Video Tutorial
  • WP eMember Video Tutorial
  • WP Affiliate Platform Video Tutorial
  • Lightbox Ultimate Video Tutorial

Our Other Plugins

  • WP Express Checkout
  • Stripe Payments Plugin
  • Simple Shopping Cart Plugin
  • Simple Download Monitor

Copyright © 2025 | Tips and Tricks HQ