當前位置: 首頁>>代碼示例>>PHP>>正文


PHP wpsc_get_meta函數代碼示例

本文整理匯總了PHP中wpsc_get_meta函數的典型用法代碼示例。如果您正苦於以下問題:PHP wpsc_get_meta函數的具體用法?PHP wpsc_get_meta怎麽用?PHP wpsc_get_meta使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了wpsc_get_meta函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: wpsc_get_terms_variation_sort_filter

function wpsc_get_terms_variation_sort_filter($terms)
{
    $new_terms = array();
    $unsorted = array();
    foreach ($terms as $term) {
        if (!is_object($term)) {
            return $terms;
        }
        $term_order = $term->taxonomy == 'wpsc-variation' ? wpsc_get_meta($term->term_id, 'sort_order', 'wpsc_variation') : null;
        $term_order = (int) $term_order;
        // unsorted categories should go to the top of the list
        if ($term_order == 0) {
            $term->sort_order = $term_order;
            $unsorted[] = $term;
            continue;
        }
        while (isset($new_terms[$term_order])) {
            $term_order++;
        }
        $term->sort_order = $term_order;
        $new_terms[$term_order] = $term;
    }
    if (!empty($new_terms)) {
        ksort($new_terms);
    }
    for ($i = count($unsorted) - 1; $i >= 0; $i--) {
        array_unshift($new_terms, $unsorted[$i]);
    }
    return array_values($new_terms);
}
開發者ID:osuarcher,項目名稱:WP-e-Commerce,代碼行數:30,代碼來源:category.functions.php

示例2: getOrderMeta

 /**
  * getOrderMeta - get the order details from the purchase log meta details
  *
  * @param int $purchase_id purchase number
  * @return mixed purchase log details
  */
 function getOrderMeta($purchase_id)
 {
     $meta_key = '_wpsc_auth_net_status';
     $type = 'wpsc_purchase_log';
     return wpsc_get_meta($purchase_id, $meta_key, $type);
 }
開發者ID:benhuson,項目名稱:Gold-Cart,代碼行數:12,代碼來源:wpec_auth_net.class.php

示例3: wpsc_update_files

