コード例 #1
0
ファイル: checkout.php プロジェクト: askzap/ultimate
        fn_set_hook('is_order_allowed', $_REQUEST['order_id'], $allowed_id);
        if (empty($allowed_id)) {
            // Access denied
            return array(CONTROLLER_STATUS_DENIED);
        }
        $order_info = fn_get_order_info($_REQUEST['order_id']);
        if (!empty($order_info['is_parent_order']) && $order_info['is_parent_order'] == 'Y') {
            $order_info['child_ids'] = implode(',', db_get_fields("SELECT order_id FROM ?:orders WHERE parent_order_id = ?i", $_REQUEST['order_id']));
        }
        if (!empty($order_info)) {
            Tygh::$app['view']->assign('order_info', $order_info);
        }
    }
    fn_add_breadcrumb(__('landing_header'));
} elseif ($mode == 'process_payment') {
    if (fn_allow_place_order($cart, $auth) == true) {
        $order_info = $cart;
        $order_info['products'] = $cart['products'];
        $order_info = fn_array_merge($order_info, $cart['user_data']);
        $order_info['order_id'] = $order_id = TIME . "_" . (!empty($auth['user_id']) ? $auth['user_id'] : 0);
        unset($order_info['user_data']);
        list($is_processor_script, $processor_data) = fn_check_processor_script($order_info['payment_id']);
        if ($is_processor_script) {
            set_time_limit(300);
            fn_define('IFRAME_MODE', true);
            include Registry::get('config.dir.payments') . $processor_data['processor_script'];
            fn_finish_payment($order_id, $pp_response, array());
            fn_order_placement_routines('route', $order_id);
        }
    }
}
コード例 #2
0
        }
        if (!empty($order_info)) {
            Registry::get('view')->assign('order_info', $order_info);
        }
        //add total shipping estimation to db
        $ls_total_estimation = array('ls_shipping_estimation' => $_SESSION['ls_all_estimations']['total_estimation']);
        db_query('UPDATE ?:orders SET ?u WHERE order_id=?p', $ls_total_estimation, $_REQUEST['order_id']);
        //add individual shipping estimation to db
        foreach ($_SESSION['ls_all_estimations']['individual_estimations'] as $ls_item_id => $ls_individual_estimation) {
            $ls_individual_estimation_db = array('ls_individual_estimation' => $ls_individual_estimation);
            db_query('UPDATE ?:order_details SET ?u WHERE order_id=?p AND item_id=?i', $ls_individual_estimation_db, $_REQUEST['order_id'], $ls_item_id);
        }
    }
    fn_add_breadcrumb(__('landing_header'));
} elseif ($mode == 'process_payment') {
    if (fn_allow_place_order($cart) == true) {
        $order_info = $cart;
        $order_info['products'] = $cart['products'];
        $order_info = fn_array_merge($order_info, $cart['user_data']);
        $order_info['order_id'] = $order_id = TIME . "_" . (!empty($auth['user_id']) ? $auth['user_id'] : 0);
        unset($order_info['user_data']);
        list($is_processor_script, $processor_data) = fn_check_processor_script($order_info['payment_id']);
        if ($is_processor_script) {
            set_time_limit(300);
            fn_define('IFRAME_MODE', true);
            include Registry::get('config.dir.payments') . $processor_data['processor_script'];
            fn_finish_payment($order_id, $pp_response, array());
            fn_order_placement_routines('route', $order_id);
        }
    }
}
コード例 #3
0
ファイル: checkout.php プロジェクト: diedsmiling/busenika
        }
        if (in_array('payments_summary', Registry::get('ajax')->result_ids)) {
            $view->display('views/checkout/components/payment_methods.tpl');
        }
        exit;
    }
    $view->assign('cart_products', array_reverse($cart_products, true));
    // Step 4: Summary
} elseif ($mode == 'summary') {
    if (!empty($_SESSION['shipping_rates'])) {
        define('CACHED_SHIPPING_RATES', true);
    }
    list($cart_products, $_SESSION['shipping_rates']) = fn_calculate_cart_content($cart, $auth, 'E', true, Registry::get('settings.General.one_page_checkout') == 'Y' ? 'F' : 'I');
    // we need this for promotions only actually...
    $profile_fields = fn_get_profile_fields('O');
    if (empty($cart['payment_id']) && floatval($cart['total']) || !fn_allow_place_order($cart)) {
        return array(CONTROLLER_STATUS_REDIRECT, "checkout.checkout");
    }
    fn_checkout_summary($cart);
    fn_get_default_credit_card($cart, empty($cart['user_data']) ? array() : $cart['user_data']);
    $view->assign('shipping_rates', $_SESSION['shipping_rates']);
    if (defined('AJAX_REQUEST')) {
        if (!empty($cart_products)) {
            foreach ($cart_products as $k => $v) {
                fn_gather_additional_product_data($cart_products[$k], true, false, true, false);
            }
        }
        $view->assign('cart', $cart);
        $view->assign('cart_products', array_reverse($cart_products, true));
        $view->assign('location', 'checkout');
        $view->assign('profile_fields', $profile_fields);
コード例 #4
0
ファイル: fn.cart.php プロジェクト: heg-arc-ne/cscart
/**
 * Places an order
 *
 * @param array $cart Array of the cart contents and user information necessary for purchase
 * @param array $auth Array of user authentication data (e.g. uid, usergroup_ids, etc.)
 * @param string $action Current action. Can be empty or "save"
 * @param int $issuer_id
 * @param int $parent_order_id
 * @return int order_id in case of success, otherwise False
 */
function fn_place_order(&$cart, &$auth, $action = '', $issuer_id = null, $parent_order_id = 0)
{
    $allow = fn_allow_place_order($cart, $auth, $parent_order_id);
    fn_set_hook('pre_place_order', $cart, $allow, $cart['product_groups']);
    if ($allow === false) {
        fn_set_notification('E', __('error'), __('order_was_not_placed'), 'K', 'failed_order_message');
    }
    if ($allow == true && !fn_cart_is_empty($cart)) {
        $cart['parent_order_id'] = $parent_order_id;
        // Remove unallowed chars from cc number
        if (!empty($cart['payment_info']['card_number'])) {
            $cart['payment_info']['card_number'] = str_replace(array(' ', '-'), '', $cart['payment_info']['card_number']);
        }
        if (empty($cart['order_id'])) {
            $cart['user_id'] = $auth['user_id'];
            $cart['tax_exempt'] = $auth['tax_exempt'];
            $cart['issuer_id'] = $issuer_id;
            // Create order
            list($order_id, $order_status) = fn_update_order($cart);
        } else {
            // Update order
            list($order_id, $order_status) = fn_update_order($cart, $cart['order_id']);
        }
        if (!empty($order_id)) {
            // If customer is not logged in, store order ids in the session
            if (empty($auth['user_id'])) {
                $auth['order_ids'][] = $order_id;
            }
            // If order total is zero, just save the order without any processing procedures
            if (floatval($cart['total']) == 0) {
                $action = 'save';
                $order_status = 'P';
            }
            fn_set_hook('place_order', $order_id, $action, $order_status, $cart, $auth);
            $is_processor_script = false;
            if ($action != 'save') {
                list($is_processor_script, ) = fn_check_processor_script($cart['payment_id'], true);
            }
            if (!$is_processor_script && $order_status == STATUS_INCOMPLETED_ORDER) {
                $order_status = 'O';
            }
            $short_order_data = fn_get_order_short_info($order_id);
            // Set new order status
            fn_change_order_status($order_id, $order_status, $short_order_data['status'], $is_processor_script || $order_status == STATUS_PARENT_ORDER ? fn_get_notification_rules(array(), true) : fn_get_notification_rules(array()), true);
            $cart['processed_order_id'] = array();
            $cart['processed_order_id'][] = $order_id;
            if (!$parent_order_id && count($cart['product_groups']) > 1) {
                $child_orders = fn_place_suborders($order_id, $cart, $auth, $action, $issuer_id);
                array_unshift($child_orders, $order_id);
                $cart['processed_order_id'] = $child_orders;
            }
            return array($order_id, $action != 'save');
        }
    }
    return array(false, false);
}
    function content_55d2f3637ecf84_46812158($_smarty_tpl)
    {
        if (!is_callable('smarty_function_script')) {
            include '/home/coriolan/public_html/lead/app/functions/smarty_plugins/function.script.php';
        }
        if (!is_callable('smarty_block_hook')) {
            include '/home/coriolan/public_html/lead/app/functions/smarty_plugins/block.hook.php';
        }
        if (!is_callable('smarty_function_set_id')) {
            include '/home/coriolan/public_html/lead/app/functions/smarty_plugins/function.set_id.php';
        }
        fn_preload_lang_vars(array('billing_options', 'billing_options', 'text_no_payments_needed', 'submit_my_order', 'text_no_shipping_methods', 'text_min_order_amount_required', 'billing_options', 'billing_options', 'text_no_payments_needed', 'submit_my_order', 'text_no_shipping_methods', 'text_min_order_amount_required'));
        if ($_smarty_tpl->tpl_vars['runtime']->value['customization_mode']['design'] == "Y" && @constant('AREA') == "C") {
            $_smarty_tpl->_capture_stack[0][] = array("template_content", null, null);
            ob_start();
            echo smarty_function_script(array('src' => "js/tygh/tabs.js"), $_smarty_tpl);
            ?>


<div class="ty-step__container<?php 
            if ($_smarty_tpl->tpl_vars['edit']->value) {
                ?>
-active<?php 
            }
            ?>
 ty-step-four" data-ct-checkout="billing_options" id="step_four">
    <?php 
            if ($_smarty_tpl->tpl_vars['settings']->value['General']['checkout_style'] != "multi_page") {
                ?>
        <h3 class="ty-step__title<?php 
                if ($_smarty_tpl->tpl_vars['edit']->value) {
                    ?>
-active<?php 
                }
                ?>
 clearfix">
            <span class="ty-step__title-left"><?php 
                if ($_smarty_tpl->tpl_vars['profile_fields']->value['B'] || $_smarty_tpl->tpl_vars['profile_fields']->value['S']) {
                    ?>
4<?php 
                } else {
                    ?>
3<?php 
                }
                ?>
</span>
            <i class="ty-step__title-arrow ty-icon-down-micro"></i>
            
            <?php 
                $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "checkout:edit_link_title"));
                $_block_repeat = true;
                echo smarty_block_hook(array('name' => "checkout:edit_link_title"), null, $_smarty_tpl, $_block_repeat);
                while ($_block_repeat) {
                    ob_start();
                    ?>

            <?php 
                    if ($_smarty_tpl->tpl_vars['complete']->value && !$_smarty_tpl->tpl_vars['edit']->value) {
                        ?>
                <a class="ty-step__title-txt cm-ajax" href="<?php 
                        echo htmlspecialchars(fn_url("checkout.checkout?edit_step=step_four&from_step=" . (string) $_smarty_tpl->tpl_vars['edit_step']->value), ENT_QUOTES, 'UTF-8');
                        ?>
" data-ca-target-id="checkout_*"><?php 
                        echo $_smarty_tpl->__("billing_options");
                        ?>
</a>
            <?php 
                    } else {
                        ?>
                <span class="ty-step__title-txt"><?php 
                        echo $_smarty_tpl->__("billing_options");
                        ?>
</span>
            <?php 
                    }
                    ?>
            <?php 
                    $_block_content = ob_get_clean();
                    $_block_repeat = false;
                    echo smarty_block_hook(array('name' => "checkout:edit_link_title"), $_block_content, $_smarty_tpl, $_block_repeat);
                }
                array_pop($_smarty_tpl->smarty->_tag_stack);
                ?>

        </h3>
    <?php 
            }
            ?>

    <div id="step_four_body" class="ty-step__body<?php 
            if ($_smarty_tpl->tpl_vars['edit']->value) {
                ?>
-active<?php 
            }
            ?>
 <?php 
            if (!$_smarty_tpl->tpl_vars['edit']->value) {
                ?>
hidden<?php 
            }
            ?>
">
        <div class="clearfix ty-checkout__billing-tabs">
            
            <?php 
            if (fn_allow_place_order($_smarty_tpl->tpl_vars['cart']->value)) {
                ?>
                <?php 
                if ($_smarty_tpl->tpl_vars['edit']->value) {
                    ?>
                    <div class="clearfix">
                        <?php 
                    if ($_smarty_tpl->tpl_vars['cart']->value['payment_id']) {
                        ?>
                            <?php 
                        echo $_smarty_tpl->getSubTemplate("views/checkout/components/payments/payment_methods.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('payment_id' => $_smarty_tpl->tpl_vars['cart']->value['payment_id']), 0);
                        ?>

                        <?php 
                    } else {
                        ?>
                            <div class="checkout__block"><h3 class="ty-subheader"><?php 
                        echo $_smarty_tpl->__("text_no_payments_needed");
                        ?>
</h3></div>
                           
                            <form name="paymens_form" action="<?php 
                        echo htmlspecialchars(fn_url(''), ENT_QUOTES, 'UTF-8');
                        ?>
" method="post">
                                <div class="ty-checkout-buttons">
                                    
                                    <?php 
                        echo $_smarty_tpl->getSubTemplate("buttons/button.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('but_meta' => "ty-btn__secondary", 'but_onclick' => "ls_checkout_estimation_cart_continue('place_order','dispatch[checkout.place_order]');", 'but_id' => "place_order", 'but_role' => "text", 'but_text' => __("submit_my_order")), 0);
                        ?>

                                </div>
                            </form>
                        <?php 
                    }
                    ?>
                    </div>
                <?php 
                }
                ?>

            <?php 
            } else {
                ?>
                <?php 
                if ($_smarty_tpl->tpl_vars['cart']->value['shipping_failed']) {
                    ?>
                    <p class="ty-error-text ty-center"><?php 
                    echo $_smarty_tpl->__("text_no_shipping_methods");
                    ?>
</p>
                <?php 
                }
                ?>

                <?php 
                if ($_smarty_tpl->tpl_vars['cart']->value['amount_failed']) {
                    ?>
                    <div class="checkout__block">
                        <p class="ty-error-text"><?php 
                    echo $_smarty_tpl->__("text_min_order_amount_required");
                    ?>
&nbsp;<strong><?php 
                    echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['settings']->value['General']['min_order_amount']), 0);
                    ?>
</strong></p>
                    </div>
                <?php 
                }
                ?>

                <div class="ty-checkout-buttons">
                    <?php 
                echo $_smarty_tpl->getSubTemplate("buttons/continue_shopping.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('but_id' => "checkout_step_four", 'but_href' => fn_url($_smarty_tpl->tpl_vars['continue_url']->value), 'but_role' => "action"), 0);
                ?>

                </div>
                
            <?php 
            }
            ?>
        </div>
    </div>
<!--step_four--></div>

<div id="place_order_data" class="hidden">
</div><?php 
            list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
            if (!empty($_capture_buffer)) {
                if (isset($_capture_assign)) {
                    $_smarty_tpl->assign($_capture_assign, ob_get_contents());
                }
                if (isset($_capture_append)) {
                    $_smarty_tpl->append($_capture_append, ob_get_contents());
                }
                Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
            } else {
                $_smarty_tpl->capture_error();
            }
            if (trim(Smarty::$_smarty_vars['capture']['template_content'])) {
                if ($_smarty_tpl->tpl_vars['auth']->value['area'] == "A") {
                    ?>
<span class="cm-template-box template-box" data-ca-te-template="views/checkout/components/steps/step_four.tpl" id="<?php 
                    echo smarty_function_set_id(array('name' => "views/checkout/components/steps/step_four.tpl"), $_smarty_tpl);
                    ?>
"><div class="cm-template-icon icon-edit ty-icon-edit hidden"></div><?php 
                    echo Smarty::$_smarty_vars['capture']['template_content'];
                    ?>
<!--[/tpl_id]--></span><?php 
                } else {
                    echo Smarty::$_smarty_vars['capture']['template_content'];
                }
            }
        } else {
            echo smarty_function_script(array('src' => "js/tygh/tabs.js"), $_smarty_tpl);
            ?>


<div class="ty-step__container<?php 
            if ($_smarty_tpl->tpl_vars['edit']->value) {
                ?>
-active<?php 
            }
            ?>
 ty-step-four" data-ct-checkout="billing_options" id="step_four">
    <?php 
            if ($_smarty_tpl->tpl_vars['settings']->value['General']['checkout_style'] != "multi_page") {
                ?>
        <h3 class="ty-step__title<?php 
                if ($_smarty_tpl->tpl_vars['edit']->value) {
                    ?>
-active<?php 
                }
                ?>
 clearfix">
            <span class="ty-step__title-left"><?php 
                if ($_smarty_tpl->tpl_vars['profile_fields']->value['B'] || $_smarty_tpl->tpl_vars['profile_fields']->value['S']) {
                    ?>
4<?php 
                } else {
                    ?>
3<?php 
                }
                ?>
</span>
            <i class="ty-step__title-arrow ty-icon-down-micro"></i>
            
            <?php 
                $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "checkout:edit_link_title"));
                $_block_repeat = true;
                echo smarty_block_hook(array('name' => "checkout:edit_link_title"), null, $_smarty_tpl, $_block_repeat);
                while ($_block_repeat) {
                    ob_start();
                    ?>

            <?php 
                    if ($_smarty_tpl->tpl_vars['complete']->value && !$_smarty_tpl->tpl_vars['edit']->value) {
                        ?>
                <a class="ty-step__title-txt cm-ajax" href="<?php 
                        echo htmlspecialchars(fn_url("checkout.checkout?edit_step=step_four&from_step=" . (string) $_smarty_tpl->tpl_vars['edit_step']->value), ENT_QUOTES, 'UTF-8');
                        ?>
" data-ca-target-id="checkout_*"><?php 
                        echo $_smarty_tpl->__("billing_options");
                        ?>
</a>
            <?php 
                    } else {
                        ?>
                <span class="ty-step__title-txt"><?php 
                        echo $_smarty_tpl->__("billing_options");
                        ?>
</span>
            <?php 
                    }
                    ?>
            <?php 
                    $_block_content = ob_get_clean();
                    $_block_repeat = false;
                    echo smarty_block_hook(array('name' => "checkout:edit_link_title"), $_block_content, $_smarty_tpl, $_block_repeat);
                }
                array_pop($_smarty_tpl->smarty->_tag_stack);
                ?>

        </h3>
    <?php 
            }
            ?>

    <div id="step_four_body" class="ty-step__body<?php 
            if ($_smarty_tpl->tpl_vars['edit']->value) {
                ?>
-active<?php 
            }
            ?>
 <?php 
            if (!$_smarty_tpl->tpl_vars['edit']->value) {
                ?>
hidden<?php 
            }
            ?>
">
        <div class="clearfix ty-checkout__billing-tabs">
            
            <?php 
            if (fn_allow_place_order($_smarty_tpl->tpl_vars['cart']->value)) {
                ?>
                <?php 
                if ($_smarty_tpl->tpl_vars['edit']->value) {
                    ?>
                    <div class="clearfix">
                        <?php 
                    if ($_smarty_tpl->tpl_vars['cart']->value['payment_id']) {
                        ?>
                            <?php 
                        echo $_smarty_tpl->getSubTemplate("views/checkout/components/payments/payment_methods.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('payment_id' => $_smarty_tpl->tpl_vars['cart']->value['payment_id']), 0);
                        ?>

                        <?php 
                    } else {
                        ?>
                            <div class="checkout__block"><h3 class="ty-subheader"><?php 
                        echo $_smarty_tpl->__("text_no_payments_needed");
                        ?>
</h3></div>
                           
                            <form name="paymens_form" action="<?php 
                        echo htmlspecialchars(fn_url(''), ENT_QUOTES, 'UTF-8');
                        ?>
" method="post">
                                <div class="ty-checkout-buttons">
                                    
                                    <?php 
                        echo $_smarty_tpl->getSubTemplate("buttons/button.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('but_meta' => "ty-btn__secondary", 'but_onclick' => "ls_checkout_estimation_cart_continue('place_order','dispatch[checkout.place_order]');", 'but_id' => "place_order", 'but_role' => "text", 'but_text' => __("submit_my_order")), 0);
                        ?>

                                </div>
                            </form>
                        <?php 
                    }
                    ?>
                    </div>
                <?php 
                }
                ?>

            <?php 
            } else {
                ?>
                <?php 
                if ($_smarty_tpl->tpl_vars['cart']->value['shipping_failed']) {
                    ?>
                    <p class="ty-error-text ty-center"><?php 
                    echo $_smarty_tpl->__("text_no_shipping_methods");
                    ?>
</p>
                <?php 
                }
                ?>

                <?php 
                if ($_smarty_tpl->tpl_vars['cart']->value['amount_failed']) {
                    ?>
                    <div class="checkout__block">
                        <p class="ty-error-text"><?php 
                    echo $_smarty_tpl->__("text_min_order_amount_required");
                    ?>
&nbsp;<strong><?php 
                    echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['settings']->value['General']['min_order_amount']), 0);
                    ?>
</strong></p>
                    </div>
                <?php 
                }
                ?>

                <div class="ty-checkout-buttons">
                    <?php 
                echo $_smarty_tpl->getSubTemplate("buttons/continue_shopping.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('but_id' => "checkout_step_four", 'but_href' => fn_url($_smarty_tpl->tpl_vars['continue_url']->value), 'but_role' => "action"), 0);
                ?>

                </div>
                
            <?php 
            }
            ?>
        </div>
    </div>
<!--step_four--></div>

<div id="place_order_data" class="hidden">
</div><?php 
        }
    }