Skip to content

Instantly share code, notes, and snippets.

@Abban
Created June 19, 2013 18:19
Show Gist options
  • Save Abban/5816572 to your computer and use it in GitHub Desktop.
Save Abban/5816572 to your computer and use it in GitHub Desktop.
<?php if(function_exists('abandon_cart_button')) abandon_cart_button('<div id="cart_button">', '</div>'); ?>
<?php
/**
* abandon_cart_button
*
* Prints a Jigoshop cart button
*
* @param string $prefix
* @param string $suffix
*
*/
if(!function_exists('abandon_cart_button') && class_exists('jigoshop_cart')){
function abandon_cart_button($prefix = '', $suffix = ''){
$cart_contents = jigoshop_cart::$cart_contents;
$output = $prefix;
if(!empty($cart_contents)){
$cart_contents_count = jigoshop_cart::$cart_contents_count;
$output .= $cart_contents_count;
$output .= ($cart_contents_count == 1) ? ' Item - ' : ' Items - ';
$output .= jigoshop_cart::get_cart_total();
$output .= ' <a class="button" href="' .jigoshop_cart::get_cart_url() .'">View Cart</a>';
}else{
$output .= 'No Items';
}
$output .= $suffix;
echo $output;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment