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


PHP WPSC_Purchase_Log::get方法代码示例

本文整理汇总了PHP中WPSC_Purchase_Log::get方法的典型用法代码示例。如果您正苦于以下问题:PHP WPSC_Purchase_Log::get方法的具体用法?PHP WPSC_Purchase_Log::get怎么用?PHP WPSC_Purchase_Log::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WPSC_Purchase_Log的用法示例。


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

示例1: _wpsc_filter_merchant_v2_payment_method_form_fields

function _wpsc_filter_merchant_v2_payment_method_form_fields($fields)
{
    $selected_value = isset($_POST['wpsc_payment_method']) ? $_POST['wpsc_payment_method'] : '';
    if (empty($selected_value)) {
        $current_purchase_log_id = wpsc_get_customer_meta('current_purchase_log_id');
        $purchase_log = new WPSC_Purchase_Log($current_purchase_log_id);
        $selected_value = $purchase_log->get('gateway');
    }
    $gateways = _wpsc_merchant_v2_get_active_gateways();
    if (empty($gateways)) {
        return $fields;
    }
    foreach (_wpsc_merchant_v2_get_active_gateways() as $gateway) {
        $gateway = (object) $gateway;
        $title = $gateway->name;
        if (!empty($gateway->image)) {
            $title .= ' <img src="' . $gateway->image . '" alt="' . $gateway->name . '" />';
        }
        $field = array('title' => $title, 'type' => 'radio', 'value' => $gateway->internalname, 'name' => 'wpsc_payment_method', 'checked' => $selected_value == $gateway->internalname);
        $fields[] = $field;
    }
    // check the first payment gateway by default
    if (empty($selected_value)) {
        $fields[0]['checked'] = true;
    }
    return $fields;
}
开发者ID:benhuson,项目名称:WP-e-Commerce,代码行数:27,代码来源:checkout.php

示例2: save_attendee_meta_to_ticket

 /**
  * Sets attendee data on attendee posts
  *
  * @since 4.1
  *
  * @param int $attendee_id Attendee Ticket Post ID
  * @param WPSC_Purchase_Log $purchase_log WPEC purchase log object
  * @param int $product_id WPEC Product ID
  * @param int $order_attendee_id Attendee number in submitted order
  */
 public function save_attendee_meta_to_ticket($attendee_id, $purchase_log, $product_id, $order_attendee_id)
 {
     $meta = wpsc_get_purchase_meta($purchase_log->get('id'), Tribe__Tickets_Plus__Meta::META_KEY, true);
     if (!isset($meta[$product_id])) {
         return;
     }
     if (!isset($meta[$product_id][$order_attendee_id])) {
         return;
     }
     update_post_meta($attendee_id, Tribe__Tickets_Plus__Meta::META_KEY, $meta[$product_id][$order_attendee_id]);
 }
开发者ID:TakenCdosG,项目名称:chefs,代码行数:21,代码来源:Meta.php

示例3: is_valid_ipn_response

 public function is_valid_ipn_response()
 {
     $valid = true;
     // Validate Currency
     if ($this->paypal_ipn_values['mc_currency'] !== $this->get_paypal_currency_code()) {
         $valid = false;
     }
     $purchase_log = new WPSC_Purchase_Log($this->cart_data['session_id'], 'sessionid');
     if (!$purchase_log->exists()) {
         $valid = false;
     }
     // Validate amount
     // It is worth noting, there are edge cases here that may need to be addressed via filter.
     // @link https://github.com/wp-e-commerce/WP-e-Commerce/issues/1232.
     if ($this->paypal_ipn_values['mc_gross'] != $this->convert($purchase_log->get('totalprice'))) {
         $valid = false;
     }
     return apply_filters('wpsc_paypal_standard_is_valid_ipn_response', $valid, $this);
 }
开发者ID:ashik968,项目名称:digiplot,代码行数:19,代码来源:paypal-standard.merchant.php

示例4: wpsc_free_checkout_update_processed_status

/**
 * Updates the 'processed' parameter after a new order is submitted with a free cart.
 *
 * @param  string            $gateway  Name of gateway.  In the case of a free cart, this will be empty.
 * @param  WPSC_Purchase_Log $log      WPSC_Purchase_Log object.
 * @uses   apply_filters               'wpsc_free_checkout_order_status' allows developers to change the status a free cart is saved with.
 * @since  3.9.0
 *
 */
