Conditional Tags RSS feed for this section

wpsc_has_downloads

Located in: Located in: wpsc-user_log_functions.php
Version Introduced: 3.8
Return: Boolean

Description: This condition is used to check if the user has any downloadable purchases. You would most likely use this condition on the user “My Profile” page

[php]
<?php elseif ( is_wpsc_downloads_page() ) : ?>

<?php if ( wpsc_has_downloads() ) : ?>

<table class="logdisplay">
<tr>
<th><?php _e( ‘File Names’, ‘wpsc’ ); ?> </th>
<th><?php _e( ‘Downloads Left’, ‘wpsc’ ); ?> </th>
<th><?php _e( ‘Date’, ‘wpsc’ ); ?> </th>
</tr>

<?php
[/php]

Read Documentation ·

wpsc_has_purchases_this_month

Located in: Located in: wpsc-user_log_functions.php
Version Introduced: 3.8
Return: Boolean

Description: This condition is used to check if the user has made any purchases this month.

[php]
<?php if ( wpsc_has_purchases() ) : ?>

<table class="logdisplay">

<?php if ( wpsc_has_purchases_this_month() ) : ?>

<tr class="toprow">
<td><strong><?php _e( ‘Status’, ‘wpsc’ ); ?></strong></td>
<td><strong><?php _e( ‘Date’, ‘wpsc’ ); ?></strong></td>
<td><strong><?php _e( ‘Price’, ‘wpsc’ ); ?></strong></td>

<?php if ( get_option( ‘payment_method’ ) == 2 ) : ?>

<td><strong><?php _e( ‘Payment Method’, ‘wpsc’ ); ?></strong></td>

<?php endif; ?>

</tr>

<?php wpsc_user_details(); ?>

<?php else : ?>

[/php]

Read Documentation ·

wpsc_has_purchases

Located in: Located in: wpsc-user_log_functions.php
Version Introduced: 3.8
Return: Boolean

Description: This condition is used to check if the user has any purcahses – you would normally use this on the my account page.

[php]
<?php if ( wpsc_has_purchases() ) : ?>
//display the purcahses
<?php endif; ?>
[/php]

Read Documentation ·

is_wpsc_downloads_page

Located in: Located in: wpsc-user_log_functions.php
Version Introduced: 3.8
Return: Boolean

Description: This condition is used to check if the current page is the WP-e-Commerce download profile page.

Note: This is the check for downloads profile page you can use the condition: is_wpsc_profile_page to check if the user is on their profile page.

[php]
<!– START OF DOWNLOADS PAGE –>
<?php elseif ( is_wpsc_downloads_page() ) : ?>

<?php if ( wpsc_has_downloads() ) : ?>

[/php]

Read Documentation ·

is_wpsc_profile_page

Located in: Located in: wpsc-user_log_functions.php
Version Introduced: 3.8
Return: Boolean

Description: This condition is used to check if the current page is the WP-e-Commerce profile page.

Note: This is the check for the main profile page with the user details you can use the condition: is_wpsc_downloads_page to check if the user is on their downloads page.

[php]
<?php if ( is_wpsc_profile_page() ) : ?>

<form method="post">

<?php echo validate_form_data(); ?>

<table>

<?php wpsc_display_form_fields(); ?>
[/php]

Read Documentation ·

wpsc_is_checked_status

Located in: Located in: purchaselogs.class.php
Version Introduced: 3.8
Return: Boolean

Description: This condition is used to check if a purchase status is selected. It should be used within the purchase log loop.

[php]<?php while(wpsc_have_purch_items_statuses()) : wpsc_the_purch_status(); ?>[/php]

[php]
<?php while(wpsc_have_purch_items_statuses()) : wpsc_the_purch_status(); ?>
<option value='<?php echo wpsc_the_purch_status_id(); ?>’ <?php echo wpsc_is_checked_status(); ?> ><?php echo wpsc_the_purch_status_name(); ?> </option>
[/php]

Read Documentation ·

