Пример #1
0
 }
 fn_set_hook('checkout_select_default_payment_method', $cart, $payment_methods, $completed_steps);
 if (!empty($cart['payment_id'])) {
     $payment_info = fn_get_payment_method_data($cart['payment_id']);
     Registry::get('view')->assign('payment_info', $payment_info);
     if (!empty($payment_info['processor_params']['iframe_mode']) && $payment_info['processor_params']['iframe_mode'] == 'Y') {
         Registry::get('view')->assign('iframe_mode', true);
     }
 }
 Registry::get('view')->assign('payment_methods', $payment_methods);
 $cart['payment_surcharge'] = 0;
 if (!empty($cart['payment_id']) && !empty($payment_info)) {
     fn_update_payment_surcharge($cart, $auth);
 }
 if (fn_allowed_for('MULTIVENDOR')) {
     Registry::get('view')->assign('take_surcharge_from_vendor', fn_take_payment_surcharge_from_vendor($cart['products']));
 }
 Registry::get('view')->assign('usergroups', fn_get_usergroups('C', CART_LANGUAGE));
 Registry::get('view')->assign('countries', fn_get_simple_countries(true, CART_LANGUAGE));
 Registry::get('view')->assign('states', fn_get_all_states());
 $cart['ship_to_another'] = fn_check_shipping_billing($cart['user_data'], $profile_fields);
 Registry::get('view')->assign('profile_fields', $profile_fields);
 if (Registry::get('settings.General.user_multiple_profiles') == 'Y') {
     $user_profiles = fn_get_user_profiles($auth['user_id']);
     Registry::get('view')->assign('user_profiles', $user_profiles);
 }
 fn_checkout_summary($cart);
 if ($edit_step == 'step_two' && !empty($completed_steps['step_one']) && empty($profile_fields['B']) && empty($profile_fields['S'])) {
     $edit_step = 'step_four';
 }
 // If we're on shipping step and shipping is not required, switch to payment step
Пример #2
0
 }
 fn_set_hook('checkout_select_default_payment_method', $cart, $payment_methods, $completed_steps);
 if (!empty($cart['payment_id'])) {
     $payment_info = fn_get_payment_method_data($cart['payment_id']);
     Tygh::$app['view']->assign('payment_info', $payment_info);
     if (!empty($payment_info['processor_params']['iframe_mode']) && $payment_info['processor_params']['iframe_mode'] == 'Y') {
         Tygh::$app['view']->assign('iframe_mode', true);
     }
 }
 Tygh::$app['view']->assign('payment_methods', $payment_methods);
 $cart['payment_surcharge'] = 0;
 if (!empty($cart['payment_id']) && !empty($payment_info)) {
     fn_update_payment_surcharge($cart, $auth);
 }
 if (fn_allowed_for('MULTIVENDOR')) {
     Tygh::$app['view']->assign('take_surcharge_from_vendor', fn_take_payment_surcharge_from_vendor($cart['products']));
 }
 Tygh::$app['view']->assign('usergroups', fn_get_usergroups(array('type' => 'C', 'status' => 'A'), CART_LANGUAGE));
 Tygh::$app['view']->assign('countries', fn_get_simple_countries(true, CART_LANGUAGE));
 Tygh::$app['view']->assign('states', fn_get_all_states());
 $cart['ship_to_another'] = fn_check_shipping_billing($cart['user_data'], $profile_fields);
 Tygh::$app['view']->assign('profile_fields', $profile_fields);
 if (Registry::get('settings.General.user_multiple_profiles') == 'Y') {
     $user_profiles = fn_get_user_profiles($auth['user_id']);
     Tygh::$app['view']->assign('user_profiles', $user_profiles);
 }
 fn_checkout_summary($cart);
 Tygh::$app['view']->assign('use_ajax', 'true');
 Tygh::$app['view']->assign('completed_steps', $completed_steps);
 Tygh::$app['view']->assign('location', 'checkout');
 Tygh::$app['view']->assign('cart', $cart);
