- This topic has 3 replies, 2 voices, and was last updated 13 years, 2 months ago by .
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.
Support site for Tips and Tricks HQ premium products
by
Tips and Tricks HQ Support Portal › Forums › WP eStore Forum › Displaying 'Add to Cart' button on product list page
Tagged: add to cart button
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!
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.
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.
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.