function wpsc_update_files()
{
    global $wpdb, $user_ID;
    $product_files = $wpdb->get_results("SELECT * FROM " . WPSC_TABLE_PRODUCT_FILES . "");
    $wpsc_update = WPSC_Update::get_instance();
    foreach ($product_files as $product_file) {
        $wpsc_update->check_timeout();
        $variation_post_ids = array();
        if (!empty($product_file->product_id)) {
            $product_post_id = (int) $wpdb->get_var($wpdb->prepare("SELECT `post_id` FROM `{$wpdb->postmeta}` WHERE meta_key = %s AND `meta_value` = %d LIMIT 1", '_wpsc_original_id', $product_file->product_id));
        } else {
            $product_post_id = (int) $wpdb->get_var("SELECT `id` FROM " . WPSC_TABLE_PRODUCT_LIST . " WHERE file=" . $product_file->id);
            $product_post_id = (int) $wpdb->get_var($wpdb->prepare("SELECT `post_id` FROM `{$wpdb->postmeta}` WHERE meta_key = %s AND `meta_value` = %d LIMIT 1", '_wpsc_original_id', $product_post_id));
        }
        $variation_items = $wpdb->get_col("SELECT `id` FROM " . WPSC_TABLE_VARIATION_PROPERTIES . " WHERE `file` = '{$product_file->id}'");
        if (count($variation_items) > 0) {
            $variation_post_ids = $wpdb->get_col("SELECT `post_id` FROM `{$wpdb->postmeta}` WHERE meta_key = '_wpsc_original_variation_id' AND `meta_value` IN(" . implode(", ", $variation_items) . ")");
        }
        $attachment_template = array('post_mime_type' => $product_file->mimetype, 'post_title' => $product_file->filename, 'post_name' => $product_file->idhash, 'post_content' => '', 'post_parent' => $product_post_id, 'post_type' => "wpsc-product-file", 'post_status' => 'inherit');
        $file_id = wpsc_get_meta($product_file->id, '_new_file_id', 'wpsc_files');
        if ($file_id == null && count($variation_post_ids) == 0) {
            $file_data = $attachment_template;
            $file_data['post_parent'] = $product_post_id;
            $new_file_id = wp_insert_post($file_data);
            wpsc_update_meta($product_file->id, '_new_file_id', $new_file_id, 'wpsc_files');
        }
        if (count($variation_post_ids) > 0) {
            foreach ($variation_post_ids as $variation_post_id) {
                $old_file_id = get_product_meta($variation_post_id, 'old_file_id', true);
                if ($old_file_id == null) {
                    $file_data = $attachment_template;
                    $file_data['post_parent'] = $variation_post_id;
                    $new_file_id = wp_insert_post($file_data);
                    update_product_meta($variation_post_id, 'old_file_id', $product_file->id, 'wpsc_files');
                }
            }
        }
        if (!empty($product_file->preview)) {
            $preview_template = array('post_mime_type' => $product_file->preview_mimetype, 'post_title' => $product_file->preview, 'post_name' => $product_file->filename, 'post_content' => '', 'post_parent' => $new_file_id, 'post_type' => "wpsc-product-preview", 'post_status' => 'inherit');
            wp_insert_post($preview_template);
        }
    }
    $download_ids = $wpdb->get_col("SELECT `id` FROM " . WPSC_TABLE_DOWNLOAD_STATUS . "");
    foreach ($download_ids as $download_id) {
        if (wpsc_get_meta($download_id, '_is_legacy', 'wpsc_downloads') !== 'false') {
            wpsc_update_meta($download_id, '_is_legacy', 'true', 'wpsc_downloads');
        }
    }
}
開發者ID:ashik968,項目名稱:digiplot,代碼行數:49,代碼來源:updating-functions.php

示例4: get

 /**
  * returns a country's property matching the key, either a well know property or a property defined elsewhere
  *
  * @access public
  *
  * @since 3.8.14
  *
  * @return varies 	value of the property. Returns NULL for nonexistent property.
  */
 public function get($key)
 {
     $property_name = '_' . $key;
     if (property_exists($this, $property_name)) {
         $value = $this->{$property_name};
     } else {
         $value = wpsc_get_meta($this->_id, $key, __CLASS__);
     }
     return apply_filters('wpsc_country_get_property', $value, $key, $this);
 }
開發者ID:VanessaGarcia-Freelance,項目名稱:ButtonHut,代碼行數:19,代碼來源:wpsc-country.class.php

示例5: wpsc_submit_checkout

/**
 * submit checkout function, used through ajax and in normal page loading.
 * No parameters, returns nothing
 */
