Tips and Tricks HQ Forum

Support Forum for Tips and Tricks HQ Products

Register or log in - lost password? (Having an issue with the forum login?)

Search the Forum

Tips and Tricks HQ Forum » WP eStore Forum

Displaying 'Add to Cart' button on product list page

(4 posts) (2 voices)
  • Started 8 months ago by dangermoose
  • Latest reply from admin
  • Possible Solutions (Related Topics):
    1. Sales page "add to cart button" should add the product and open the eStore page
    2. How to align "Add to Cart" button on Products page
    3. Add to Cart Button with Wishlist SKU code
    4. Use 'Add to cart' button from 'Stylish Product Display 10' in other styles?
    5. Product page URL not linking from Cart

Tags:

  • add to cart button
  1. dangermoose
    Member

    Hi there,
    You helped me out before with a similar problem I was having and for some reason even though I've set this site up in the same way, I can't get the add the cart buttons to display on the page that lists all products. (It displays fine in the individual product page)

    Currently getting the error 'Looks like you have entered a product ID () in the shortcode that doesn't exist. Please check your product ID and the shortcode again!'

    The code in my template:

    <div id="productId">
    <p>
    <?php
    $values = get_post_custom_values('product_id');
    echo get_button_code_for_product($values[0]);
    ?>
    </p>
    </div>

    The shortcode in the page:
    [wp_eStore:product_id:1:end]

    I might be missing something obvious!

    Posted 8 months ago #
  2. admin
    Key Master

    Well it's simple, when you call this function you need to make sure you are providing a valid Product ID:

    get_button_code_for_product

    On this page (where you are having the issue)... the custom field value is wrong (it needs to be a valid product ID. WP eStore can't display a button for a product if it doesn't know which product to look for.

    Posted 8 months ago #
  3. dangermoose
    Member

    Hi there,

    I've checked the custom field value & it's definately correct, but still no luck. I've only got one product for testing at the minute so the value is simply '1'.

    I think it might have something to do with the fact that the shortcodes are placed in pages and not posts - do you think this is possible and might cause issues.

    get_post_custom_values

    I'm guesssing this is designed to pull values from posts - not pages?

    Thanks in advance!
    d.

    Posted 8 months ago #
  4. admin
    Key Master

    There is an easy way to test it out. Simply echo the value of the customer field that your are retrieving by doing the following:

    <?php
    $values = get_post_custom_values('product_id');
    echo "Custom field value: ".$values[0];
    echo get_button_code_for_product($values[0]);
    ?>

    This will tell you if you are really passing "1" to the eStore function or something else. I can guarantee you that eStore is not receiving a plain "1" there.

    Posted 8 months ago #

RSS feed for this topic

Reply

You must log in to post.

Tips and Tricks HQ  | WP Shopping Cart  | WP Affiliate Software  | WordPress Membership Plugin