예제 #1
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;
}
            ?>
									<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');
                ?>
/shop/checkout" class="button">GO TO CHECKOUT</a>
										</div>
										<input type="submit" value="<?php 
                _e('Add To Cart', 'wpsc');
                ?>
" name="Buy" class="wpsc_buy_button button" id="product_<?php 
      <?php 
        if (wpsc_product_has_stock()) {
            ?>

        <?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;
                ?>