function fflcommerce_checkout($atts) { if (!defined('FFLCOMMERCE_CHECKOUT')) { define('FFLCOMMERCE_CHECKOUT', true); } $non_js_checkout = isset($_POST['update_totals']) && $_POST['update_totals'] ? true : false; $result = fflcommerce_cart::check_cart_item_stock(); if (is_wp_error($result)) { fflcommerce::add_error($result->get_error_message()); } if (!fflcommerce::has_errors() && $non_js_checkout) { fflcommerce::add_message(__('The order totals have been updated. Please confirm your order by pressing the Place Order button at the bottom of the page.', 'fflcommerce')); } fflcommerce::show_messages(); fflcommerce_get_template('checkout/form.php', false); }
/** * Outputs the pay page - payment gateways can hook in here to show payment forms etc **/ function fflcommerce_pay() { if (isset($_GET['pay_for_order']) && isset($_GET['order']) && isset($_GET['order_id'])) { // Pay for existing order $order_key = urldecode($_GET['order']); $order_id = (int) $_GET['order_id']; $order = new fflcommerce_order($order_id); fflcommerce::show_messages(); if ($order->id == $order_id && $order->order_key == $order_key && $order->status == 'pending') { fflcommerce_pay_for_existing_order($order); } } else { // Pay for order after checkout step if (isset($_GET['order'])) { $order_id = $_GET['order']; } else { $order_id = 0; } if (isset($_GET['key'])) { $order_key = $_GET['key']; } else { $order_key = ''; } if ($order_id > 0) { $order = new fflcommerce_order($order_id); if ($order->order_key == $order_key && $order->status == 'pending') { fflcommerce::show_messages(); ?> <ul class="order_details"> <li class="order"> <?php _e('Order:', 'fflcommerce'); ?> <strong><?php echo $order->get_order_number(); ?> </strong> </li> <li class="date"> <?php _e('Date:', 'fflcommerce'); ?> <strong><?php echo date_i18n(get_option('date_format') . ' ' . get_option('time_format'), strtotime($order->order_date)); ?> </strong> </li> <li class="total"> <?php _e('Total:', 'fflcommerce'); ?> <strong><?php echo fflcommerce_price($order->order_total); ?> </strong> </li> <li class="method"> <?php _e('Payment method:', 'fflcommerce'); ?> <strong><?php $gateways = fflcommerce_payment_gateways::payment_gateways(); if (isset($gateways[$order->payment_method])) { echo $gateways[$order->payment_method]->title; } else { echo $order->payment_method; } ?> </strong> </li> </ul> <?php do_action('receipt_' . $order->payment_method, $order_id); ?> <div class="clear"></div> <?php } } } }
<?php /** * @var $options Jigoshop_Options Options container. * @var $recent_orders int Number of recent orders to show. */ fflcommerce::show_messages(); if (is_user_logged_in()) { ?> <p><?php echo sprintf(__('Hello, <strong>%s</strong>. From your account dashboard you can view your recent orders, manage your shipping and billing addresses and <a href="%s">change your password</a>.', 'fflcommerce'), $current_user->display_name, apply_filters('fflcommerce_get_change_password_page_id', get_permalink(fflcommerce_get_page_id('change_password')))); ?> </p> <?php do_action('fflcommerce_before_my_account'); ?> <?php if ($downloads = fflcommerce_customer::get_downloadable_products()) { ?> <h2><?php _e('Available downloads', 'fflcommerce'); ?> </h2> <ul class="digital-downloads"> <?php foreach ($downloads as $download) { ?> <li><?php if (is_numeric($download['downloads_remaining'])) {
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; }