wpsc_has_purchlog_shipping

Located in: Located in: purcahselogs.class.php
Version Introduced: 3.8
Return: Boolean

Description: This condition is used to check if the purchase logs have shipping details. You would normally use this on the user “My account” page.

[php]
<?php if(wpsc_has_purchlog_shipping()) { ?>
<div id=’wpsc_shipping_details_box’>
<h3><?php _e(‘Shipping Address’,’wpsc’); ?></h3>
<p><strong><?php echo wpsc_display_purchlog_shipping_name(); ?></strong></p>
[/php]

Read Documentation ·

wpsc_has_tnc

Located in: Located in: checkout.class.php
Version Introduced: 3.8
Return: Boolean

Description: This condition is used to check if terms and conditions are not empty.

[php]
<?php if(wpsc_has_tnc()) : ?>
<tr>
<td colspan=’2′>
<label for="agree"><input id="agree" type=’checkbox’ value=’yes’ name=’agree’ /> <?php printf(__("I agree to the <a class=’thickbox’ target=’_blank’ href=’%s’ class=’termsandconds’>Terms and Conditions</a>", "wpsc"), site_url("?termsandconds=true&amp;width=360&amp;height=400")); ?> <span class="asterix">*</span></label>
</td>
</tr>
<?php endif; ?>
[/php]

Read Documentation ·

wpsc_has_noca_message

Located in: Located in: wpsc-deprecated.php
Version Introduced: 3.8
Return: Boolean

Description: This condition is used to determine if the noca gateway has a message.

Note: This function is now deprecated and should not be used.

Read Documentation ·

wpsc_has_category_and_country_conflict

Located in: Located in: checkout.class.php
Version Introduced: 3.8
Return: Boolean

Description: This condition is used to check whether the country and categories selected have conflicts
i.e products of this category cannot be shipped to selected country.

[php]
<?php if(wpsc_has_category_and_country_conflict()): ?>
<p class=’validation-error’><?php echo $_SESSION['categoryAndShippingCountryConflict']; ?></p>
<?php unset($_SESSION['categoryAndShippingCountryConflict']);
endif;
[/php]

Read Documentation ·

wpsc_has_regions

Located in: Located in: checkout.class.php
Version Introduced: 3.8
Return: Boolean

Description: This condition is used to check if a country has regions or not.

[php]
<?php if(wpsc_has_regions : ?>
echo "Please select a region";
<?php endif; ?>
[/php]

Read Documentation ·

wpsc_is_noca_gateway

Located in: Located in: wpsc-deprecated.php
Version Introduced: 3.8
Return: Boolean

Description: This condition is used to determine if the gateway name is noca.

Note: This function is now deprecated and should not be used.

Read Documentation ·

wpsc_is_shipping_details

Located in: Located in: checkout.class.php
Version Introduced: 3.8
Return: Boolean

Description: This condition is used to determine if the shipping details ahve been filled out. Normally you would used this to excute some code / display a message when the user selects the “shipping same as billing details checkbox”

[php]
<?php if(wpsc_is_shipping_details()):?>
echo "Your order will be shipped to your billing address";
<?php endif; ?>
[/php]

Read Documentation ·

wpsc_is_checkout

Located in: Located in: wpsc-functions.php
Version Introduced: 3.8
Return: Boolean – True if we have and use them, False otherwise

Description: This condition is used to check if the buyer is at the checkout

[php]
<?php if(wpsc_is_checkout()) : ?>

<?php endif; ?>
[/php]

Read Documentation ·

wpsc_show_thumbnails

Located in: Located in: product-template.php
Version Introduced: 3.8
Return: Boolean

Description: This condition is used to determine if the product thumbnails should be displayed.

Note: you should also use the following to check if that particular product has a thumbnail: <?php if(wpsc_the_product_thumbnail()) :

Code Example:
[php]
<?php if(wpsc_show_thumbnails()) :?>
<div class="imagecol" style="width:<?php echo $image_width; ?>;" id="imagecol_<?php echo wpsc_the_product_id(); ?>">

[/php]

Read Documentation ·

wpsc_have_custom_meta

Located in: Located in: product-template.php
Version Introduced: 3.8
Return: Boolean

Description: This condition is used to determine if the product has custom meta assigned to it.

Code Example:
[php]
<?php if (wpsc_have_custom_meta()) : ?>
<div class="custom_meta">
<?php while ( wpsc_have_custom_meta() ) : wpsc_the_custom_meta(); ?>
<?php if (stripos(wpsc_custom_meta_name(),’g:’) !== FALSE) continue; ?>
<strong><?php echo wpsc_custom_meta_name(); ?>: </strong><?php echo wpsc_custom_meta_value(); ?><br />
<?php endwhile; ?>
</div><!–close custom_meta–>
<?php endif; ?>

[/php]

Read Documentation ·

wpsc_product_has_supplied_file

Located in: Located in: product-template.php
Version Introduced: 3.8
Return: Boolean

Description: This condition is used to determine if the product can have a file uploaded to it.

[php]
<?php if ( wpsc_product_has_supplied_file() ) : ?>

<fieldset class="custom_file">
<legend><?php _e( ‘Upload a File’, ‘wpsc’ ); ?></legend>
<p><?php _e( ‘Select a file from your computer to include with this purchase.’, ‘wpsc’ ); ?></p>
<input type="file" name="custom_file" />
</fieldset>
<?php endif; ?>

[/php]

Read Documentation ·

wpsc_product_is_customisable

Located in: Located in: product-template.php
Version Introduced: 3.8
Return: Boolean

Description: This condition is used to determine if the product can be customized (image or message uploaded with the product)

[php]
<?php if( wpsc_product_is_customisable() ) : ?>
<input type="hidden" value="true" name="is_customisable"/>
<?php endif; ?>
[/php]

Read Documentation ·

wpsc_product_has_file

Located in: Located in: product-template.php
Version Introduced: 3.8
Return: Boolean

Description: This condition is used to determine if the product has a downloadable file.

Read Documentation ·

wpsc_product_on_special

Located in: Located in: product-template.php
Version Introduced: 3.8
Return: Boolean

Description: This condition is used to determine if the product is on special.

[php]
<?php if(wpsc_product_on_special()) : ?>
<p class="pricedisplay product_<?php echo wpsc_the_product_id(); ?>"><?php _e(‘Old Price’, ‘wpsc’); ?>: <span class="oldprice" id="old_product_price_<?php echo wpsc_the_product_id(); ?>"><?php echo wpsc_product_normal_price(); ?></span></p>
<?php endif; ?>
[/php]

Read Documentation ·

wpsc_product_is_donation

Located in: Located in: product-template.php
Version Introduced: 3.8
Return: Boolean

Description: This condition is used to determine if the product is a donation.

[php]
<?php if(wpsc_product_is_donation()) : ?>
<label for="donation_price_<?php echo wpsc_the_product_id(); ?>"><?php _e(‘Donation’, ‘wpsc’); ?>: </label>

[/php]

Read Documentation ·

wpsc_is_product_external

Located in: Located in: product-template.php
Version Introduced: 3.8
Return: Boolean

Description: This condition is used to check if the product has an external link (this is set under the advanced product settings)

[php]
if ( wpsc_is_product_external() ) :
$action = wpsc_product_external_link( $product_id );
<?php else: ?>
[/php]

Read Documentation ·

wpsc_product_has_stock

Located in: Located in: product-template.php
Version Introduced: 3.8
Return: Boolean

Description: This condition is used to check if stock is available for the given product (stock quantities can be set on the add / edit product).

[php]
<?php if(wpsc_product_has_stock()) : ?>
<div id="stock_display_<?php echo wpsc_the_product_id(); ?>" class="in_stock"><?php _e(‘Product in stock’, ‘wpsc’); ?></div>
<?php else: ?>
[/php]

Read Documentation ·

wpsc_show_fb_like

Located in: Located in: product-template.php
Version Introduced: 3.8
Return: Boolean

Description: This condition is used to check if the face-book live button should be shown.

[php]
if(wpsc_show_fb_like()): ?>
<div class="FB_like">
<iframe src="https://www.facebook.com/plugins/like.php?href=<?php echo wpsc_the_product_permalink(); ?>&amp;layout=standard&amp;show_faces=true&amp;width=435&amp;action=like&amp;font=arial&amp;colorscheme=light" frameborder="0"></iframe>
</div><!–close FB_like–>
[/php]

Read Documentation ·

wpsc_is_single_product

Located in: Located in: product-template.php
Version Introduced: 3.8
Return: Boolean – True /False

Description: This condition is used to check if we are on a single product page.

[php]
<?php if(wpsc_is_single_product()) : ?>
//single product code in here
<?php endif; ?>
[/php]

Read Documentation ·

wpsc_is_product

Located in: Located in: wpsc-functions.php
Version Introduced: 3.8
Return: False if not a product, $wp_query->is_product will be set if true

Description: This condition is used to check if your viewing a product

[php]
<?php if(wpsc_is_product()) : ?>
//product code in here
<?php endif; ?>
[/php]

Read Documentation ·

wpsc_has_breadcrumbs

Located in: Located in: breadcrumbs.class.php
Version Introduced: 3.8
Return: Boolean – True if we have and use them, False otherwise

Description: This condition is used to check if breadcrumbs are turned on and present.

Note: If your using the wpsc_output_breadcrumbs(); template tag then this check is already done for you.

[php]
<?php if(wpsc_has_breadcrumbs()) : ?>
//breadcrumbs stuff in here
<?php endif; ?>
[/php]

Read Documentation ·

wpsc_is_in_category

Located in: Located in: category.functions.php
Version Introduced: 3.8
Return: True / False

Description: This condition is used to check if your viewing a product category page.

[php]
<?php if(wpsc_is_in_category()) : ?>
<div class="wpsc_category_details">
<?php if(get_option(‘show_category_thumbnails’) && wpsc_category_image()) : ?>
<img src='<?php echo wpsc_category_image(); ?>’ alt='<?php echo wpsc_category_name(); ?>’ title='<?php echo wpsc_category_name(); ?>’ />
<?php endif; ?>
[/php]

Read Documentation ·

wpsc_is_viewable_taxonomy

Located in: Located in: theme.functions.php
Version Introduced: 3.8
Return: True / False

Description: This condition is used to check if your looking at a viewable taxonomy – eg a product category page.

[php]
<?php if(wpsc_is_viewable_taxonomy()) : ?>
//do taxonomy code here
<?php endif; ?>
[/php]

Read Documentation ·

wpsc_has_multi_adding

Located in: Located in: product-template.php
Version Introduced: 3.8
Return: True / False

Description: This condition is used with the template tag is used to check if the user has turned on the product quantity setting. It is normally used on the product pages to display the quanity input boxes.

[php]
<?php if(wpsc_has_multi_adding()): ?>
<fieldset><legend><?php _e(‘Quantity’, ‘wpsc’); ?></legend>
<div class="wpsc_quantity_update">
<?php /*<label for="wpsc_quantity_update_<?php echo wpsc_the_product_id(); ?>"><?php _e(‘Quantity’, ‘wpsc’); ?>:</label>*/ ?>
<input type="text" id="wpsc_quantity_update_<?php echo wpsc_the_product_id(); ?>" name="wpsc_quantity_update" size="2" value="1" />
<input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>"/>
<input type="hidden" name="wpsc_update_quantity" value="true" />
</div><!–close wpsc_quantity_update–>
</fieldset>
<?php endif ;?>
[/php]

Read Documentation ·

wpsc_has_pages

Located in: Located in: product-template.php
Version Introduced: 3.8
Return: Boolean true if we have pages false if we dont

Description: This condition is used to check if you have more than one page to display.

NOTE: This condition is used within the wpsc_has_pages_top and wpsc_has_pages_bottom condition so if you using these condidtions the check has already been done for you.

Code example:
[php]
if ( wpsc_has_pages ){
//show some pagination or something
}
[/php]

Read Documentation ·

wpsc_has_pages_bottom

Located in: Located in: product-template.php
Version Introduced: 3.8
Return: True / False

Description: This condition is used with the template tag

  

it will check to see if the user has set their pagination settings (under store settings > presentation) to display the pagination on bottom of the page.

[php]
<?php if(wpsc_has_pages_bottom()) : ?>
<div class="wpsc_page_numbers_bottom">
<?php wpsc_pagination(); ?>
</div><!–close wpsc_page_numbers_bottom–>
[/php]

Read Documentation ·

wpsc_has_pages_top

Located in: Located in: product-template.php
Version Introduced: 3.8
Return: True / False

Description: This condition is used with the template tag wpsc_pagination(); it will check to see if the user has set their pagination settings (under store settings > presentation) to display the pagination on top of the page.

[php]
<?php if(wpsc_has_pages_top()) : ?>
<div class="wpsc_page_numbers_top">
<?php wpsc_pagination(); ?>
</div><!–close wpsc_page_numbers_top–>
<?php endif; ?>
[/php]

Read Documentation ·

wpsc_core_is_multisite

Located in: Located in: wpsc-constants.php
Version Introduced: 3.8
Return: BOL 1 = multi site 0 = not multi site

Description: This condition will check if the current install of WP-e-Commerce is on a multi site.

[php]
<?php
if (wpsc_core_is_multisite){
//multi site code in here
}else{
// not multi site code in here
}
[/php]

Read Documentation ·

WPEC Conditional Tags – Complete list

Introduction

The Conditional Tags can be used in your Template files to change what content is displayed and how that content is displayed on a particular page depending on what conditions that page matches. For example, you might want to display a snippet of text above the series of posts, but only on the main page of your blog. With the is_home Conditional Tag, that task is made easy.

The Conditions For …

Generic

  • wpsc_page_is_selected – returns if on a WP e-Commerce Page
  • wpsc_core_is_multisite
  • wpsc_has_pages_top
  • wpsc_has_pages_bottom
  • wpsc_has_pages
  • wpsc_has_multi_adding

Products Page

  • wpsc_is_viewable_taxonomy
  • wpsc_is_in_category
  • wpsc_has_breadcrumbs

Single Product

  • wpsc_is_product
  • wpsc_is_single_product – determines if you’re viewing a Product page
  • wpsc_show_fb_like – checks whether to display Facebook Like
  • wpsc_product_has_stock – determines if stock is available for the given Product
  • wpsc_is_product_external – determines if the Product has an external link
  • wpsc_product_is_donation – determines if the Product is a donation
  • wpsc_product_on_special – determines if the Product is on special
  • wpsc_product_has_file – determines if the Product has a downloadable file
  • wpsc_product_is_customisable – determines if the Product can be customised (uploaded image)
  • wpsc_product_has_personal_text – determines if the Product can accept customised text
  • wpsc_product_has_supplied_file – …
  • wpsc_have_custom_meta – determines if the current Product has custom meta assigned
  • wpsc_show_thumbnails – determines whether to display Product thumbnails

Checkout

  • wpsc_is_checkout
  • wpsc_is_shipping_details
  • wpsc_is_noca_gateway – Depricated
  • wpsc_has_regions
  • wpsc_has_category_and_country_conflict
  • wpsc_has_noca_message – Depricated
  • wpsc_has_tnc
  • wpsc_has_purchlog_shipping

Sales

  • wpsc_is_checked_status

User Account

  • is_wpsc_profile_page
  • is_wpsc_downloads_page
  • wpsc_has_purchases
  • wpsc_has_purchases_this_month
  • wpsc_has_downloads
Read Documentation ·
KIWI