function wpsc_submit_checkout()
{
    global $wpdb, $wpsc_cart, $user_ID, $nzshpcrt_gateways, $wpsc_shipping_modules, $wpsc_gateways;
    $num_items = 0;
    $use_shipping = 0;
    $disregard_shipping = 0;
    $_SESSION['wpsc_checkout_misc_error_messages'] = array();
    $wpsc_checkout = new wpsc_checkout();
    $selected_gateways = get_option('custom_gateway_options');
    $submitted_gateway = $_POST['custom_gateway'];
    $options = get_option('custom_shipping_options');
    $form_validity = $wpsc_checkout->validate_forms();
    extract($form_validity);
    // extracts $is_valid and $error_messages
    if ($_POST['agree'] != 'yes') {
        $_SESSION['wpsc_checkout_misc_error_messages'][] = __('Please agree to the terms and conditions, otherwise we cannot process your order.', 'wpsc');
        $is_valid = false;
    }
    $selectedCountry = $wpdb->get_results("SELECT id, country FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE isocode='" . $wpdb->escape($_SESSION['wpsc_delivery_country']) . "'", ARRAY_A);
    foreach ($wpsc_cart->cart_items as $cartitem) {
        if ($cartitem->meta[0]['no_shipping'] == 1) {
            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->product_name, $selectedCountry[0]['country']);
                $_SESSION['categoryAndShippingCountryConflict'] = $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) {
        $_SESSION['wpsc_previous_selected_gateway'] = $submitted_gateway;
    } else {
        $is_valid = false;
    }
    if (get_option('do_not_use_shipping') == 0 && ($wpsc_cart->selected_shipping_method == null || $wpsc_cart->selected_shipping_option == null) && $num_items != $disregard_shipping) {
        $_SESSION['wpsc_checkout_misc_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) && $_SESSION['wpsc_zipcode'] == '' && $num_items != $disregard_shipping) {
        $_SESSION['categoryAndShippingCountryConflict'] = __('Please enter a Zipcode and click calculate to proceed', 'wpsc');
        $is_valid = false;
    }
    if ($is_valid == true) {
        $_SESSION['categoryAndShippingCountryConflict'] = '';
        // check that the submitted gateway is in the list of selected ones
        $sessionid = mt_rand(100, 999) . time();
        $_SESSION['wpsc_sessionid'] = $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();
        if (!$wpec_taxes_controller->wpec_taxes_isincluded()) {
            $tax = $wpsc_cart->calculate_total_tax();
            $tax_percentage = $wpsc_cart->tax_percentage;
        } else {
            $tax = 0.0;
            $tax_percentage = 0.0;
        }
        $total = $wpsc_cart->calculate_total_price();
        $wpdb->insert(WPSC_TABLE_PURCHASE_LOGS, array('totalprice' => $total, 'statusno' => '0', 'sessionid' => $sessionid, 'user_ID' => (int) $user_ID, 'date' => strtotime(current_time('mysql')), 'gateway' => $submitted_gateway, 'billing_country' => $wpsc_cart->selected_country, 'shipping_country' => $delivery_country, 'billing_region' => $wpsc_cart->selected_region, 'shipping_region' => $delivery_region, 'base_shipping' => $base_shipping, 'shipping_method' => $shipping_method, 'shipping_option' => $shipping_option, 'plugin_version' => WPSC_VERSION, 'discount_value' => $wpsc_cart->coupons_amount, 'discount_data' => $wpsc_cart->coupons_name, 'find_us' => $find_us, 'wpec_taxes_total' => $tax, 'wpec_taxes_rate' => $tax_percentage));
        $purchase_log_id = $wpdb->insert_id;
        $wpsc_checkout->save_forms_to_db($purchase_log_id);
        $wpsc_cart->save_to_db($purchase_log_id);
//.........這裏部分代碼省略.........
開發者ID:hornet9,項目名稱:Morato,代碼行數:101,代碼來源:ajax.functions.php

示例6: wpsc_admin_category_forms_edit


//.........這裏部分代碼省略.........
		</td>
	</tr>
	<tr class="form-field">
		<th scope="row" valign="top">
			<label for="image"><?php 
    esc_html_e('Display Category Template Tag', 'wpsc');
    ?>
</label>
		</th>
		<td>
			<code>&lt;?php echo wpsc_display_products_page( array( 'category_url_name' => '<?php 
    echo $category["slug"];
    ?>
' ) ); ?&gt;</code><br />
			<span class="description"><?php 
    esc_html_e('Template tags are used to display a particular category or group within your theme / template.', 'wpsc');
    ?>
</span>
		</td>
	</tr>

	<!-- START OF TARGET MARKET SELECTION -->

	<tr>
		<td colspan="2">
			<h4><?php 
    esc_html_e('Target Market Restrictions', 'wpsc');
    ?>
</h4>
		</td>
	</tr>
	<?php 
    $countrylist = WPSC_Countries::get_countries_array(true, true);
    $selectedCountries = wpsc_get_meta($category_id, 'target_market', 'wpsc_category');
    ?>
	<tr>
		<th scope="row" valign="top">
			<label for="image"><?php 
    esc_html_e('Target Markets', 'wpsc');
    ?>
</label>
		</th>
		<td>
			<?php 
    if (wpsc_is_suhosin_enabled()) {
        ?>
				<em><?php 
        esc_html_e('The Target Markets feature has been disabled because you have the Suhosin PHP extension installed on this server. If you need to use the Target Markets feature, then disable the suhosin extension. If you can not do this, you will need to contact your hosting provider.', 'wpsc');
        ?>
</em>
			<?php 
    } else {
        ?>
				<span><?php 
        esc_html_e('Select', 'wpsc');
        ?>
: <a href='' class='wpsc_select_all'><?php 
        esc_html_e('All', 'wpsc');
        ?>
</a>&nbsp; <a href='' class='wpsc_select_none'><?php 
        esc_html_e('None', 'wpsc');
        ?>
</a></span><br />
				<div id='resizeable' class='ui-widget-content multiple-select'>
					<?php 
        foreach ($countrylist as $country) {
開發者ID:RJHanson292,項目名稱:WP-e-Commerce,代碼行數:67,代碼來源:save-data.functions.php

示例7: wpsc_get_categorymeta

/**
 * Retrieve meta field for a category
 *
 * @param  int    $cat_id   Category ID.
 * @param  string $meta_key The meta key to retrieve.
 * @return mixed            Will be value of meta data field
 */
function wpsc_get_categorymeta($cat_id, $meta_key)
{
    return wpsc_get_meta($cat_id, $meta_key, 'wpsc_category');
}
開發者ID:VanessaGarcia-Freelance,項目名稱:ButtonHut,代碼行數:11,代碼來源:meta.functions.php

示例8: wpsc_admin_category_forms_edit


//.........這裏部分代碼省略.........
            </td>
	</tr>
        <tr class="form-field">
            <th scope="row" valign="top">
		<label for="image"><?php 
    _e('Display Category Template Tag', 'wpsc');
    ?>
:</label>
            </th>
            <td>
                <span>&lt;?php echo wpsc_display_products_page( array( 'category_url_name'=>'<?php 
    echo $category["slug"];
    ?>
' ) ); ?&gt;</span><br />
		<span class="description"><?php 
    _e('Template tags are used to display a particular category or group within your theme / template.', 'wpsc');
    ?>
</span>
            </td>
	</tr>

<!-- START OF TARGET MARKET SELECTION -->

        <tr>
            <td colspan="2">
                <h3><?php 
    _e('Target Market Restrictions', 'wpsc');
    ?>
</h3>
            </td>
        </tr>
        <?php 
    $countrylist = $wpdb->get_results("SELECT id,country,visible FROM `" . WPSC_TABLE_CURRENCY_LIST . "` ORDER BY country ASC ", ARRAY_A);
    $selectedCountries = wpsc_get_meta($category_id, 'target_market', 'wpsc_category');
    ?>
        <tr class="form-field">
            <th scope="row" valign="top">
		<label for="image"><?php 
    _e('Target Markets', 'wpsc');
    ?>
:</label>
            </th>
            <td>
                <?php 
    if (@extension_loaded('suhosin')) {
        ?>
                <em><?php 
        _e('The Target Markets feature has been disabled because you have the Suhosin PHP extension installed on this server. If you need to use the Target Markets feature, then disable the suhosin extension. If you can not do this, you will need to contact your hosting provider.', 'wpsc');
        ?>
</em>

                <?php 
    } else {
        ?>
		<span><?php 
        _e('Select', 'wpsc');
        ?>
: <a href='' class='wpsc_select_all'><?php 
        _e('All', 'wpsc');
        ?>
</a>&nbsp; <a href='' class='wpsc_select_none'><?php 
        _e('None', 'wpsc');
        ?>
</a></span><br />
		<div id='resizeable' class='ui-widget-content multiple-select'>
                    <?php 
開發者ID:arturo-mayorga,項目名稱:am_com,代碼行數:67,代碼來源:save-data.functions.php

示例9: wpsc_get_acceptable_countries

/**
 * Cycles through the categories represented by the products in the cart.
 * Retrieves their target markets and returns an array of acceptable markets
 * We're only listing target markets that are acceptable for ALL categories in the cart
 *
 * @since 3.8.9
 * @return array Countries that can be shipped to.  If empty, sets session variable with appropriate error message
 */
function wpsc_get_acceptable_countries()
{
    global $wpdb;
    $cart_category_ids = array_unique(wpsc_cart_item_categories(true));
    $target_market_ids = array();
    foreach ($cart_category_ids as $category_id) {
        $target_markets = wpsc_get_meta($category_id, 'target_market', 'wpsc_category');
        if (!empty($target_markets)) {
            $target_market_ids[$category_id] = $target_markets;
        }
    }
    $have_target_market = !empty($target_market_ids);
    //If we're comparing multiple categories
    if (count($target_market_ids) > 1) {
        $target_market_ids = call_user_func_array('array_intersect', $target_market_ids);
    } elseif ($have_target_market) {
        $target_market_ids = array_values($target_market_ids);
        $target_market_ids = $target_market_ids[0];
    }
    $country_data = WPSC_Countries::get_countries_array();
    $have_target_market = $have_target_market && count($country_data) != count($target_market_ids);
    $GLOBALS['wpsc_country_data'] = $country_data;
    // TODO Is this ever used?
    $conflict_error = wpsc_get_customer_meta('category_shipping_conflict');
    $target_conflict = wpsc_get_customer_meta('category_shipping_target_market_conflict');
    // Return true if there are no restrictions
    if (!$have_target_market) {
        // clear out the target market messages
        if (!empty($target_conflict)) {
            wpsc_delete_customer_meta('category_shipping_conflict');
        }
        wpsc_update_customer_meta('category_shipping_target_market_conflict', false);
        wpsc_update_customer_meta('category_shipping_conflict', false);
        return true;
    }
    // temporarily hijack this session variable to display target market restriction warnings
    if (!empty($target_conflict) || !wpsc_has_category_and_country_conflict()) {
        wpsc_update_customer_meta('category_shipping_target_market_conflict', true);
        wpsc_update_customer_meta('category_shipping_conflict', __("Some of your cart items are targeted specifically to certain markets. As a result, you can only select those countries as your shipping destination.", 'wp-e-commerce'));
    }
    if (empty($target_market_ids)) {
        wpsc_update_customer_meta('category_shipping_target_market_conflict', true);
        wpsc_update_customer_meta('category_shipping_conflict', __('It appears that some products in your cart have conflicting target market restrictions. As a result, there is no common destination country where your cart items can be shipped to. Please contact the site administrator for more information.', 'wp-e-commerce'));
    }
    return $target_market_ids;
}
開發者ID:ashik968,項目名稱:digiplot,代碼行數:54,代碼來源:checkout.class.php

示例10: wpsc_display_products_page

/**
 * wpsc display products function
 * @return string - html displaying one or more products
 */
function wpsc_display_products_page($query)
{
    global $wpdb, $wpsc_query, $wp_query, $wp_the_query;
    remove_filter('the_title', 'wpsc_the_category_title');
    // If the data is coming from a shortcode parse the values into the args variable,
    // I did it this was to preserve backwards compatibility
    if (!empty($query)) {
        $args = array();
        $args['post_type'] = 'wpsc-product';
        if (!empty($query['product_id']) && is_array($query['product_id'])) {
            $args['post__in'] = $query['product_id'];
        } elseif (is_string($query['product_id'])) {
            $args['post__in'] = (array) $query['product_id'];
        }
        if (!empty($query['old_product_id'])) {
            $post_id = wpsc_get_the_new_id($query['old_product_id']);
            $args['post__in'] = (array) $post_id;
        }
        if (!empty($query['price']) && 'sale' != $query['price']) {
            $args['meta_key'] = '_wpsc_price';
            $args['meta_value'] = $query['price'];
        } elseif (!empty($query['price']) && 'sale' == $query['price']) {
            $args['meta_key'] = '_wpsc_special_price';
            $args['meta_compare'] = '>=';
            $args['meta_value'] = '1';
        }
        if (!empty($query['product_name'])) {
            $args['pagename'] = $query['product_name'];
        }
        if (!empty($query['category_id'])) {
            $term = get_term($query['category_id'], 'wpsc_product_category');
            $id = wpsc_get_meta($query['category_id'], 'category_id', 'wpsc_old_category');
            if (!empty($id)) {
                $term = get_term($id, 'wpsc_product_category');
                $args['wpsc_product_category'] = $term->slug;
                $args['wpsc_product_category__in'] = $term->term_id;
            } else {
                $args['wpsc_product_category'] = $term->slug;
                $args['wpsc_product_category__in'] = $term->term_id;
            }
        }
        if (!empty($query['category_url_name'])) {
            $args['wpsc_product_category'] = $query['category_url_name'];
        }
        $orderby = !empty($query['sort_order']) ? $query['sort_order'] : null;
        $args = array_merge($args, wpsc_product_sort_order_query_vars($orderby));
        if (!empty($query['order'])) {
            $args['order'] = $query['order'];
        }
        if (!empty($query['limit_of_items']) && '1' == get_option('use_pagination')) {
            $args['posts_per_page'] = $query['limit_of_items'];
        }
        if (!empty($query['number_per_page']) && '1' == get_option('use_pagination')) {
            $args['posts_per_page'] = $query['number_per_page'];
            $args['paged'] = $query['page'];
        }
        if ('0' == get_option('use_pagination')) {
            $args['nopaging'] = true;
            $args['posts_per_page'] = '-1';
        }
        if (!empty($query['tag'])) {
            $args['product_tag'] = $query['tag'];
        }
        query_posts($args);
    }
    // swap the wpsc_query objects
    $GLOBALS['nzshpcrt_activateshpcrt'] = true;
    // Pretty sure this single_product code is legacy...but fixing it up just in case.
    // get the display type for the selected category
    if (!empty($wpsc_query->query_vars['term'])) {
        $display_type = wpsc_get_the_category_display($wpsc_query->query_vars['term']);
    } elseif (!empty($args['wpsc_product_category'])) {
        $display_type = wpsc_get_the_category_display($args['wpsc_product_category']);
    } else {
        $display_type = 'default';
    }
    $saved_display = wpsc_get_customer_meta('display_type');
    $display_type = !empty($saved_display) ? $saved_display : $display_type;
    ob_start();
    do_action('wpsc_display_products_page', $display_type);
    if (isset($wp_query->post) && 'wpsc-product' == $wp_query->post->post_type && !is_archive() && $wp_query->post_count <= 1) {
        include wpsc_get_template_file_path('wpsc-single_product.php');
    } else {
        wpsc_include_products_page_template($display_type);
    }
    $output = ob_get_contents();
    ob_end_clean();
    $output = str_replace('\\$', '$', $output);
    if (!empty($query)) {
        wp_reset_query();
        wp_reset_postdata();
    }
    return $output;
}
開發者ID:androidprojectwork,項目名稱:WP-e-Commerce,代碼行數:98,代碼來源:page.php

示例11: add_resend_tickets_action

 /**
  * Adds a link to resend the tickets to the customer
  * in the order edit screen.
  */
 public function add_resend_tickets_action()
 {
     if (empty($_GET['id'])) {
         return;
     }
     $order = $_GET['id'];
     $has_tickets = wpsc_get_meta($order, $this->order_done, 'tribe_tickets');
     if (!$has_tickets) {
         return;
     }
     $url = add_query_arg('tribe_resend_ticket', 1);
     echo sprintf("<img src='%s'>&nbsp;", esc_url($this->pluginUrl . 'src/resources/images/ticket.png'));
     echo sprintf("<a href='%s'>%s</a>", esc_url($url), esc_html__('Resend Tickets', 'event-tickets-plus'));
     if (!empty($_GET['tribe_resend_ticket'])) {
         $this->send_email(new WPSC_Purchase_Log($order, 'id'));
         echo esc_html__('&nbsp; [Sent]', 'event-tickets-plus');
     }
     echo '<br/><br/>';
 }
開發者ID:TakenCdosG,項目名稱:chefs,代碼行數:23,代碼來源:Main.php

示例12: 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

示例13: wpsc_get_terms_category_sort_filter

/**
 * wpsc_get_terms_category_sort_filter
 *
 * This sorts the categories when a call to get_terms is made
 * @param object array $terms
 * @param array $taxonomies
 * @param array $args
 * @return object array $terms
 */
function wpsc_get_terms_category_sort_filter($terms)
{
    $new_terms = array();
    $i = 0;
    foreach ($terms as $term) {
        if (!is_object($term)) {
            return $terms;
        }
        $term_order = wpsc_get_meta($term->term_id, 'sort_order', 'wpsc_category');
        if (isset($term_order) && is_numeric($term_order) && !isset($new_terms[$term_order])) {
            $term->sort_order = $term_order;
            $new_terms[$term_order] = $term;
        } elseif (isset($new_terms[$term_order])) {
            //this must have been recently moved or something, palce it at the end
            $newID = count($terms);
            while (isset($new_terms[$newID])) {
                $newID++;
            }
            $term->sort_order = $newID;
            $new_terms[$newID] = $term;
        } elseif (is_object($term)) {
            //Term has no order make one up, also helps if it's not one of our terms
            $term->sort_order = $i;
            $new_terms[$i] = $term;
            $i++;
        }
    }
    ksort($new_terms);
    return $new_terms;
}
開發者ID:hornet9,項目名稱:Morato,代碼行數:39,代碼來源:category.functions.php

示例14: wpsc_st_get_ip_address

 function wpsc_st_get_ip_address($purchase_id)
 {
     global $wpdb;
     $output = '-';
     if ($purchase_id) {
         $ip_address = wpsc_get_meta($purchase_id, 'ip_address', 'purchase_log');
         if ($ip_address) {
             $output = $ip_address;
         }
     }
     return $output;
 }
開發者ID:Kilbourne,項目名稱:restart,代碼行數:12,代碼來源:release-3_8.php

示例15: push_sales_data

 /**
  * Pushes sales data back to Baikonur
  *
  * Only pushes once.  Accounts for annoying potential edge case of status-switching admins
  *
  * @param  WPSC_Purchase_Log object $purchase_log Purchase Log object
  * @return void
  */
 public static function push_sales_data($purchase_log_id, $current_status, $old_status, $purchase_log)
 {
     $purchase_log = new WPSC_Purchase_Log($purchase_log_id);
     $id = absint($purchase_log->get('id'));
     //Also checking is_order_received, as that's what Manual Payments do.
     if ($purchase_log->is_transaction_completed() || $purchase_log->is_order_received()) {
         $pushed_to_sass = wpsc_get_meta($id, '_pushed_to_wpeconomy', 'purchase_log');
         if (empty($pushed_to_saas)) {
             $data = $purchase_log->get_data();
             $cart_contents = $purchase_log->get_cart_contents();
             //We want to push sales data - but naturally, IDs will differ, even names could potentially.
             //So we add the slug to the object we POST
             foreach ($cart_contents as $key => $cart_item) {
                 $slug = get_post_field('post_name', $cart_item->prodid);
                 $cart_contents[$key]->slug = $slug;
             }
             $args = array('body' => array('data' => json_encode($data), 'cart_contents' => json_encode($cart_contents)));
             $request = wp_remote_post('http://www.wpeconomy.org/?sales_data=true', $args);
             $response = wp_remote_retrieve_response_code($request);
             //For some reason, if the site is down, we want the ability to ensure we can grab the sale later.
             $success = 200 === $response;
             wpsc_update_meta($id, '_pushed_to_wpeconomy', $success, 'purchase_log');
         }
     }
 }
開發者ID:VanessaGarcia-Freelance,項目名稱:ButtonHut,代碼行數:33,代碼來源:Sputnik.php


注:本文中的wpsc_get_meta函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。