Пример #3
0
             $post_data["amount{$suffix}"] = $item_price;
             $post_data["quantity{$suffix}"] = '1';
         }
     }
     // Gift Certificates
     if (!empty($order_info['gift_certificates'])) {
         foreach ($order_info['gift_certificates'] as $k => $v) {
             $suffix = '_' . $i++;
             $v['gift_cert_code'] = htmlspecialchars($v['gift_cert_code']);
             $v['amount'] = !empty($v['extra']['exclude_from_calculate']) ? 0 : fn_format_price($v['amount'], $paypal_currency);
             $post_data["item_name{$suffix}"] = $v['gift_cert_code'];
             $post_data["amount{$suffix}"] = $v['amount'];
             $post_data["quantity{$suffix}"] = '1';
         }
     }
     if (fn_allowed_for('MULTIVENDOR') && fn_take_payment_surcharge_from_vendor('')) {
         $take_surcharge = false;
     } else {
         $take_surcharge = true;
     }
     // Payment surcharge
     if ($take_surcharge && floatval($order_info['payment_surcharge'])) {
         $suffix = '_' . $i++;
         $name = __('surcharge');
         $payment_surcharge_amount = fn_format_price($order_info['payment_surcharge'], $paypal_currency);
         $post_data["item_name{$suffix}"] = $name;
         $post_data["amount{$suffix}"] = $payment_surcharge_amount;
         $post_data["quantity{$suffix}"] = '1';
     }
 } elseif ($paypal_total == 0) {
     // Move shipping price to order total to avoid blocking order with zero products price
Пример #4
0
function fn_print_order_invoices($order_ids, $pdf = false, $area = AREA, $lang_code = CART_LANGUAGE)
{
    $view = Registry::get('view');
    $html = array();
    $view->assign('order_status_descr', fn_get_simple_statuses(STATUSES_ORDER, true, true));
    $view->assign('profile_fields', fn_get_profile_fields('I'));
    if (!is_array($order_ids)) {
        $order_ids = array($order_ids);
    }
    foreach ($order_ids as $order_id) {
        $order_info = fn_get_order_info($order_id, false, true, false, true);
        if (empty($order_info)) {
            continue;
        }
        if (fn_allowed_for('MULTIVENDOR')) {
            $view->assign('take_surcharge_from_vendor', fn_take_payment_surcharge_from_vendor($order_info['products']));
        }
        list($shipments) = fn_get_shipments_info(array('order_id' => $order_info['order_id'], 'advanced_info' => true));
        $use_shipments = !fn_one_full_shipped($shipments);
        $view->assign('order_info', $order_info);
        $view->assign('shipments', $shipments);
        $view->assign('use_shipments', $use_shipments);
        $view->assign('payment_method', fn_get_payment_data(!empty($order_info['payment_method']['payment_id']) ? $order_info['payment_method']['payment_id'] : 0, $order_info['order_id'], $lang_code));
        $view->assign('order_status', fn_get_status_data($order_info['status'], STATUSES_ORDER, $order_info['order_id'], $lang_code, $order_info['company_id']));
        $view->assign('status_settings', fn_get_status_params($order_info['status']));
        $view->assign('company_data', fn_get_company_placement_info($order_info['company_id'], $lang_code));
        if ($pdf == true) {
            fn_disable_live_editor_mode();
            $html[] = $view->displayMail('orders/print_invoice.tpl', false, $area, $order_info['company_id'], $lang_code);
        } else {
            $view->displayMail('orders/print_invoice.tpl', true, $area, $order_info['company_id'], $lang_code);
            if ($order_id != end($order_ids)) {
                echo "<div style='page-break-before: always;'>&nbsp;</div>";
            }
        }
    }
    if ($pdf == true) {
        Pdf::render($html, __('invoices') . '-' . implode('-', $order_ids));
    }
    return true;
}
Пример #5
0
function fn_prepare_repay_data($payment_id, $order_info, $auth)
{
    if (empty($payment_id)) {
        $payment_id = $order_info['payment_id'];
    }
    //Get payment methods
    $payment_methods = fn_get_payments(array('usergroup_ids' => $auth['usergroup_ids']));
    fn_set_hook('prepare_repay_data', $payment_id, $order_info, $auth, $payment_methods);
    if (!empty($payment_methods)) {
        // Get payment method info
        $payment_groups = fn_prepare_checkout_payment_methods($order_info, $auth);
        if (!empty($payment_id)) {
            $order_payment_id = $payment_id;
        } else {
            $first = reset($payment_methods);
            $order_payment_id = $first['payment_id'];
        }
        $payment_data = fn_get_payment_method_data($order_payment_id);
        $payment_data['surcharge_value'] = 0;
        if (floatval($payment_data['a_surcharge'])) {
            $payment_data['surcharge_value'] += $payment_data['a_surcharge'];
        }
        if (floatval($payment_data['p_surcharge'])) {
            if (fn_allowed_for('MULTIVENDOR') && fn_take_payment_surcharge_from_vendor($order_info['products'])) {
                $payment_data['surcharge_value'] += fn_format_price($order_info['total']);
            } else {
                $payment_data['surcharge_value'] += fn_format_price(($order_info['total'] - $order_info['payment_surcharge']) * $payment_data['p_surcharge'] / 100);
            }
        }
        Registry::get('view')->assign('payment_methods', $payment_groups);
        Registry::get('view')->assign('order_payment_id', $order_payment_id);
        Registry::get('view')->assign('payment_method', $payment_data);
    }
}
Пример #6
0
function fn_qwintry_save_order_invoice($order_id, $area = AREA, $lang_code = CART_LANGUAGE)
{
    $view = Tygh::$app['view'];
    $html = array();
    $view->assign('order_status_descr', fn_get_simple_statuses(STATUSES_ORDER, true, true));
    $view->assign('profile_fields', fn_get_profile_fields('I'));
    $order_info = fn_get_order_info($order_id, false, true, false, true);
    if (empty($order_info)) {
        return;
    }
    if (fn_allowed_for('MULTIVENDOR')) {
        $view->assign('take_surcharge_from_vendor', fn_take_payment_surcharge_from_vendor($order_info['products']));
    }
    list($shipments) = fn_get_shipments_info(array('order_id' => $order_info['order_id'], 'advanced_info' => true));
    $use_shipments = !fn_one_full_shipped($shipments);
    $view->assign('order_info', $order_info);
    $view->assign('shipments', $shipments);
    $view->assign('use_shipments', $use_shipments);
    $view->assign('payment_method', fn_get_payment_data(!empty($order_info['payment_method']['payment_id']) ? $order_info['payment_method']['payment_id'] : 0, $order_info['order_id'], $lang_code));
    $view->assign('order_status', fn_get_status_data($order_info['status'], STATUSES_ORDER, $order_info['order_id'], $lang_code, $order_info['company_id']));
    $view->assign('status_settings', fn_get_status_params($order_info['status']));
    $view->assign('company_data', fn_get_company_placement_info($order_info['company_id'], $lang_code));
    fn_disable_live_editor_mode();
    $html[] = $view->displayMail('orders/print_invoice.tpl', false, $area, $order_info['company_id'], $lang_code);
    $filename = QWINTRY_DIR_INVOICES . $order_id . '.pdf';
    if (Pdf::render($html, $filename, true)) {
        return $filename;
    }
    return false;
}
Пример #7
0
function fn_pp_standart_prepare_products($order_info, $paypal_currency = '', $max_pp_products = MAX_PAYPAL_PRODUCTS)
{
    $post_data = array();
    $product_count = 1;
    if (empty($paypal_currency)) {
        $paypal_currency = !empty($order_info['payment_method']['processor_params']['currency']) ? $order_info['payment_method']['processor_params']['currency'] : CART_PRIMARY_CURRENCY;
    }
    $paypal_shipping = fn_order_shipping_cost($order_info);
    $paypal_total = fn_format_price($order_info['total'] - $paypal_shipping, $paypal_currency);
    if (empty($order_info['use_gift_certificates']) && !floatval($order_info['subtotal_discount']) && empty($order_info['points_info']['in_use']) && count($order_info['products']) < MAX_PAYPAL_PRODUCTS) {
        $i = 1;
        if (!empty($order_info['products'])) {
            foreach ($order_info['products'] as $k => $v) {
                $suffix = '_' . $i++;
                $v['product'] = htmlspecialchars(strip_tags($v['product']));
                $v['price'] = fn_format_price(($v['subtotal'] - fn_external_discounts($v)) / $v['amount'], $paypal_currency);
                $post_data["item_name{$suffix}"] = $v['product'];
                $post_data["amount{$suffix}"] = $v['price'];
                $post_data["quantity{$suffix}"] = $v['amount'];
                if (!empty($v['product_options'])) {
                    foreach ($v['product_options'] as $_k => $_v) {
                        $_v['option_name'] = htmlspecialchars(strip_tags($_v['option_name']));
                        $_v['variant_name'] = htmlspecialchars(strip_tags($_v['variant_name']));
                        $post_data["on{$_k}{$suffix}"] = $_v['option_name'];
                        $post_data["os{$_k}{$suffix}"] = $_v['variant_name'];
                    }
                }
            }
        }
        if (!empty($order_info['taxes']) && Registry::get('settings.General.tax_calculation') == 'subtotal') {
            foreach ($order_info['taxes'] as $tax_id => $tax) {
                if ($tax['price_includes_tax'] == 'Y') {
                    continue;
                }
                $suffix = '_' . $i++;
                $item_name = htmlspecialchars(strip_tags($tax['description']));
                $item_price = fn_format_price($tax['tax_subtotal'], $paypal_currency);
                $post_data["item_name{$suffix}"] = $item_name;
                $post_data["amount{$suffix}"] = $item_price;
                $post_data["quantity{$suffix}"] = '1';
            }
        }
        // Gift Certificates
        if (!empty($order_info['gift_certificates'])) {
            foreach ($order_info['gift_certificates'] as $k => $v) {
                $suffix = '_' . $i++;
                $v['gift_cert_code'] = htmlspecialchars($v['gift_cert_code']);
                $v['amount'] = !empty($v['extra']['exclude_from_calculate']) ? 0 : fn_format_price($v['amount'], $paypal_currency);
                $post_data["item_name{$suffix}"] = $v['gift_cert_code'];
                $post_data["amount{$suffix}"] = $v['amount'];
                $post_data["quantity{$suffix}"] = '1';
            }
        }
        if (fn_allowed_for('MULTIVENDOR') && fn_take_payment_surcharge_from_vendor('')) {
            $take_surcharge = false;
        } else {
            $take_surcharge = true;
        }
        // Payment surcharge
        if ($take_surcharge && floatval($order_info['payment_surcharge'])) {
            $suffix = '_' . $i++;
            $name = __('surcharge');
            $payment_surcharge_amount = fn_format_price($order_info['payment_surcharge'], $paypal_currency);
            $post_data["item_name{$suffix}"] = $name;
            $post_data["amount{$suffix}"] = $payment_surcharge_amount;
            $post_data["quantity{$suffix}"] = '1';
        }
        $product_count = $i - 1;
    } elseif ($paypal_total <= 0) {
        $post_data['item_name_1'] = __('total_product_cost');
        $post_data['amount_1'] = fn_format_price($order_info['total'], $paypal_currency);
        $post_data['quantity_1'] = '1';
        $post_data['amount'] = fn_format_price($order_info['total'], $paypal_currency);
        $post_data['shipping_1'] = 0;
    } else {
        $post_data['item_name_1'] = __('total_product_cost');
        $post_data['amount_1'] = $paypal_total;
        $post_data['quantity_1'] = '1';
    }
    return array($post_data, $product_count);
}