Ejemplo n.º 1
0
function fflcommerce_process_checkout()
{
    if (!is_checkout() || is_fflcommerce_single_page(FFLCOMMERCE_PAY)) {
        return;
    }
    if (count(fflcommerce_cart::get_cart()) == 0) {
        wp_safe_redirect(get_permalink(fflcommerce_get_page_id('cart')));
        exit;
    }
    /** @var fflcommerce_checkout $_checkout */
    $_checkout = fflcommerce_checkout::instance();
    $result = $_checkout->process_checkout();
    if (isset($result['result']) && $result['result'] === 'success') {
        wp_safe_redirect(apply_filters('fflcommerce_is_ajax_payment_successful', $result['redirect']));
        exit;
    }
    if (isset($result['redirect'])) {
        wp_safe_redirect(get_permalink($result['redirect']));
        exit;
    }
}
Ejemplo n.º 2
0
function fflcommerce_process_ajax_checkout()
{
    include_once FFLCOMMERCE_DIR . '/classes/fflcommerce_checkout.class.php';
    /** @var fflcommerce_checkout $checkout */
    $checkout = fflcommerce_checkout::instance();
    $result = $checkout->process_checkout();
    if ($result === false) {
        fflcommerce::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('fflcommerce_is_ajax_payment_successful', $result));
    exit;
}
Ejemplo n.º 3
0
	<ul class="payment_methods methods">
		<?php 
$available_gateways = fflcommerce_payment_gateways::get_available_payment_gateways();
if ($available_gateways) {
    $default_gateway = FFLCommerce_Base::get_options()->get_option('fflcommerce_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 fflcommerce_payment_gateway $gateway */
        if (fflcommerce_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;
Ejemplo n.º 4
0
		<tr>
			<?php 
$price_label = fflcommerce_cart::show_retail_price() ? __('Retail Price', 'fflcommerce') : __('Subtotal', 'fflcommerce');
?>
			<td colspan="2"><?php 
echo $price_label;
?>
</td>
			<td class="cart-row-subtotal"><?php 
echo fflcommerce_cart::get_cart_subtotal(true, false, true);
?>
</td>
		</tr>

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

		<?php 
if (fflcommerce_cart::show_retail_price() && FFLCommerce_Base::get_options()->get('fflcommerce_prices_include_tax') == 'no') {
    ?>
			<tr>
				<td colspan="2"><?php 
    _e('Subtotal', 'fflcommerce');
    ?>
</td>
				<td><?php 
    echo fflcommerce_cart::get_cart_subtotal(true, true);
    ?>
</td>
			</tr>