Hello there,
I have my site here: Snowboarder2 over Rocky Mountains Colorado Flag T-Shirt | ActiveState Designs and on the right hand side you’ll see a dropdown menu with the style of shirt available. That dropdown is being called in from customfields titled: “buy_now1”, “buy_now2”, etc. Is it possible to add some PHP code to my single_body.php code to basically not have a style in the dropdown if the custom field doesn’t exist for that posts?
Let me try to setup a scenario: Say for a style shirt, I don’t have American Apparel available. Well since American Apparel is tied to buy_now2. Is it possible to have code that says, if custom field buy_now2 exists then show in dropdown?
Hope that helps, I have my dropdown code here:
<span class="affili_prod"><?php _e('Select T-Shirt Style:','wpShop');?></span>
<form name="apparel">
<p align="center">
<select name="menu">
<option selected>Choose Apparel:</option>
<option value="<?php get_custom_field('buy_now1', TRUE); ?>">Standard</option>
<option value="<?php get_custom_field('buy_now2', TRUE); ?>">American Apparel | +$4</option>
<option value="<?php get_custom_field('buy_now3', TRUE); ?>">Standard Long-Sleeve | +$3</option>
<option value="<?php get_custom_field('buy_now4', TRUE); ?>">Women's T-Shirt</option>
<option value="<?php get_custom_field('buy_now5', TRUE); ?>">Kid's T-Shirt | -$1</option>
<option value="<?php get_custom_field('buy_now6', TRUE); ?>">Kid's Long-Sleeve | +$2</option>
</select>
<input class="buy_button" type="button" onClick="location=document.apparel.menu.options[document.apparel.menu.selectedIndex].value;">
</p>
</br>
</form>
<input type="hidden" id="amount" name="amount" value="<?php echo $value[0];?>"/>
<!--Disable BuyNow from template
<input type="hidden" name="buy_now" value="<?php get_custom_field('buy_now', TRUE); ?>" />
<!--end Disable BuyNow from template-->
<input type="hidden" name="currency_code" value="<?php echo $OPTION['wps_currency_code']; ?>" />
<?php
//has the user remembered to use the image_thumb custom field?
if(strlen(get_custom_field('image_thumb', FALSE))>0) { ?>
<input type="hidden" name="image_thumb" value="<?php get_custom_field('image_thumb', TRUE); ?>" />
<?php }
//he did!?
else {
// get attachment
$image_thumb = my_attachment_image(0, 'full', 'alt="' . $post->post_title . '"','return');
?>
<input type="hidden" name="image_thumb" value="<?php echo $image_thumb[img_path]; ?>" />
<?php } ?>
<input type="hidden" name="add" value="1" />
<!--Disable BuyNow from template
<div class="shopform_btn buy_now">
<a href="<?php get_custom_field('buy_now', TRUE); ?>" <?php if($OPTION['wps_affili_newTab']) { ?> title="<?php _e('Opens is new tab','wpShop'); ?>" target="_blank"<?php } ?>><?php _e('Buy Now','wpShop'); ?></a>
</div>
<!--end Disable BuyNow from template-->