<?php 
    if (get_option('hide_addtocart_button') == 0 && get_option('addtocart_or_buynow') != '1') {
        ?>
								<?php 
        if (wpsc_product_has_stock()) {
            ?>
									<div class="wpsc_buy_button_container">
											<?php 
            if (wpsc_product_external_link(wpsc_the_product_id()) != '') {
                ?>
											<?php 
                $action = wpsc_product_external_link(wpsc_the_product_id());
                ?>
											<input class="wpsc_buy_button" type="submit" value="<?php 
                echo wpsc_product_external_link_text(wpsc_the_product_id(), __('Buy Now', 'wpsc'));
                ?>
" onclick="return gotoexternallink('<?php 
                echo esc_url($action);
                ?>
', '<?php 
                echo wpsc_product_external_link_target(wpsc_the_product_id());
                ?>
')">
											<?php 
            } else {
                ?>
										<div class="goto-checkout">
											<a href="<?php 
                bloginfo('home');
                ?>
        <?php 
            if (wpsc_product_external_link($product_id) != '') {
                ?>
          <?php 
                $action = wpsc_product_external_link($product_id);
                ?>
          <button class="button big active"
                  onclick="return gotoexternallink('<?php 
                echo $action;
                ?>
', '<?php 
                echo wpsc_product_external_link_target($product_id);
                ?>
')">
            <span><?php 
                echo wpsc_product_external_link_text($product_id, __('Buy Now', ETHEME_DOMAIN));
                ?>
</span>
          </button>
        <?php 
            } else {
                ?>
        
          <button type="submit" name="Buy" class="button big active wpsc_buy_button"
                  id="product_<?php 
                echo $product_id;
                ?>
_submit_button">
            <span><?php 
                _e('Add To Cart', ETHEME_DOMAIN);
                ?>
Example #3
0
function external_link($product_id)
{
    $link = get_product_meta($product_id, 'external_link', true);
    if (!stristr($link, 'http://')) {
        $link = 'http://' . $link;
    }
    $target = wpsc_product_external_link_target($product_id);
    $output .= "<input class='wpsc_buy_button' type='button' value='" . wpsc_product_external_link_text($product_id, __('Buy Now', 'wpsc')) . "' onclick='return gotoexternallink(\"{$link}\", \"{$target}\")'>";
    return $output;
}
	
							<?php 
        if (get_option('hide_addtocart_button') == 0 && get_option('addtocart_or_buynow') != '1') {
            ?>
								<?php 
            if (wpsc_product_has_stock()) {
                ?>
									<div class="wpsc_buy_button_container">
											<?php 
                if (wpsc_product_external_link(wpsc_the_product_id()) != '') {
                    ?>
											<?php 
                    $action = wpsc_product_external_link(wpsc_the_product_id());
                    ?>
											<input class="wpsc_buy_button" type="button" value="<?php 
                    echo wpsc_product_external_link_text(wpsc_the_product_id(), __('Buy Now', ETHEME_DOMAIN));
                    ?>
" onclick="return gotoexternallink('<?php 
                    echo $action;
                    ?>
', '<?php 
                    echo wpsc_product_external_link_target(wpsc_the_product_id());
                    ?>
')">
											<?php 
                } else {
                    ?>
										<input type="submit" value="<?php 
                    _e('Add To Cart', ETHEME_DOMAIN);
                    ?>
" name="Buy" class="wpsc_buy_button" id="product_<?php