function jigoshop_checkout( $atts ) { if (!defined('JIGOSHOP_CHECKOUT')) define('JIGOSHOP_CHECKOUT', true); if (sizeof(jigoshop_cart::$cart_contents)==0) : wp_redirect(get_permalink(get_option('jigoshop_cart_page_id'))); exit; endif; $non_js_checkout = (isset($_POST['update_totals']) && $_POST['update_totals']) ? true : false; $_checkout = jigoshop_checkout::instance(); $_checkout->process_checkout(); $result = jigoshop_cart::check_cart_item_stock(); if (is_wp_error($result)) jigoshop::add_error( $result->get_error_message() ); if ( jigoshop::error_count()==0 && $non_js_checkout) jigoshop::add_message( __('The order totals have been updated. Please confirm your order by pressing the Place Order button at the bottom of the page.', 'jigoshop') ); jigoshop::show_messages(); jigoshop_get_template('checkout/form.php', false); }
public static function instance () { if(!self::$instance) { $class = __CLASS__; self::$instance = new $class; } return self::$instance; }
function jigoshop_process_checkout() { if (!is_checkout() || is_jigoshop_single_page(JIGOSHOP_PAY)) { return; } if (count(jigoshop_cart::get_cart()) == 0) { wp_safe_redirect(get_permalink(jigoshop_get_page_id('cart'))); exit; } /** @var jigoshop_checkout $_checkout */ $_checkout = jigoshop_checkout::instance(); $result = $_checkout->process_checkout(); if (isset($result['result']) && $result['result'] === 'success') { wp_safe_redirect(apply_filters('jigoshop_is_ajax_payment_successful', $result['redirect'])); exit; } if (isset($result['redirect'])) { wp_safe_redirect(get_permalink($result['redirect'])); exit; } }
function jigoshop_process_checkout () { include_once jigoshop::plugin_path() . '/classes/jigoshop_checkout.class.php'; jigoshop_checkout::instance()->process_checkout(); die(0); }
function jigoshop_process_ajax_checkout() { include_once JIGOSHOP_DIR . '/classes/jigoshop_checkout.class.php'; /** @var jigoshop_checkout $checkout */ $checkout = jigoshop_checkout::instance(); $result = $checkout->process_checkout(); if ($result === false) { jigoshop::show_messages(); exit; } if (isset($result['result']) && $result['result'] == 'redirect') { echo json_encode(array('result' => 'success', 'redirect' => get_permalink($result['redirect']))); exit; } echo json_encode(apply_filters('jigoshop_is_ajax_payment_successful', $result)); exit; }