Jump to content

Recommended Posts

Hello there,

 

I am trying to add a customization to my theme for wordpress.  I hope I have the right forum. 

 

I have my wordpress site here: http://activestatedesigns.com/flagsilhouettes/colorado/snowboarder03-coflag01 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 custom fields for each post titled: "buy_now1", "buy_now2", etc. Is it possible to add some PHP code to my single_body.php code to remove from the dropdown any "buy_now" urls that are not inserted into the custom fields for the post? (does that make sense)

 

Let me try to setup a scenario: Say for a specific shirt, I don't have American Apparel available. Well since American Apparel is tied to buy_now2 (specified in single_body.php). Is it possible to have code that says, if custom field "buy_now2" exists then show in dropdown or if custom field "buy_now2" doesn't exist, do not 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-->

 

Thanks,

Lorne

 

PS-I can also attach the entire PHP file if needed.  The above code is just a snippet of where I'm talking.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.