function wpsc_free_checkout_update_processed_status($gateway, $log)
{
    wpsc_update_purchase_log_status($log->get('id'), apply_filters('wpsc_free_checkout_order_status', WPSC_Purchase_Log::ACCEPTED_PAYMENT));
    wp_safe_redirect(add_query_arg('sessionid', $log->get('sessionid'), get_option('transact_url')));
    exit;
}
开发者ID:parkesma,项目名称:WP-e-Commerce,代码行数:15,代码来源:cart-template-api.php

示例5: get_active_shipping

 private function get_active_shipping()
 {
     if (is_null($this->ids)) {
         $this->get_all_quotes();
     }
     $current_purchase_log_id = wpsc_get_customer_meta('current_purchase_log_id');
     $purchase_log = new WPSC_Purchase_Log($current_purchase_log_id);
     $module = $purchase_log->get('shipping_method');
     $option = $purchase_log->get('shipping_option');
     if (empty($module) || empty($option)) {
         $this->active_shipping_id = '';
         $this->active_shipping_option = '';
         $this->active_shipping_module = '';
         return;
     }
     $this->active_shipping_id = $this->ids[$module][$option];
     $this->active_shipping_option = $option;
     $this->active_shipping_module = $module;
 }
开发者ID:ashik968,项目名称:digiplot,代码行数:19,代码来源:shipping-calculator.php

示例6: callback_shortcut_process

 /**
  * ExpressCheckout Shortcut Callback
  *
  * @return int
  */
 public function callback_shortcut_process()
 {
     if (!isset($_GET['payment_gateway'])) {
         return;
     }
     $payment_gateway = $_GET['payment_gateway'];
     global $wpsc_cart;
     //	Create a new PurchaseLog Object
     $purchase_log = new WPSC_Purchase_Log();
     // Create a Sessionid
     $sessionid = mt_rand(100, 999) . time();
     wpsc_update_customer_meta('checkout_session_id', $sessionid);
     $purchase_log->set(array('user_ID' => get_current_user_id(), 'date' => time(), 'plugin_version' => WPSC_VERSION, 'statusno' => '0', 'sessionid' => $sessionid));
     if (wpsc_is_tax_included()) {
         $tax = $wpsc_cart->calculate_total_tax();
         $tax_percentage = $wpsc_cart->tax_percentage;
     } else {
         $tax = 0;
         $tax_percentage = 0;
     }
     $purchase_log->set(array('wpec_taxes_total' => $tax, 'wpec_taxes_rate' => $tax_percentage));
     // Save the purchase_log object to generate it's id
     $purchase_log->save();
     $purchase_log_id = $purchase_log->get('id');
     $wpsc_cart->log_id = $purchase_log_id;
     wpsc_update_customer_meta('current_purchase_log_id', $purchase_log_id);
     $purchase_log->set(array('gateway' => $payment_gateway, 'base_shipping' => $wpsc_cart->calculate_base_shipping(), 'totalprice' => $wpsc_cart->calculate_total_price()));
     $purchase_log->save();
     $wpsc_cart->empty_db($purchase_log_id);
     $wpsc_cart->save_to_db($purchase_log_id);
     $wpsc_cart->submit_stock_claims($purchase_log_id);
     // Save an empty Form
     $form = WPSC_Checkout_Form::get();
     $fields = $form->get_fields();
     WPSC_Checkout_Form_Data::save_form($purchase_log, $fields);
     // Return Customer to Review Order Page if there is Shipping
     add_filter('wpsc_paypal_express_checkout_transact_url', array(&$this, 'review_order_url'));
     add_filter('wpsc_paypal_express_checkout_return_url', array(&$this, 'review_order_callback'));
     // Set a Temporary Option for EC Shortcut
     wpsc_update_customer_meta('esc-' . $sessionid, true);
     // Apply Checkout Actions
     do_action('wpsc_submit_checkout', array('purchase_log_id' => $purchase_log_id, 'our_user_id' => get_current_user_id()));
     do_action('wpsc_submit_checkout_gateway', $payment_gateway, $purchase_log);
     return $sessionid;
 }
开发者ID:benhuson,项目名称:WP-e-Commerce,代码行数:50,代码来源:paypal-express-checkout.php

示例7: wpsc_submit_checkout

