Ejemplo n.º 1
0
 /**
  * wpsc_checkout method, gets the tax rate as a percentage, based on the selected country and region
  * @access public
  */
 function wpsc_checkout($checkout_set = 0)
 {
     global $wpdb;
     $this->checkout_items = $wpdb->get_results($wpdb->prepare("SELECT * FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `active` = '1'  AND `checkout_set`= %s ORDER BY `checkout_order`;", $checkout_set));
     $GLOBALS['wpsc_checkout_error_messages'] = wpsc_get_customer_meta('checkout_error_messages');
     $GLOBALS['wpsc_gateway_error_messages'] = wpsc_get_customer_meta('gateway_error_messages');
     $GLOBALS['wpsc_registration_error_messages'] = wpsc_get_customer_meta('registration_error_messages');
     $GLOBALS['wpsc_customer_checkout_details'] = apply_filters('wpsc_get_customer_checkout_details', wpsc_get_customer_meta('checkout_details'));
     // legacy filter
     if (is_user_logged_in()) {
         $GLOBALS['wpsc_customer_checkout_details'] = apply_filters('wpsc_checkout_user_profile_get', $GLOBALS['wpsc_customer_checkout_details'], get_current_user_id());
     }
     if (!is_array($GLOBALS['wpsc_customer_checkout_details'])) {
         $GLOBALS['wpsc_customer_checkout_details'] = array();
     }
     $category_list = wpsc_cart_item_categories(true);
     $additional_form_list = array();
     foreach ($category_list as $category_id) {
         $additional_form_list[] = wpsc_get_categorymeta($category_id, 'use_additional_form_set');
     }
     if (function_exists('wpsc_get_ticket_checkout_set')) {
         $checkout_form_fields_id = array_search(wpsc_get_ticket_checkout_set(), $additional_form_list);
         unset($additional_form_list[$checkout_form_fields_id]);
     }
     if (count($additional_form_list) > 0) {
         $this->category_checkout_items = $wpdb->get_results("SELECT * FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `active` = '1'  AND `checkout_set` IN ('" . implode("','", $additional_form_list) . "') ORDER BY `checkout_set`, `checkout_order`;");
         $this->checkout_items = array_merge((array) $this->checkout_items, (array) $this->category_checkout_items);
     }
     if (function_exists('wpsc_get_ticket_checkout_set')) {
         $sql = "SELECT * FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `active` = '1'  AND `checkout_set`='" . wpsc_get_ticket_checkout_set() . "' ORDER BY `checkout_order`;";
         $this->additional_fields = $wpdb->get_results($sql);
         $count = wpsc_ticket_checkoutfields();
         $j = 1;
         $fields = $this->additional_fields;
         $this->formfield_count = count($fields) + $this->checkout_item_count;
         while ($j < $count) {
             $this->additional_fields = array_merge((array) $this->additional_fields, (array) $fields);
             $j++;
         }
         if (wpsc_ticket_checkoutfields() > 0) {
             $this->checkout_items = array_merge((array) $this->checkout_items, (array) $this->additional_fields);
         }
     }
     $this->checkout_items = apply_filters('wpsc_checkout_fields', $this->checkout_items, $this);
     $this->checkout_item_count = count($this->checkout_items);
 }
Ejemplo n.º 2
0
 /**
  * wpsc_checkout method, gets the tax rate as a percentage, based on the selected country and region
  * @access public
  */
 function wpsc_checkout($checkout_set = 0)
 {
     global $wpdb;
     $this->checkout_items = $wpdb->get_results("SELECT * FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `active` = '1'  AND `checkout_set`='" . $checkout_set . "' ORDER BY `checkout_order`;");
     $category_list = wpsc_cart_item_categories(true);
     $additional_form_list = array();
     foreach ($category_list as $category_id) {
         $additional_form_list[] = wpsc_get_categorymeta($category_id, 'use_additonal_form_set');
     }
     if (function_exists('wpsc_get_ticket_checkout_set')) {
         $checkout_form_fields_id = array_search(wpsc_get_ticket_checkout_set(), $additional_form_list);
         unset($additional_form_list[$checkout_form_fields_id]);
     }
     if (count($additional_form_list) > 0) {
         $this->category_checkout_items = $wpdb->get_results("SELECT * FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `active` = '1'  AND `checkout_set` IN ('" . implode("','", $additional_form_list) . "') ORDER BY `checkout_set`, `checkout_order`;");
         $this->checkout_items = array_merge((array) $this->checkout_items, (array) $this->category_checkout_items);
     }
     if (function_exists('wpsc_get_ticket_checkout_set')) {
         $sql = "SELECT * FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `active` = '1'  AND `checkout_set`='" . wpsc_get_ticket_checkout_set() . "' ORDER BY `checkout_order`;";
         $this->additional_fields = $wpdb->get_results($sql);
         $count = wpsc_ticket_checkoutfields();
         $j = 1;
         $fields = $this->additional_fields;
         $this->formfield_count = count($fields) + $this->checkout_item_count;
         while ($j < $count) {
             $this->additional_fields = array_merge((array) $this->additional_fields, (array) $fields);
             $j++;
         }
         if (wpsc_ticket_checkoutfields() > 0) {
             $this->checkout_items = array_merge((array) $this->checkout_items, (array) $this->additional_fields);
         }
     }
     $this->checkout_item_count = count($this->checkout_items);
 }