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

Getting error – Function integration in PHP

by

Tips and Tricks HQ Support Portal › Forums › WP eStore Forum › WP eStore Tweaks › Getting error – Function integration in PHP

Tagged: display product from meta data, php function, product from custom post field

  • This topic has 3 replies, 2 voices, and was last updated 12 years, 10 months ago by Libin V Babu.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • June 27, 2012 at 6:50 am #6684
    Libin V Babu
    Member

    Hi, I’m using “More Fields” plugin to get custom date from the post. So I want to include the product id entered by the admin in more fields textbox. I’m using the below function in my template file.

    <?php

    $product_id = meta(‘product-id’);

    echo show_wp_eStore_product_fancy($product_id,1,3);

    ?>

    When I echo the $product_id separately, It prints the correct product id entered in text box. But when used in the function, It shows ” Looks like you have entered a product ID in the shortcode that doesn’t exist. Please check your product ID and the shortcode again! ” If I replace the “$product_id” with value, say 1, It will outputs the correct product.

    How can I achieve this??

    June 27, 2012 at 11:32 pm #46515
    admin
    Keymaster

    I don’t know how that plugin is returning that product ID (the format is most likely not correct) but you don’t need another plugin to retrieve custom fields data of a post. You can use WordPress’s default function to do that. This post has examples that might help:

    https://support.tipsandtricks-hq.com/forums/topic/call-product-through-a-custom-field

    June 28, 2012 at 4:41 am #46516
    Libin V Babu
    Member

    Thank you so much. That was really helpful. Now it is working.

    I got the code to call the “add to cart” button from that topic.

    <?php echo get_button_code_for_product($product_id); ?>

    I wants to include the products details at different places in my template. So How can I display a product’s name, price, availability separately with the product_id?

    I tried to do this:

    $product_name = $wpdb->query($wpdb->prepare( "SELECT name FROM wp_wp_eStore_tbl WHERE id ='$product_id'"));

    echo $product_name;

    But it is not working.

    June 28, 2012 at 11:31 am #46517
    Libin V Babu
    Member

    Got it.

    $product_name = $wpdb->get_results( "SELECT * FROM wp_wp_eStore_tbl WHERE id ='$product_id'");

    foreach ($product_name as $row)

    {

    echo $row->name;

    }

    Its working fine. Hope the usage is correct.

  • 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