/**
 * submit checkout function, used through ajax and in normal page loading.
 * No parameters, returns nothing
 */
function wpsc_submit_checkout($collected_data = true)
{
    global $wpdb, $wpsc_cart, $user_ID, $nzshpcrt_gateways, $wpsc_shipping_modules, $wpsc_gateways;
    $num_items = 0;
    $use_shipping = 0;
    $disregard_shipping = 0;
    do_action('wpsc_before_submit_checkout');
    $error_messages = wpsc_get_customer_meta('checkout_misc_error_messages');
    if (!is_array($error_messages)) {
        $error_messages = array();
    }
    $wpsc_checkout = new wpsc_checkout();
    $selected_gateways = get_option('custom_gateway_options');
    $submitted_gateway = isset($_POST['custom_gateway']) ? $_POST['custom_gateway'] : '';
    $options = get_option('custom_shipping_options');
    if ($collected_data) {
        $form_validity = $wpsc_checkout->validate_forms();
        extract($form_validity);
        // extracts $is_valid and $error_messages
        if (wpsc_has_tnc() && (!isset($_POST['agree']) || $_POST['agree'] != 'yes')) {
            $error_messages[] = __('Please agree to the terms and conditions, otherwise we cannot process your order.', 'wpsc');
            $is_valid = false;
        }
    } else {
        $is_valid = true;
        $error_messages = array();
    }
    $selectedCountry = $wpdb->get_results($wpdb->prepare("SELECT id, country FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE isocode = '%s' ", wpsc_get_customer_meta('shipping_country')), ARRAY_A);
    foreach ($wpsc_cart->cart_items as $cartitem) {
        if (!empty($cartitem->meta[0]['no_shipping'])) {
            continue;
        }
        $categoriesIDs = $cartitem->category_id_list;
        foreach ((array) $categoriesIDs as $catid) {
            if (is_array($catid)) {
                $countries = wpsc_get_meta($catid[0], 'target_market', 'wpsc_category');
            } else {
                $countries = wpsc_get_meta($catid, 'target_market', 'wpsc_category');
            }
            if (!empty($countries) && !in_array($selectedCountry[0]['id'], (array) $countries)) {
                $errormessage = sprintf(__('%s cannot be shipped to %s. To continue with your transaction please remove this product from the list below.', 'wpsc'), $cartitem->get_title(), $selectedCountry[0]['country']);
                wpsc_update_customer_meta('category_shipping_conflict', $errormessage);
                $is_valid = false;
            }
        }
        //count number of items, and number of items using shipping
        $num_items++;
        if ($cartitem->uses_shipping != 1) {
            $disregard_shipping++;
        } else {
            $use_shipping++;
        }
    }
    if (array_search($submitted_gateway, $selected_gateways) !== false) {
        wpsc_update_customer_meta('selected_gateway', $submitted_gateway);
    } else {
        $is_valid = false;
    }
    if ($collected_data) {
        if (get_option('do_not_use_shipping') == 0 && ($wpsc_cart->selected_shipping_method == null || $wpsc_cart->selected_shipping_option == null) && $num_items != $disregard_shipping) {
            $error_messages[] = __('You must select a shipping method, otherwise we cannot process your order.', 'wpsc');
            $is_valid = false;
        }
        if (get_option('do_not_use_shipping') != 1 && in_array('ups', (array) $options) && !wpsc_get_customer_meta('shipping_zip') && $num_items != $disregard_shipping) {
            wpsc_update_customer_meta('category_shipping_conflict', __('Please enter a Zipcode and click calculate to proceed', 'wpsc'));
            $is_valid = false;
        }
    }
    wpsc_update_customer_meta('checkout_misc_error_messages', $error_messages);
    if ($is_valid == true) {
        wpsc_delete_customer_meta('category_shipping_conflict');
        // check that the submitted gateway is in the list of selected ones
        $sessionid = mt_rand(100, 999) . time();
        wpsc_update_customer_meta('checkout_session_id', $sessionid);
        $subtotal = $wpsc_cart->calculate_subtotal();
        if ($wpsc_cart->has_total_shipping_discount() == false) {
            $base_shipping = $wpsc_cart->calculate_base_shipping();
        } else {
            $base_shipping = 0;
        }
        $delivery_country = $wpsc_cart->delivery_country;
        $delivery_region = $wpsc_cart->delivery_region;
        if (wpsc_uses_shipping()) {
            $shipping_method = $wpsc_cart->selected_shipping_method;
            $shipping_option = $wpsc_cart->selected_shipping_option;
        } else {
            $shipping_method = '';
            $shipping_option = '';
        }
        if (isset($_POST['how_find_us'])) {
            $find_us = $_POST['how_find_us'];
        } else {
            $find_us = '';
        }
        //keep track of tax if taxes are exclusive
        $wpec_taxes_controller = new wpec_taxes_controller();
//.........这里部分代码省略.........
开发者ID:pankajsinghjarial,项目名称:SYLC,代码行数:101,代码来源:ajax.functions.php

示例8:

 /**
  * set_authcode, generaly speaking a payment gateway gives you an authcode to be able to refer back to the transaction
  * if an authcode already exsits, you can either append another (2931932839|29391839482) or replace depending on the $append flag
  * @param string $authcode
  * @param bool   $append
  * @return bool  result
  */
 function set_authcode($authcode, $append = false)
 {
     $log = new WPSC_Purchase_Log($this->purchase_id);
     $current_authcode = $log->get('authcode');
     if ($append && !empty($current_authcode)) {
         $authcode = $current_authcode . '|' . $authcode;
     }
     return $log->set('authcode', $authcode)->save();
 }
开发者ID:benhuson,项目名称:WP-e-Commerce,代码行数:16,代码来源:merchant.class.php

示例9: save_form

 /**
  * Save Submitted Form Fields to the wpsc_submited_form_data table.
  *
  * @param WPSC_Purchase_Log $purchase_log
  * @param array $fields
  * @return void
  */
 public static function save_form($purchase_log, $fields, $data = array())
 {
     global $wpdb;
     $log_id = $purchase_log->get('id');
     // delete previous field values
     $sql = $wpdb->prepare("DELETE FROM " . WPSC_TABLE_SUBMITTED_FORM_DATA . " WHERE log_id = %d", $log_id);
     $wpdb->query($sql);
     if (empty($data) && isset($_POST['wpsc_checkout_details'])) {
         $data = $_POST['wpsc_checkout_details'];
     }
     $customer_details = array();
     foreach ($fields as $field) {
         if ($field->type == 'heading') {
             continue;
         }
         $value = '';
         if (isset($data[$field->id])) {
             $value = wp_unslash($data[$field->id]);
         }
         $customer_details[$field->id] = $value;
         $wpdb->insert(WPSC_TABLE_SUBMITTED_FORM_DATA, array('log_id' => $log_id, 'form_id' => $field->id, 'value' => $value), array('%d', '%d', '%s'));
     }
     wpsc_save_customer_details($customer_details);
 }
开发者ID:PhanHaHus,项目名称:wordpress,代码行数:31,代码来源:checkout-form-data.class.php

示例10: sales_data_postback

 public static function sales_data_postback()
 {
     if (!isset($_REQUEST['sales_data'])) {
         return;
     }
     $data = json_decode(stripslashes($_POST['data']));
     $cart_contents = json_decode(stripslashes($_POST['cart_contents']));
     //Unset purchase log ID, since we're inserting a new one.
     $data = (array) $data;
     unset($data['id']);
     $purchase_log = new WPSC_Purchase_Log($data);
     $purchase_log->save();
     $purchase_log_id = $purchase_log->get('id');
     global $wpdb;
     //We need to update the proper product ID, name and purchase ID
     foreach ($cart_contents as $cart_item) {
         $product = new WP_Query(array('post_type' => 'wpsc-product', 'pagename' => $cart_item->slug));
         $product = $product->get_posts();
         $product = $product[0];
         $cart_item = (array) $cart_item;
         unset($cart_item['id']);
         unset($cart_item['slug']);
         $cart_item['prodid'] = $product->ID;
         $cart_item['name'] = $product->post_title;
         $cart_item['purchaseid'] = $purchase_log_id;
         $wpdb->insert(WPSC_TABLE_CART_CONTENTS, $cart_item);
     }
     die;
 }
开发者ID:VanessaGarcia-Freelance,项目名称:ButtonHut,代码行数:29,代码来源:Sputnik.php

示例11: add_pushes

 public function add_pushes($session_id)
 {
     $purchase = new WPSC_Purchase_Log($session_id, 'sessionid');
     $purchase_id = $purchase->get('id');
     $data = new WPSC_Checkout_Form_Data($purchase_id);
     $output = '';
     $city = $data->get('billingcity');
     $state = $data->get('billingstate');
     $country = $data->get('billingcountry');
     $state = !empty($state) ? wpsc_get_state_by_id($state, 'name') : '';
     $cart_items = $purchase->get_cart_contents();
     $total_shipping = wpsc_get_total_shipping($purchase_id);
     $total_tax = $total_price = 0;
     foreach ($cart_items as $item) {
         /* For backwards compatibility, convert objects to arrays */
         $item = (array) $item;
         $total_tax += $item['tax_charged'];
         $total_price += absint($item['quantity']) * $item['price'];
     }
     if ($this->is_theme_tracking || $this->advanced_code) {
         $output .= "<script type='text/javascript'>\n\r";
     }
     add_filter('wpsc_toggle_display_currency_code', array($this, 'remove_currency_and_html'));
     if ($this->use_universal_analytics()) {
         // Yoast GA Plugin switched to it's own object name __gaTracker - assign it to our ga object if it exists
         $output .= "var ga = typeof ga === 'undefined' && typeof __gaTracker !== 'undefined' ? __gaTracker : ga;";
         $output .= "ga('require', 'ecommerce');\n\r";
         $output .= "ga('ecommerce:addTransaction', {\n\t\t\t\t'id': '" . $purchase_id . "',                                               // Transaction ID. Required.\n\t\t\t\t'affiliation': '" . wp_specialchars_decode($this->get_site_name()) . "',  // Affiliation or store name.\n\t\t\t\t'revenue': '" . number_format($total_price, 2, '.', '') . "',             // Grand Total.\n\t\t\t\t'shipping': '" . wpsc_currency_display($total_shipping) . "',             // Shipping.\n\t\t\t\t'tax': '" . wpsc_currency_display($total_tax) . "'                        // Tax.\n\t\t\t});\n\r";
     } else {
         $output .= "\n\t\t\t\t_gaq.push(['_addTrans',\n\t\t\t\t'" . $purchase_id . "',                                     // order ID - required\n\t\t\t\t'" . wp_specialchars_decode($this->get_site_name()) . "', // affiliation or store name\n\t\t\t\t'" . number_format($total_price, 2, '.', '') . "',   // total - required\n\t\t\t\t'" . wpsc_currency_display($total_tax) . "',              // tax\n\t\t\t\t'" . wpsc_currency_display($total_shipping) . "',         // shipping\n\t\t\t\t'" . wp_specialchars_decode($city) . "',                  // city\n\t\t\t\t'" . wp_specialchars_decode($state) . "',                 // state or province\n\t\t\t\t'" . wp_specialchars_decode($country) . "'                // country\n\t\t\t]);\n\r";
     }
     remove_filter('wpsc_toggle_display_currency_code', array($this, 'remove_currency_and_html'));
     foreach ($cart_items as $item) {
         /* For backwards compatibility, convert objects to arrays */
         $item = (array) $item;
         $category = wp_get_object_terms($item['prodid'], 'wpsc_product_category', array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'all_with_object_id'));
         $item['sku'] = get_post_meta($item['prodid'], '_wpsc_sku', true);
         if (empty($item['sku'])) {
             $item['sku'] = $item['prodid'];
         }
         if ($category) {
             $item['category'] = $category[0]->name;
         } else {
             $item['category'] = '';
         }
         $item = apply_filters('wpsc_google_analytics_pushed_product', array_map('wp_specialchars_decode', $item), $item, $this);
         if ($this->use_universal_analytics()) {
             $output .= "ga('ecommerce:addItem', {" . "'id': '" . $purchase_id . "'," . "'name': '" . $item['name'] . "'," . "'sku': '" . $item['sku'] . "'," . "'category': '" . $item['category'] . "'," . "'price': '" . $item['price'] . "'," . "'quantity': '" . $item['quantity'] . "'" . "});\n\r";
         } else {
             $output .= "_gaq.push(['_addItem'," . "'" . $purchase_id . "'," . "'" . $item['sku'] . "'," . "'" . $item['name'] . "'," . "'" . $item['category'] . "'," . "'" . $item['price'] . "'," . "'" . $item['quantity'] . "']);\n\r";
             // Item Quantity
         }
     }
     if ($this->use_universal_analytics()) {
         $output .= "ga('ecommerce:send');\n\r";
     } else {
         $output .= "_gaq.push(['_trackTrans']);\n\r";
     }
     if ($this->is_theme_tracking || $this->advanced_code) {
         $output .= "</script>\n\r";
     }
     return $output;
 }
开发者ID:ashik968,项目名称:digiplot,代码行数:63,代码来源:google-analytics.class.php

示例12: completed_order

 /**
  * Adds product properties to analytics.track() when the order is completed successfully.
  *
  * @since  1.0.0
  * @access public
  *
  * @uses  func_get_args() Because our abstract class doesn't know how many parameters are passed to each hook
  *                        for each different platform, we use func_get_args().
  *
  * @return array Filtered array of name and properties for analytics.track().
  */
 public function completed_order()
 {
     $args = func_get_args();
     $track = $args[0];
     if (did_action('wpsc_transaction_results_shutdown') && isset($_GET['sessionid'])) {
         $log = new WPSC_Purchase_Log($_GET['sessionid'], 'sessionid');
         /* We like checking is_order_received(), as that's what the manual payment gateway uses. */
         if ($log->is_transaction_completed() || $log->is_order_received()) {
             $gateway_data = $log->get_gateway_data();
             $items = $log->get_cart_contents();
             $products = array();
             foreach ($items as $item) {
                 $product = array('id' => $item->prodid, 'sku' => wpsc_product_sku($item->prodid), 'name' => $item->name, 'price' => $item->price, 'quantity' => $item->quantity, 'category' => implode(', ', wp_list_pluck(wpsc_get_product_terms($item->prodid, 'wpsc_product_category'), 'name')));
                 $products[] = $product;
             }
             $track = array('event' => __('Completed Order', 'segment'), 'properties' => array('id' => $log->get('id'), 'total' => $log->get('totalprice'), 'revenue' => $gateway_data['subtotal'], 'shipping' => $gateway_data['shipping'], 'tax' => $gateway_data['tax'], 'products' => $products));
         }
     }
     return $track;
 }
开发者ID:qfrery,项目名称:analytics-wordpress,代码行数:31,代码来源:wp-e-commerce.php

示例13: cph_wpsc_user_purchases

function cph_wpsc_user_purchases($purchase_ids)
{
    global $wpdb;
    global $purchlogitem;
    $i = 0;
    $col_count = 4;
    //do_action( 'wpsc_pre_purchase_logs' );
    foreach ($purchase_ids as $purchase_id) {
        $alternate = "";
        $alternate_style = "";
        $i++;
        $purchlogitem = new wpsc_purchaselogs_items($purchase_id);
        //cph_purchase_log_cart_items();
        if ($i % 2 != 0) {
            $alternate = 'class="header-row alt"';
        }
        $alternate_style = 'style = "background: lightgray; font-weight: bold;"';
        $purchase_log = new WPSC_Purchase_Log($purchase_id);
        echo "<tr {$alternate} {$alternate_style} >\n\r";
        echo " <td style=\"width:25%;\" class='status processed'>";
        echo '<label>Purchase ID:</label>&nbsp;' . $purchase_id;
        echo " </td>\n\r";
        echo " <td style=\"width:25%;\" class='date'>";
        echo '<label>Date:</label>&nbsp;' . date("jS M Y", $purchase_log->get('date'));
        echo " </td>\n\r";
        echo " <td  style=\"width:25%;\" class='price'>";
        echo '<label>Total:</label>&nbsp;' . wpsc_currency_display($purchase_log->get('totalprice'), array('display_as_html' => false));
        echo " </td>\n\r";
        echo " <td style=\"width:25%;\" class='tracking'>";
        echo $purchase_log->get('track_id');
        echo " </td>\n\r";
        echo "</tr>\n\r";
        echo "<tr>\n\r";
        echo " <td colspan='{$col_count}' class='details'>\n\r";
        echo "  <div>\n\r";
        //cart contents display starts here;
        $cartsql = $wpdb->prepare("SELECT * FROM `" . WPSC_TABLE_CART_CONTENTS . "` WHERE `purchaseid`= %d", $purchase_id);
        $cart_log = $wpdb->get_results($cartsql, ARRAY_A);
        $j = 0;
        if ($cart_log != null) {
            echo "<table class='logdisplay'>";
            echo "<tr class='toprow2'>";
            echo " <th class='details_name'>";
            _e('Item Name', 'wp-e-commerce');
            echo " </th>";
            echo " <th class='details_quantity'>";
            _e('Quantity', 'wp-e-commerce');
            echo " </th>";
            echo " <th class='details_price'>";
            _e('Price', 'wp-e-commerce');
            echo " </th>";
            echo " <th class='details_total'>";
            _e('Total', 'wp-e-commerce');
            echo " </th>";
            echo "</tr>";
            while (wpsc_have_purchaselog_details()) {
                wpsc_the_purchaselog_item();
                $alternate = "";
                $j++;
                if ($j % 2 != 0) {
                    $alternate = "alt";
                }
                echo "<tr class='{$alternate}'>";
                echo " <td class='details_name'>";
                echo wpsc_purchaselog_details_href();
                echo " </td>";
                echo " <td class='details_quantity'>";
                echo wpsc_purchaselog_details_quantity();
                echo " </td>";
                echo " <td class='details_price'>";
                echo wpsc_currency_display(wpsc_purchaselog_details_price());
                echo " </td>";
                echo " <td class='details_total'>";
                echo wpsc_currency_display(wpsc_purchaselog_details_total());
                echo " </td>";
                echo '</tr>';
                echo '<tr>';
                do_action('wpsc_additional_sales_item_info', $purchase_id);
                echo '</tr>';
            }
            echo "</table>";
            echo "<br />";
        }
        echo "  </div>\n\r";
        echo " </td>\n\r";
        echo "</tr>\n\r";
    }
}
开发者ID:JeffPyeBrook,项目名称:custom-purchase-history,代码行数:88,代码来源:custom-purchase-history.php

示例14: wpsc_submit_checkout

/**
 * submit checkout function, used through ajax and in normal page loading.
 * No parameters, returns nothing
 */
function wpsc_submit_checkout($collected_data = true)
{
    global $wpdb, $wpsc_cart, $user_ID, $nzshpcrt_gateways, $wpsc_shipping_modules, $wpsc_gateways;
    if ($collected_data && isset($_POST['collected_data']) && is_array($_POST['collected_data'])) {
        _wpsc_checkout_customer_meta_update($_POST['collected_data']);
    }
    // initialize our checkout status variab;e, we start be assuming
    // checkout is falid, until we find a reason otherwise
    $is_valid = true;
    $num_items = 0;
    $use_shipping = 0;
    $disregard_shipping = 0;
    do_action('wpsc_before_submit_checkout');
    $error_messages = wpsc_get_customer_meta('checkout_misc_error_messages');
    if (!is_array($error_messages)) {
        $error_messages = array();
    }
    $wpsc_checkout = new wpsc_checkout();
    $selected_gateways = get_option('custom_gateway_options');
    $submitted_gateway = isset($_POST['custom_gateway']) ? $_POST['custom_gateway'] : '';
    if ($collected_data) {
        $form_validity = $wpsc_checkout->validate_forms();
        extract($form_validity);
        // extracts $is_valid and $error_messages
        if (wpsc_has_tnc() && (!isset($_POST['agree']) || $_POST['agree'] != 'yes')) {
            $error_messages[] = __('Please agree to the terms and conditions, otherwise we cannot process your order.', 'wpsc');
            $is_valid = false;
        }
    } else {
        $is_valid = true;
        $error_messages = array();
    }
    $wpsc_country = new WPSC_Country(wpsc_get_customer_meta('shippingcountry'));
    $country_id = $wpsc_country->get_id();
    $country_name = $wpsc_country->get_name();
    foreach ($wpsc_cart->cart_items as $cartitem) {
        if (!empty($cartitem->meta[0]['no_shipping'])) {
            continue;
        }
        $categoriesIDs = $cartitem->category_id_list;
        foreach ((array) $categoriesIDs as $catid) {
            if (is_array($catid)) {
                $countries = wpsc_get_meta($catid[0], 'target_market', 'wpsc_category');
            } else {
                $countries = wpsc_get_meta($catid, 'target_market', 'wpsc_category');
            }
            if (!empty($countries) && !in_array($country_id, (array) $countries)) {
                $errormessage = sprintf(__('%s cannot be shipped to %s. To continue with your transaction please remove this product from the list below.', 'wpsc'), $cartitem->get_title(), $country_name);
                wpsc_update_customer_meta('category_shipping_conflict', $errormessage);
                $is_valid = false;
            }
        }
        //count number of items, and number of items using shipping
        $num_items++;
        if ($cartitem->uses_shipping != 1) {
            $disregard_shipping++;
        } else {
            $use_shipping++;
        }
    }
    // check to see if the current gateway is in the list of available gateways
    if (array_search($submitted_gateway, $selected_gateways) !== false) {
        wpsc_update_customer_meta('selected_gateway', $submitted_gateway);
    } else {
        $is_valid = false;
    }
    if ($collected_data) {
        // Test for required shipping information
        if (wpsc_core_shipping_enabled() && $num_items != $disregard_shipping) {
            // for shipping to work we need a method, option and a quote
            if (!$wpsc_cart->shipping_method_selected() || !$wpsc_cart->shipping_quote_selected()) {
                $error_messages[] = __('Please select one of the available shipping options, then we can process your order.', 'wpsc');
                $is_valid = false;
            }
            // if we don't have a valid zip code ( the function also checks if we need it ) we have an error
            if (!wpsc_have_valid_shipping_zipcode()) {
                wpsc_update_customer_meta('category_shipping_conflict', __('Please enter a Zipcode and click calculate to proceed', 'wpsc'));
                $is_valid = false;
            }
        }
    }
    wpsc_update_customer_meta('checkout_misc_error_messages', $error_messages);
    if ($is_valid == true) {
        wpsc_delete_customer_meta('category_shipping_conflict');
        // check that the submitted gateway is in the list of selected ones
        $sessionid = mt_rand(100, 999) . time();
        wpsc_update_customer_meta('checkout_session_id', $sessionid);
        $subtotal = $wpsc_cart->calculate_subtotal();
        if ($wpsc_cart->has_total_shipping_discount() == false) {
            $base_shipping = $wpsc_cart->calculate_base_shipping();
        } else {
            $base_shipping = 0;
        }
        $delivery_country = $wpsc_cart->delivery_country;
        $delivery_region = $wpsc_cart->delivery_region;
        if (wpsc_uses_shipping()) {
//.........这里部分代码省略.........
开发者ID:dreamteam111,项目名称:dreamteam,代码行数:101,代码来源:ajax.php

示例15: import_ipn_data

 private function import_ipn_data()
 {
     global $wpdb;
     $purchase_log = new WPSC_Purchase_Log($this->cart_data['session_id'], 'sessionid');
     if (!$purchase_log->exists()) {
         return;
     }
     // get all active form fields and organize them based on id and unique_name, because we're only
     // importing fields relevant to checkout fields that have unique name
     $form_fields_sql = "SELECT id, unique_name FROM " . WPSC_TABLE_CHECKOUT_FORMS . " WHERE active='1'";
     $form_fields_results = $wpdb->get_results($form_fields_sql);
     $form_fields = array();
     foreach ($form_fields_results as $row) {
         if (!empty($row->unique_name)) {
             $form_fields[$row->id] = $row->unique_name;
         }
     }
     $purchase_log_id = $purchase_log->get('id');
     // this defines how ipn response data will be parsed into checkout field values
     $field_mapping = array('firstname' => 'first_name', 'lastname' => 'last_name', 'country' => 'address_country_code', 'email' => 'payer_email', 'city' => 'address_city', 'address' => 'address_street', 'phone' => 'contact_phone');
     $inserts = array();
     // billing & shipping will get the same values
     foreach (array('billing', 'shipping') as $type) {
         // if the corresponding checkout field is "active", prepare the data array that will
         // get passed into $wpdb->insert()
         foreach ($field_mapping as $key => $value) {
             $unique_name = $type . $key;
             $id = array_search($unique_name, $form_fields);
             if ($id === false || !isset($this->paypal_ipn_values[$value])) {
                 continue;
             }
             $inserts[] = array('log_id' => $purchase_log_id, 'form_id' => $id, 'value' => $this->paypal_ipn_values[$value]);
         }
     }
     // loop through the prepared data array and insert them
     foreach ($inserts as $insert) {
         $wpdb->insert(WPSC_TABLE_SUBMITED_FORM_DATA, $insert, array('%d', '%d', '%s'));
     }
 }
开发者ID:pankajsinghjarial,项目名称:SYLC,代码行数:39,代码来源:paypal-standard.merchant.php


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