当前位置: 首页>>代码示例>>PHP>>正文


PHP fn_clear_cart函数代码示例

本文整理汇总了PHP中fn_clear_cart函数的典型用法代码示例。如果您正苦于以下问题:PHP fn_clear_cart函数的具体用法?PHP fn_clear_cart怎么用?PHP fn_clear_cart使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了fn_clear_cart函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: apiUpdateOrder

 public static function apiUpdateOrder($order, $response)
 {
     if (!defined('ORDER_MANAGEMENT')) {
         define('ORDER_MANAGEMENT', true);
     }
     if (!empty($order['status'])) {
         $statuses = fn_get_statuses(STATUSES_ORDER, false, true);
         if (!isset($statuses[$order['status']])) {
             $response->addError('ERROR_OBJECT_UPDATE', str_replace('[object]', 'orders', __('twgadmin_wrong_api_object_data')));
         } else {
             fn_change_order_status($order['order_id'], $order['status']);
         }
     }
     $cart = array();
     fn_clear_cart($cart, true);
     $customer_auth = fn_fill_auth(array(), array(), false, 'C');
     fn_form_cart($order['order_id'], $cart, $customer_auth);
     $cart['order_id'] = $order['order_id'];
     // update only profile data
     $profile_data = fn_check_table_fields($order, 'user_profiles');
     $cart['user_data'] = fn_array_merge($cart['user_data'], $profile_data);
     $cart['user_data'] = fn_array_merge($cart['user_data'], $order);
     fn_calculate_cart_content($cart, $customer_auth, 'A', true, 'I');
     if (!empty($order['details'])) {
         db_query('UPDATE ?:orders SET details = ?s WHERE order_id = ?i', $order['details'], $order['order_id']);
     }
     if (!empty($order['notes'])) {
         $cart['notes'] = $order['notes'];
     }
     fn_update_payment_surcharge($cart, $customer_auth);
     list($order_id, $process_payment) = fn_place_order($cart, $customer_auth, 'save');
     return array($order_id, $process_payment);
 }
开发者ID:askzap,项目名称:ultimate,代码行数:33,代码来源:TwigmoOrder.php

示例2: fn_wishlist_sucess_user_login

function fn_wishlist_sucess_user_login($udata, $auth)
{
    if (AREA == 'C') {
        if ($cu_id = fn_get_session_data('cu_id')) {
            fn_clear_cart($cart);
            fn_save_cart_content($cart, $cu_id, 'W', 'U');
        }
    }
}
开发者ID:askzap,项目名称:ultimate,代码行数:9,代码来源:func.php

示例3: orderStatusProcessor

function orderStatusProcessor($status)
{
    switch ($status) {
        case PW_ORDER_STATUS_PROCESSED:
            // Order Processed : Clear shopping cart
            fn_clear_cart($_SESSION['cart']);
            break;
        default:
            break;
    }
}
开发者ID:vukhacdiep,项目名称:module-cscart,代码行数:11,代码来源:paymentwall.php

示例4: die

