• squadjot

    (@squadjot)


    Hi, i’m relatively new to wp and wp ecommerce

    I have a question, i’d like to have a “check out” button in my header, but it should only be visible when basket is not empty!

    So the main question is, how to check if basket contains products? (litteraly, how to write it in php)

    THanks =D

Viewing 1 replies (of 1 total)
  • Thread Starter squadjot

    (@squadjot)

    Ok, found this:
    https://screamingcodemonkey.com/2011/01/how-to-make-a-simple-one-line-shopping-cart-widget/

    I think i can figure it out from there.

    Edit: i’ll post the script here, you never know ??

    <?php if(wpsc_cart_item_count() > 0): ?> 
    
    <div class="shoppingcart"> 
    
    <?php printf( _n('%d item', '%d items', wpsc_cart_item_count(), 'wpsc'), wpsc_cart_item_count() ); ?> 
    
    <?php _e('Total', 'wpsc'); ?>: <?php echo wpsc_cart_total_widget(); ?> 
    
    <a target="_parent" href="<?php echo get_option('shopping_cart_url'); ?>" title="Checkout" class="gocheckout"><?php _e('Checkout', 'wpsc'); ?></a> 
    
    <form action="" method="post" class="wpsc_empty_the_cart"> 
    
    <input type="hidden" name="wpsc_ajax_action" value="empty_cart" /> 
    
    <a target="_parent" href="<?php echo htmlentities(add_query_arg('wpsc_ajax_action', 'empty_cart', remove_query_arg('ajax')), ENT_QUOTES); ?>" class="emptycart" title="Empty Your Cart"><?php _e('Clear cart', 'wpsc'); ?></a> 
    
    </form> 
    
    </div><!--close shoppingcart--> 
    
    <?php else: ?> 
    
    <p class="empty"> 
    
    <?php _e('Your shopping cart is empty', 'wpsc'); ?><br /> 
    
    <a target="_parent" href="<?php echo get_option('product_list_url'); ?>" class="visitshop" title="Visit Shop"><?php _e('Visit the shop', 'wpsc'); ?></a> 
    
    </p> 
    
    <?php endif; ?> 
    
    <?php wpsc_google_checkout(); ?>
Viewing 1 replies (of 1 total)
  • The topic ‘[WP-Ecommerce] How to add basket link, only if productshas been chosen’ is closed to new replies.