Advertisement
AnnaMargaretha

auto update shopping cart (WPSC)

May 14th, 2013
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.53 KB | None | 0 0
  1. <!--IN HEADER.PHP-->
  2.  
  3. <span id="count"><?php if (function_exists('wpsc_cart_item_count')) { echo wpsc_cart_item_count(''); ?></span> items | <span id="total"><?php echo wpsc_cart_total_widget(); } ?></span>
  4.  
  5.  
  6. <!--IN FUNCTIONS.PHP-->
  7. <?
  8. /**
  9. * action hook for wp-e-commerce to provide our own AJAX cart updates
  10. */
  11. function theme_cart_update() {
  12.     $cart_count = wpsc_cart_item_count();
  13.     $total = wpsc_cart_total_widget();
  14.     echo <<<HTML
  15. jQuery("#count").html("$cart_count");
  16. jQuery("#total").html("$total");
  17.  
  18. HTML;
  19. }
  20. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement