Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * generate the HTML always, just hide it if cart count is 0
- * then it will display when the page refreshes, and also you can
- * activate it easily from JavaScript
- * NB: replace "some-handle" with an ID that is meaningful to you!
- */
- ?>
- <span id="some-handle" style="<?php if (wpsc_cart_item_count() > 0) echo 'display:none;'; ?>">
- <a target="_parent" href="<?php echo get_option('shopping_cart_url'); ?>" title="<?php _e('Checkout', 'wpsc'); ?>" class="gocheckout_dyn"><?php _e('Checkout →', 'wpsc'); ?></a>
- </span>
- <?php
- /**
- * action hook for wp-e-commerce to provide our own AJAX cart updates
- * EDIT: place this code into your functions.php, not your template file
- */
- function theme_cart_update() {
- $cart_count = wpsc_cart_item_count();
- if ($cart_count > 0)
- echo "jQuery('#some-handle').fadeIn();\n";
- }
- add_action('wpsc_alternate_cart_html', 'theme_cart_update');
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement