Try <?php shopp('storefront','product', "id=" . $my_meta['price'] ); ?>
Change a static ID into a variable
Question
I hope someone can help me, I am sure this is simple but for the life of me I cannot get it right.
<?php shopp('storefront','product', 'id=36' ); ?>
I want to make the 'id=36' a variable which is called from a custom meta box. The function I am using to call the ID number is $my_meta['price']
So I ended up with something like this: <?php shopp('storefront','product', 'id=$my_meta['price']' ); ?>
Which doesn't work. When I insert this $my_meta['price']
into a post it displays the number successfully, so that is all working.
Can someone please help me figure this out?
Please and thanks.
Solution
OTHER TIPS
You need to use double quotes with curly braces if you want to expand variables within strings:
<?php shopp('storefront', 'product', "id={$my_meta['price']}"); ?>
If you wish to only use single quotes, you can append the variable to the string:
<?php shopp('storefront', 'product', 'id=' . $my_meta['price']); ?>