Example #1
0
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;
	}
Example #3
0
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;
    }
}
Example #4
0
        }
    }
    ?>
<tr>
                    <td colspan="2"><?php 
    _e('Subtotal', 'jigoshop');
    ?>
</td>
                    <td><?php 
    echo jigoshop_cart::get_subtotal_inc_tax();
    ?>
</td>
                </tr>
                <?php 
} else {
    jigoshop_checkout::get_shipping_dropdown();
}
if (get_option('jigoshop_calc_taxes') == 'yes') {
    if (jigoshop_cart::get_subtotal_inc_tax()) {
        foreach (jigoshop_cart::get_applied_tax_classes() as $tax_class) {
            if (!jigoshop_cart::is_not_compounded_tax($tax_class)) {
                ?>

                            <tr>
                                <td colspan="2"><?php 
                echo jigoshop_cart::get_tax_for_display($tax_class);
                ?>
</th>
                                <td><?php 
                echo jigoshop_cart::get_tax_amount($tax_class);
                ?>
Example #5
0
	<ul class="payment_methods methods">
		<?php 
$available_gateways = jigoshop_payment_gateways::get_available_payment_gateways();
if ($available_gateways) {
    $default_gateway = Jigoshop_Base::get_options()->get_option('jigoshop_default_gateway');
    if (!empty($default_gateway)) {
        if (array_key_exists($default_gateway, $available_gateways)) {
            $temp = $available_gateways[$default_gateway];
            unset($available_gateways[$default_gateway]);
            array_unshift($available_gateways, $temp);
        }
    }
    $gateway_set = false;
    foreach ($available_gateways as $gateway) {
        /** @var jigoshop_payment_gateway $gateway */
        if (jigoshop_checkout::process_gateway($gateway)) {
            if (!$gateway_set) {
                // Chosen Method
                if (sizeof($available_gateways)) {
                    if (isset($_POST['payment_method']) && isset($available_gateways[$_POST['payment_method']])) {
                        $available_gateways[$_POST['payment_method']]->set_current();
                    } else {
                        $gateway->set_current();
                    }
                }
                $gateway_set = true;
            }
            ?>
					<li>
						<input type="radio" id="payment_method_<?php 
            echo $gateway->id;
Example #6
0
function jigoshop_process_checkout () {
	include_once jigoshop::plugin_path() . '/classes/jigoshop_checkout.class.php';

	jigoshop_checkout::instance()->process_checkout();
	
	die(0);
}
Example #7
0
		<tr>
			<?php 
$price_label = jigoshop_cart::show_retail_price() ? __('Retail Price', 'jigoshop') : __('Subtotal', 'jigoshop');
?>
			<td colspan="2"><?php 
echo $price_label;
?>
</td>
			<td class="cart-row-subtotal"><?php 
echo jigoshop_cart::get_cart_subtotal(true, false, true);
?>
</td>
		</tr>

		<?php 
jigoshop_checkout::render_shipping_dropdown();
?>

		<?php 
if (jigoshop_cart::show_retail_price() && Jigoshop_Base::get_options()->get('jigoshop_prices_include_tax') == 'no') {
    ?>
			<tr>
				<td colspan="2"><?php 
    _e('Subtotal', 'jigoshop');
    ?>
</td>
				<td><?php 
    echo jigoshop_cart::get_cart_subtotal(true, true);
    ?>
</td>
			</tr>
Example #8
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;
}