// $Id: products.pre.php 10444 2010-08-18 07:45:01Z alexions $
if (!defined('AREA')) {
    die('Access denied');
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if ($mode == 'options') {
        if (!empty($_REQUEST['product_data'])) {
            define('GET_OPTIONS', true);
            // Product data
            unset($_REQUEST['product_data']['custom_files']);
            list($product_id, $_data) = each($_REQUEST['product_data']);
            if (!empty($_data['configuration'])) {
                // Backup cart before changes
                $cart = $_SESSION['cart'];
                $_cart =& $_SESSION['cart'];
                fn_clear_cart($_cart);
                $_data['product_id'] = $product_id;
                $_data['amount'] = isset($_data['amount']) && intval($_data['amount']) <= 0 ? 1 : $_data['amount'];
                fn_add_product_to_cart(array($product_id => $_data), $_cart, $auth);
                list($cart_products) = fn_calculate_cart_content($_cart, $auth, 'S', true, 'F', false);
                if (!empty($_cart['points_info'])) {
                    Registry::set("runtime.product_configurator.points_info.{$product_id}", $_cart['points_info']);
                }
                // Restore cart data
                $_SESSION['cart'] = $cart;
                if (!empty($_REQUEST['appearance'])) {
                    foreach ($_REQUEST['appearance'] as $setting => $value) {
                        $view->assign($setting, $value);
                    }
                    $view->assign('no_images', true);
                }
开发者ID:diedsmiling,项目名称:busenika,代码行数:31,代码来源:products.pre.php

示例5: fn_twg_api_customer_logout

function fn_twg_api_customer_logout()
{
    // copied from common/auth.php - logout mode
    $auth = $_SESSION['auth'];
    fn_save_cart_content($_SESSION['cart'], $auth['user_id']);
    if (!empty($auth['user_id'])) {
        // Log user logout
        fn_log_event('users', 'session', array('user_id' => $auth['user_id'], 'time' => TIME - $auth['this_login'], 'timeout' => false));
    }
    unset($_SESSION['auth']);
    fn_clear_cart($_SESSION['cart'], false, true);
    fn_delete_session_data(fn_get_area_name() . '_user_id', fn_get_area_name() . '_password');
    return true;
}
开发者ID:arpad9,项目名称:bygmarket,代码行数:14,代码来源:func.php

示例6: update

 public function update($id, $params)
 {
     fn_define('ORDER_MANAGEMENT', true);
     $data = array();
     $valid_params = true;
     $status = Response::STATUS_BAD_REQUEST;
     if ($valid_params) {
         fn_clear_cart($cart, true);
         $customer_auth = fn_fill_auth(array(), array(), false, 'C');
         $cart_status = md5(serialize($cart));
         // Order info was not found or customer does not have enought permissions
         if (fn_form_cart($id, $cart, $customer_auth) && $cart_status != md5(serialize($cart))) {
             unset($params['product_groups']);
             if (empty($params['shipping_id'])) {
                 $shipping = reset($cart['shipping']);
                 if (!empty($shipping['shipping_id'])) {
                     $params['shipping_id'] = $shipping['shipping_id'];
                 }
             }
             $cart['order_id'] = $id;
             fn_calculate_cart_content($cart, $customer_auth);
             if (!empty($params['user_id'])) {
                 $cart['user_data'] = fn_get_user_info($params['user_id']);
             } elseif (!empty($params)) {
                 $cart['user_data'] = array_merge($cart['user_data'], $params);
             }
             if (!empty($cart['product_groups']) && !empty($params['shipping_id'])) {
                 foreach ($cart['product_groups'] as $key => $group) {
                     foreach ($group['shippings'] as $shipping_id => $shipping) {
                         if ($params['shipping_id'] == $shipping['shipping_id']) {
                             $cart['chosen_shipping'][$key] = $shipping_id;
                             break;
                         }
                     }
                 }
             }
             if (!empty($params['payment_id'])) {
                 if (!empty($params['payment_info'])) {
                     $cart['payment_info'] = $params['payment_info'];
                 } elseif ($params['payment_id'] != $cart['payment_id']) {
                     $cart['payment_info'] = array();
                 }
                 $cart['payment_id'] = $params['payment_id'];
             }
             if (!empty($params['products'])) {
                 $cart['products'] = $params['products'];
             }
             fn_calculate_cart_content($cart, $customer_auth);
             if (!empty($cart) && empty($cart['shipping_failed'])) {
                 $cart['parent_order_id'] = 0;
                 fn_update_payment_surcharge($cart, $customer_auth);
                 list($order_id, $order_status) = fn_update_order($cart, $id);
                 if ($order_id) {
                     if (!empty($params['status']) && fn_check_permissions('orders', 'update_status', 'admin')) {
                         fn_change_order_status($order_id, $params['status'], '', fn_get_notification_rules($params, false));
                     } elseif (!empty($order_status)) {
                         fn_change_order_status($order_id, $order_status, '', fn_get_notification_rules($params, false));
                     }
                     $status = Response::STATUS_OK;
                     $data = array('order_id' => $order_id);
                 }
             }
         }
     }
     return array('status' => $status, 'data' => $data);
 }
开发者ID:askzap,项目名称:ultimate,代码行数:66,代码来源:Orders.php

示例7: array

}
$dispatch = $_REQUEST['dispatch'];
$dynamic_object = array();
if (!empty($_REQUEST['dynamic_object'])) {
    $dynamic_object = $_REQUEST['dynamic_object'];
}
$dynamic_object_scheme = SchemesManager::getDynamicObject($dispatch, AREA, $_REQUEST);
if (!empty($dynamic_object_scheme)) {
    $dispatch = $dynamic_object_scheme['customer_dispatch'];
}
Tygh::$app['view']->assign('location_data', Location::instance()->get($dispatch, $dynamic_object, CART_LANGUAGE));
Tygh::$app['view']->assign('layout_data', Registry::get('runtime.layout'));
Tygh::$app['view']->assign('current_mode', fn_get_current_mode($_REQUEST));
// Init cart if not set
if (empty(Tygh::$app['session']['cart'])) {
    fn_clear_cart(Tygh::$app['session']['cart']);
}
if (!empty(Tygh::$app['session']['continue_url'])) {
    Tygh::$app['session']['continue_url'] = fn_url_remove_service_params(Tygh::$app['session']['continue_url']);
}
if (Registry::get('config.demo_mode') && (!empty($_REQUEST['demo_customize_theme']) && $_REQUEST['demo_customize_theme'] == 'Y' || !empty(Tygh::$app['session']['demo_customize_theme']))) {
    Tygh::$app['session']['demo_customize_theme'] = true;
    Registry::set('runtime.customization_mode.theme_editor', true);
    if (!empty($_REQUEST['demo_customize_theme'])) {
        $current_url = Registry::get('config.current_url');
        $current_url = fn_query_remove($current_url, 'demo_customize_theme');
        return array(CONTROLLER_STATUS_REDIRECT, $current_url);
    }
}
if (Registry::get('runtime.customization_mode.live_editor')) {
    Tygh::$app['view']->assign('live_editor_objects', fn_get_schema('customization', 'live_editor_objects'));
开发者ID:ambient-lounge,项目名称:site,代码行数:31,代码来源:init.php

示例8: die

* license  and  accept  to the terms of the  License Agreement can install *
* and use this program.                                                    *
*                                                                          *
****************************************************************************
* PLEASE READ THE FULL TEXT  OF THE SOFTWARE  LICENSE   AGREEMENT  IN  THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.            *
****************************************************************************/
use Ebay\Ebay;
use Tygh\Registry;
if (!defined('BOOTSTRAP')) {
    die('Access denied');
}
$_SESSION['cart'] = isset($_SESSION['cart']) ? $_SESSION['cart'] : array();
$cart =& $_SESSION['cart'];
if (empty($cart)) {
    fn_clear_cart($cart, true);
}
$_SESSION['customer_auth'] = isset($_SESSION['customer_auth']) ? $_SESSION['customer_auth'] : array();
$customer_auth =& $_SESSION['customer_auth'];
if (empty($customer_auth)) {
    $customer_auth = fn_fill_auth(array(), array(), false, 'C');
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if ($mode == 'update') {
        if ($template_id = fn_update_ebay_template($_REQUEST['template_data'], $_REQUEST['template_id'])) {
            return array(CONTROLLER_STATUS_OK, 'ebay.update?template_id=' . $template_id);
        } else {
            fn_save_post_data('template_data');
            fn_delete_notification('changes_saved');
        }
        return array(CONTROLLER_STATUS_OK, 'ebay.add');
开发者ID:askzap,项目名称:ultimate,代码行数:31,代码来源:ebay.php

示例9: fn_get_ebay_orders

function fn_get_ebay_orders($cart, $customer_auth)
{
    $success_orders = $failed_orders = array();
    setlocale(LC_TIME, 'en_US');
    $params = array('OrderStatus' => 'All');
    $last_transaction = db_get_field('SELECT timestamp FROM ?:ebay_cached_transactions WHERE type = ?s AND status = ?s ORDER BY timestamp DESC', 'orders', 'C');
    // Need user_id
    if (!empty($last_transaction)) {
        $params['CreateTimeFrom'] = gmstrftime("%Y-%m-%dT%H:%M:%S", $last_transaction);
        $params['CreateTimeTo'] = gmstrftime("%Y-%m-%dT%H:%M:%S", TIME);
    }
    $data = array('timestamp' => TIME, 'user_id' => $_SESSION['auth']['user_id'], 'session_id' => Session::getId(), 'status' => 'A', 'type' => 'orders', 'result' => '', 'site_id' => 0);
    $transaction_id = db_query('INSERT INTO ?:ebay_cached_transactions ?e', $data);
    list(, $ebay_orders) = Ebay::instance()->GetOrders($params);
    $data = array('status' => 'C', 'result' => count($ebay_orders));
    db_query('UPDATE ?:ebay_cached_transactions SET ?u WHERE transaction_id = ?i', $data, $transaction_id);
    if (!empty($ebay_orders)) {
        foreach ($ebay_orders as $k => $v) {
            $order_status = $v['OrderStatus'] == 'Completed' ? 'P' : 'O';
            $cart = array();
            fn_clear_cart($cart, true);
            $item_transactions = $v['TransactionArray'];
            $_cart = $products = array();
            if (!is_array($item_transactions)) {
                $item_transactions = $item_transactions->Transaction;
            }
            $i = 1;
            foreach ($item_transactions as $item) {
                $email = (string) $item->Buyer->Email;
                break;
            }
            $shipping_address = $v['ShippingAddress'];
            $customer_name = explode(' ', (string) $shipping_address->Name);
            $firstname = array_shift($customer_name);
            $lastname = implode(' ', $customer_name);
            $_cart = array('user_id' => 0, 'company_id' => Registry::get('runtime.company_id'), 'email' => $email, 'ebay_order_id' => $v['OrderID'], 'timestamp' => strtotime($v['CreatedTime']), 'payment_id' => 0, 'user_data' => array('firstname' => $firstname, 'lastname' => $lastname, 'phone' => (string) $shipping_address->Phone, 'country' => (string) $shipping_address->Country, 's_firstname' => $firstname, 's_lastname' => $lastname, 's_address' => (string) $shipping_address->Street1, 's_city' => (string) $shipping_address->CityName, 's_state' => (string) $shipping_address->StateOrProvince, 's_country' => (string) $shipping_address->Country, 's_phone' => (string) $shipping_address->Phone, 's_zipcode' => (string) $shipping_address->PostalCode, 'b_firstname' => $firstname, 'b_lastname' => $lastname, 'b_address' => (string) $shipping_address->Street1, 'b_city' => (string) $shipping_address->CityName, 'b_state' => (string) $shipping_address->StateOrProvince, 'b_country' => (string) $shipping_address->Country, 'b_phone' => (string) $shipping_address->Phone, 'b_zipcode' => (string) $shipping_address->PostalCode), 'notes' => '', 'payment_info' => array(), 'calculate_shipping' => false, 'shipping_required' => false);
            $cart = fn_array_merge($cart, $_cart);
            foreach ($item_transactions as $item) {
                $_item = (array) $item->Item;
                $product_id = db_get_field('SELECT product_id FROM ?:ebay_template_products WHERE ebay_item_id = ?i', $_item['ItemID']);
                // Need check company_id
                if (!$product_id) {
                    continue;
                }
                $product = fn_get_product_data($product_id, $cart['user_data']);
                $extra = array('product_options' => array());
                $options = db_get_array('SELECT ?:product_options.option_id, ?:product_options_descriptions.option_name, ?:product_option_variants_descriptions.variant_id, ?:product_option_variants_descriptions.variant_name
                FROM ?:product_options
                JOIN ?:product_option_variants ON ?:product_option_variants.option_id = ?:product_options.option_id
                JOIN ?:product_options_descriptions ON ?:product_options_descriptions.option_id = ?:product_options.option_id
                JOIN ?:product_option_variants_descriptions ON ?:product_option_variants_descriptions.variant_id = ?:product_option_variants.variant_id
                WHERE product_id =?i', $product_id);
                if (isset($item->Variation)) {
                    $variations_xml = (array) $item->Variation->VariationSpecifics;
                    if (isset($variations_xml['NameValueList']->Name)) {
                        $variations = (array) $variations_xml['NameValueList'];
                    } else {
                        foreach ($variations_xml['NameValueList'] as $variation) {
                            $variations[] = (array) $variation;
                        }
                    }
                    if (isset($variations)) {
                        if (isset($variations['Name'])) {
                            foreach ($options as $option) {
                                if ($variations['Name'] == $option['option_name'] && $variations['Value'] == $option['variant_name']) {
                                    $extra['product_options'][$option['option_id']] = $option['variant_id'];
                                }
                            }
                        } else {
                            foreach ($variations as $variation) {
                                foreach ($options as $option) {
                                    if ($variation['Name'] == $option['option_name'] && $variation['Value'] == $option['variant_name']) {
                                        $extra['product_options'][$option['option_id']] = $option['variant_id'];
                                    }
                                }
                            }
                        }
                        $variations = array();
                    }
                }
                $products[$i] = array('product_id' => $product_id, 'amount' => (int) $item->QuantityPurchased, 'price' => (double) $item->TransactionPrice, 'base_price' => (double) $item->TransactionPrice, 'is_edp' => $product['is_edp'], 'edp_shipping' => $product['edp_shipping'], 'free_shipping' => $product['free_shipping'], 'stored_price' => 'Y', 'company_id' => Registry::get('runtime.company_id'), 'extra' => $extra);
                unset($product);
                $i += 1;
            }
            if (empty($products)) {
                continue;
            }
            $cart['products'] = $products;
            unset($products);
            fn_calculate_cart_content($cart, $customer_auth, 'S', false, 'F', false);
            $cart['shipping_failed'] = false;
            $cart['company_shipping_failed'] = false;
            $cart['shipping_cost'] = $cart['display_shipping_cost'] = (double) $v['ShippingServiceSelected']->ShippingServiceCost;
            $cart['total'] = $v['Total'];
            $cart['subtotal'] = $v['Subtotal'];
            list($order_id, $process_payment) = fn_place_order($cart, $customer_auth);
            if (!empty($order_id)) {
                fn_change_order_status($order_id, $order_status, false);
                $success_orders[] = $order_id;
            } else {
//.........这里部分代码省略.........
开发者ID:askzap,项目名称:ultimate,代码行数:101,代码来源:func.php

示例10: fn_qwintry_fn_form_cart

function fn_qwintry_fn_form_cart($order_info)
{
    fn_clear_cart($cart, true);
    $customer_auth = fn_fill_auth();
    fn_form_cart($order_info['order_id'], $cart, $customer_auth, array());
    list($cart_products, ) = fn_calculate_cart_content($cart, $customer_auth, 'E', false, 'F', false);
    if (!empty($cart_products)) {
        foreach ($cart_products as $k => $v) {
            fn_gather_additional_product_data($cart_products[$k], false, false, true, false);
        }
    }
    $cart['products'] = $cart_products;
    return $cart;
}
开发者ID:qwintry,项目名称:logistics-cscart,代码行数:14,代码来源:func.php

示例11: fn_process_paypal_ipn

function fn_process_paypal_ipn($order_id, $data)
{
    $order_info = fn_get_order_info($order_id);
    if (!empty($order_info) && !empty($data['txn_id']) && (empty($order_info['payment_info']['txn_id']) || $data['payment_status'] != 'Completed' || $data['payment_status'] == 'Completed' && $order_info['payment_info']['txn_id'] !== $data['txn_id'])) {
        //Can't check refund transactions.
        if (isset($data['txn_type']) && !fn_validate_paypal_order_info($data, $order_info)) {
            return false;
        }
        $pp_settings = fn_get_paypal_settings();
        fn_clear_cart($cart, true);
        $customer_auth = fn_fill_auth(array(), array(), false, 'C');
        fn_form_cart($order_id, $cart, $customer_auth);
        if ($pp_settings['override_customer_info'] == 'Y') {
            $cart['user_data'] = fn_paypal_get_customer_info($data);
        }
        $cart['order_id'] = $order_id;
        $cart['payment_info'] = $order_info['payment_info'];
        $cart['payment_info']['protection_eligibility'] = !empty($data['protection_eligibility']) ? $data['protection_eligibility'] : '';
        $cart['payment_id'] = $order_info['payment_id'];
        if (!empty($data['memo'])) {
            //Save customer notes
            $cart['notes'] = $data['memo'];
        }
        if ($data['payment_status'] == 'Completed') {
            //save uniq ipn id to avoid double ipn processing
            $cart['payment_info']['txn_id'] = $data['txn_id'];
        }
        if (!empty($data['payer_email'])) {
            $cart['payment_info']['customer_email'] = $data['payer_email'];
        }
        if (!empty($data['payer_id'])) {
            $cart['payment_info']['client_id'] = $data['payer_id'];
        }
        //Sometimes, for some reasons cart_id in product products calculated incorrectle, so we need recalculate it.
        $cart['change_cart_products'] = true;
        fn_calculate_cart_content($cart, $customer_auth);
        $cart['payment_info']['order_status'] = $pp_settings['pp_statuses'][strtolower($data['payment_status'])];
        list($order_id, ) = fn_update_order($cart, $order_id);
        if ($order_id) {
            fn_change_order_status($order_id, $pp_settings['pp_statuses'][strtolower($data['payment_status'])]);
            if (fn_allowed_for('MULTIVENDOR')) {
                $child_order_ids = db_get_fields("SELECT order_id FROM ?:orders WHERE parent_order_id = ?i", $order_id);
                if (!empty($child_order_ids)) {
                    foreach ($child_order_ids as $child_order_id) {
                        fn_update_order_payment_info($child_order_id, $cart['payment_info']);
                    }
                }
            }
        }
        return true;
    }
}
开发者ID:askzap,项目名称:ultimate,代码行数:52,代码来源:func.php

示例12: _fillShoppingCart

 protected function _fillShoppingCart($cartContent)
 {
     if (empty($cartContent['Items'])) {
         return true;
     }
     if (!empty($_SESSION['cart'])) {
         fn_clear_cart($_SESSION['cart']);
     }
     $cart_products = array();
     $cartItems = $cartContent['Items'];
     foreach ($cartItems as $cartItem) {
         $product_id = $cartItem['CartItemId'];
         $item['product_id'] = $product_id;
         $item['amount'] = $cartItem['Count'];
         $cart_products[$product_id] = $item;
     }
     if (!empty($cart_products)) {
         fn_add_product_to_cart($cart_products, $_SESSION['cart'], $_SESSION['auth'], false);
     }
 }
开发者ID:AlekseyChuyan,项目名称:triggmine_cs_cart,代码行数:20,代码来源:integrator.php

示例13: fn_user_logout

/**
 * @param array $auth
 */
function fn_user_logout($auth)
{
    // Regenerate session_id for security reasons
    fn_save_cart_content($_SESSION['cart'], $auth['user_id']);
    Session::regenerateId();
    fn_init_user();
    $auth = $_SESSION['auth'];
    if (!empty($auth['user_id'])) {
        fn_log_user_logout($auth);
    }
    unset($_SESSION['auth']);
    fn_clear_cart($_SESSION['cart'], false, true);
    fn_delete_session_data(AREA . '_user_id', AREA . '_password');
    unset($_SESSION['product_notifications']);
    fn_login_user();
    // need to fill $_SESSION['auth'] array for anonymous user
}
开发者ID:askzap,项目名称:ultimate,代码行数:20,代码来源:fn.users.php

示例14: fn_user_logout

/**
 * @param array $auth
 */
function fn_user_logout($auth)
{
    // Regenerate session_id for security reasons
    fn_save_cart_content(Tygh::$app['session']['cart'], $auth['user_id']);
    Tygh::$app['session']->regenerateID();
    fn_init_user();
    $auth = Tygh::$app['session']['auth'];
    if (!empty($auth['user_id'])) {
        fn_log_user_logout($auth);
    }
    unset(Tygh::$app['session']['auth']);
    fn_clear_cart(Tygh::$app['session']['cart'], false, true);
    fn_delete_session_data(AREA . '_user_id', AREA . '_password');
    unset(Tygh::$app['session']['product_notifications']);
    fn_login_user();
    // need to fill Tygh::$app['session']['auth'] array for anonymous user
    /**
     * Allows to perform any actions after user logout.
     *
     * @param array $auth Auth data from session
     */
    fn_set_hook('user_logout_after', $auth);
}
开发者ID:ambient-lounge,项目名称:site,代码行数:26,代码来源:fn.users.php

示例15: fn_process_epayph_ipn

function fn_process_epayph_ipn($order_id, $data)
{
    $order_info = fn_get_order_info($order_id);
    if (!empty($order_info) && !empty($data['txn_id']) && (empty($order_info['payment_info']['txn_id']) || $data['payment_status'] != 'Completed' || $data['payment_status'] == 'Completed' && $order_info['payment_info']['txn_id'] !== $data['txn_id'])) {
        //Can't check refund transactions.
        if (isset($data['txn_type']) && !fn_validate_epayph_order_info($data, $order_info)) {
            return false;
        }
        $pp_settings = fn_get_epayph_settings();
        $data['payment_status'] = strtolower($data['payment_status']);
        fn_clear_cart($cart, true);
        $customer_auth = fn_fill_auth(array(), array(), false, 'C');
        fn_form_cart($order_id, $cart, $customer_auth);
        if ($pp_settings['override_customer_info'] == 'Y') {
            $cart['user_data'] = fn_epayph_get_customer_info($data);
        }
        $cart['order_id'] = $order_id;
        $cart['payment_info'] = $order_info['payment_info'];
        $cart['payment_info']['protection_eligibility'] = !empty($data['protection_eligibility']) ? $data['protection_eligibility'] : '';
        $cart['payment_id'] = $order_info['payment_id'];
        if (!empty($data['memo'])) {
            //Save customer notes
            $cart['notes'] = $data['memo'];
        }
        if ($data['payment_status'] == 'Completed') {
            //save uniq ipn id to avoid double ipn processing
            $cart['payment_info']['txn_id'] = $data['txn_id'];
        }
        fn_calculate_cart_content($cart, $customer_auth);
        list($order_id, ) = fn_update_order($cart, $order_id);
        if ($order_id) {
            $send_notification = $order_info['status'] == $pp_settings['pp_statuses'][$data['payment_status']] ? false : array();
            $short_order_data = fn_get_order_short_info($order_id);
            fn_change_order_status($order_id, $pp_settings['pp_statuses'][$data['payment_status']], $short_order_data['status'], $send_notification);
        }
        return true;
    }
}
开发者ID:Neuralink,项目名称:epayph_cscart,代码行数:38,代码来源:func.php


注:本文中的fn_clear_cart函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。