• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wpsc_get_categorymeta函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: wpsc_convert_categories

/**
 * wpsc_convert_categories function.
 * 
 * @access public
 * @param int $parent_category. (default: 0)
 * @return void
 */
function wpsc_convert_categories($new_parent_category, $group_id, $old_parent_category = 0)
{
    global $wpdb, $user_ID;
    if ($old_parent_category > 0) {
        $categorisation = $wpdb->get_results("SELECT * FROM `" . WPSC_TABLE_PRODUCT_CATEGORIES . "` WHERE `active` IN ('1') AND `group_id` IN ('{$group_id}') AND `category_parent` IN ('{$old_parent_category}')");
    } else {
        $categorisation = $wpdb->get_results("SELECT * FROM `" . WPSC_TABLE_PRODUCT_CATEGORIES . "` WHERE `active` IN ('1') AND `group_id` IN ('{$group_id}') AND `category_parent` IN (0)");
    }
    if ($categorisation > 0) {
        foreach ((array) $categorisation as $category) {
            $category_id = wpsc_get_meta($category->id, 'category_id', 'wpsc_old_category');
            if (!is_numeric($category_id) || $category_id < 1) {
                $new_category = wp_insert_term($category->name, 'wpsc_product_category', array('description' => $category->description, 'parent' => $new_parent_category));
                if (!is_wp_error($new_category)) {
                    $category_id = $new_category['term_id'];
                }
            }
            if (is_numeric($category_id)) {
                wpsc_update_meta($category->id, 'category_id', $category_id, 'wpsc_old_category');
                wpsc_update_categorymeta($category_id, 'category_id', $category->id);
                wpsc_update_categorymeta($category_id, 'image', $category->image);
                wpsc_update_categorymeta($category_id, 'display_type', $category->display_type);
                wpsc_update_categorymeta($category_id, 'image_height', $category->image_height);
                wpsc_update_categorymeta($category_id, 'image_width', $category->image_width);
                $use_additonal_form_set = wpsc_get_categorymeta($category->id, 'use_additonal_form_set');
                if ($use_additonal_form_set != '') {
                    wpsc_update_categorymeta($category_id, 'use_additonal_form_set', $use_additonal_form_set);
                } else {
                    wpsc_delete_categorymeta($category_id, 'use_additonal_form_set');
                }
                wpsc_update_categorymeta($category_id, 'uses_billing_address', (bool) (int) wpsc_get_categorymeta($category->id, 'uses_billing_address'));
            }
            if ($category_id > 0) {
                wpsc_convert_categories($category_id, $group_id, $category->id);
            }
        }
    }
}
开发者ID:hornet9,项目名称:Morato,代码行数:45,代码来源:updating-functions.php


示例2: get_item_shipping

 /**
  * calculates shipping price for an individual cart item.
  *
  * @param object $cart_item (reference)
  * @return float price of shipping for the item.
  */
 function get_item_shipping(&$cart_item)
 {
     global $wpdb, $wpsc_cart;
     $unit_price = $cart_item->unit_price;
     $quantity = $cart_item->quantity;
     $weight = $cart_item->weight;
     $product_id = $cart_item->product_id;
     $uses_billing_address = false;
     foreach ($cart_item->category_id_list as $category_id) {
         $uses_billing_address = (bool) wpsc_get_categorymeta($category_id, 'uses_billing_address');
         if ($uses_billing_address === true) {
             break;
             /// just one true value is sufficient
         }
     }
     if (is_numeric($product_id) && get_option('do_not_use_shipping') != 1) {
         if ($uses_billing_address == true) {
             $country_code = $wpsc_cart->selected_country;
         } else {
             $country_code = $wpsc_cart->delivery_country;
         }
         if ($cart_item->uses_shipping == true) {
             //if the item has shipping
             $additional_shipping = '';
             if (isset($cart_item->meta[0]['shipping'])) {
                 $shipping_values = $cart_item->meta[0]['shipping'];
             }
             if (isset($shipping_values['local']) && $country_code == get_option('base_country')) {
                 $additional_shipping = $shipping_values['local'];
             } else {
                 if (isset($shipping_values['international'])) {
                     $additional_shipping = $shipping_values['international'];
                 }
             }
             $shipping = $quantity * $additional_shipping;
         } else {
             //if the item does not have shipping
             $shipping = 0;
         }
     } else {
         //if the item is invalid or all items do not have shipping
         $shipping = 0;
     }
     return $shipping;
 }
开发者ID:ashik968,项目名称:digiplot,代码行数:51,代码来源:flatrate.php


示例3: get_term

<?php

$curr_cat = get_term($category_id, 'wpsc_product_category', ARRAY_A);
$category_list = get_terms('wpsc_product_category', 'hide_empty=0&parent=' . $category_id);
$link = get_term_link((int) $category_id, 'wpsc_product_category');
$category_image = wpsc_get_categorymeta($curr_cat['term_id'], 'image');
$category_image = WPSC_CATEGORY_URL . $category_image;
$show_name = $instance['show_name'];
if ($grid) {
    ?>

		<a href="<?php 
    echo $link;
    ?>
" style="padding: 4px 4px 0 0; width:<?php 
    echo $width;
    ?>
px; height:<?php 
    echo $height;
    ?>
px;" title="<?php 
    echo $curr_cat['name'];
    ?>
" class="wpsc_category_grid_item">
			<?php 
    wpsc_parent_category_image($show_thumbnails, $category_image, $width, $height, true, $show_name);
    ?>
		</a>

		<?php 
    wpsc_start_category_query(array('parent_category_id' => $category_id, 'show_thumbnails' => $show_thumbnails, 'show_name' => $show_name));
开发者ID:arturo-mayorga,项目名称:am_com,代码行数:31,代码来源:wpsc-category_widget.php


示例4: wpsc_save_category_set

/**
 * wpsc_save_category_set, Saves the category set data
 * @param nothing
 * @return nothing
 */
function wpsc_save_category_set($category_id, $tt_id)
{
    global $wpdb;
    if (!empty($_POST)) {
        /* Image Processing Code*/
        if (!empty($_FILES['image']) && preg_match("/\\.(gif|jp(e)*g|png){1}\$/i", $_FILES['image']['name'])) {
            if (function_exists("getimagesize")) {
                if (isset($_POST['width']) && ((int) $_POST['width'] > 10 && (int) $_POST['width'] < 512) && ((int) $_POST['height'] > 10 && (int) $_POST['height'] < 512)) {
                    $width = (int) $_POST['width'];
                    $height = (int) $_POST['height'];
                    image_processing($_FILES['image']['tmp_name'], WPSC_CATEGORY_DIR . $_FILES['image']['name'], $width, $height, 'image');
                } else {
                    image_processing($_FILES['image']['tmp_name'], WPSC_CATEGORY_DIR . $_FILES['image']['name'], null, null, 'image');
                }
                $image = esc_sql($_FILES['image']['name']);
            } else {
                $new_image_path = WPSC_CATEGORY_DIR . basename($_FILES['image']['name']);
                move_uploaded_file($_FILES['image']['tmp_name'], $new_image_path);
                $stat = stat(dirname($new_image_path));
                $perms = $stat['mode'] & 0666;
                @chmod($new_image_path, $perms);
                $image = esc_sql($_FILES['image']['name']);
            }
        } else {
            $image = '';
        }
        //Good to here
        if (isset($_POST['tag_ID'])) {
            //Editing
            $category_id = (int) $_POST['tag_ID'];
            $category = get_term_by('id', $category_id, 'wpsc_product_category');
            $url_name = $category->slug;
        }
        if (isset($_POST['deleteimage']) && $_POST['deleteimage'] == 1) {
            wpsc_delete_categorymeta($category_id, 'image');
        } else {
            if ($image != '') {
                wpsc_update_categorymeta($category_id, 'image', $image);
            }
        }
        if (!empty($_POST['height']) && is_numeric($_POST['height']) && !empty($_POST['width']) && is_numeric($_POST['width']) && $image == null) {
            $imagedata = wpsc_get_categorymeta($category_id, 'image');
            if ($imagedata != null) {
                $height = (int) $_POST['height'];
                $width = (int) $_POST['width'];
                $imagepath = WPSC_CATEGORY_DIR . $imagedata;
                $image_output = WPSC_CATEGORY_DIR . $imagedata;
                image_processing($imagepath, $image_output, $width, $height);
            }
        }
        wpsc_update_categorymeta($category_id, 'fee', '0');
        wpsc_update_categorymeta($category_id, 'active', '1');
        wpsc_update_categorymeta($category_id, 'order', '0');
        if (isset($_POST['display_type'])) {
            wpsc_update_categorymeta($category_id, 'display_type', esc_sql(stripslashes($_POST['display_type'])));
        }
        if (isset($_POST['image_height'])) {
            wpsc_update_categorymeta($category_id, 'image_height', (int) $_POST['image_height']);
        }
        if (isset($_POST['image_width'])) {
            wpsc_update_categorymeta($category_id, 'image_width', (int) $_POST['image_width']);
        }
        if (!empty($_POST['use_additional_form_set'])) {
            wpsc_update_categorymeta($category_id, 'use_additional_form_set', absint($_POST['use_additional_form_set']));
        } else {
            wpsc_delete_categorymeta($category_id, 'use_additional_form_set');
        }
        if (!empty($_POST['uses_billing_address'])) {
            wpsc_update_categorymeta($category_id, 'uses_billing_address', 1);
            $uses_additional_forms = true;
        } else {
            wpsc_update_categorymeta($category_id, 'uses_billing_address', 0);
            $uses_additional_forms = false;
        }
        if (!empty($_POST['countrylist2']) && $category_id > 0) {
            $AllSelected = false;
            $countryList = $wpdb->get_col("SELECT `id` FROM  `" . WPSC_TABLE_CURRENCY_LIST . "`");
            if ($AllSelected != true) {
                $posted_countries = array_map('intval', $_POST['countrylist2']);
                $unselectedCountries = array_diff($countryList, $posted_countries);
                //find the countries that are selected
                $selectedCountries = array_intersect($countryList, $posted_countries);
                wpsc_update_categorymeta($category_id, 'target_market', $selectedCountries);
            }
        } elseif (!isset($_POST['countrylist2'])) {
            wpsc_update_categorymeta($category_id, 'target_market', '');
            $AllSelected = true;
        }
    }
}
开发者ID:RJHanson292,项目名称:WP-e-Commerce,代码行数:95,代码来源:save-data.functions.php


示例5: category_image

 private function category_image($cat)
 {
     $img = wpsc_get_categorymeta($cat->term_id, 'image');
     if ($img) {
         $url = WPSC_CATEGORY_URL . $img;
     } else {
         $url = wpsc_locate_asset_uri('images/noimage.png');
     }
     echo "<img src='" . esc_url($url) . "' width='" . esc_attr($this->instance['width']) . "' height='" . esc_attr($this->instance['height']) . "' />";
 }
开发者ID:osuarcher,项目名称:WP-e-Commerce,代码行数:10,代码来源:product-categories.php


示例6: wpsc_checkout

 /**
  * 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);
 }
开发者ID:ashik968,项目名称:digiplot,代码行数:50,代码来源:checkout.class.php


示例7: wpsc_obtain_the_description

/**
 *	Return category or product description depending on queried item
 */
function wpsc_obtain_the_description()
{
    $output = null;
    // Return Category Description
    if (is_numeric(get_query_var('category_id'))) {
        $output = wpsc_get_categorymeta(get_query_var('category_id'), 'description');
    } else {
        if (!empty($_GET['category'])) {
            $output = wpsc_get_categorymeta(absint($_GET['category']), 'description');
        }
    }
    // Return product content as description if product page
    if (!empty($_GET['product_id']) && is_numeric($_GET['product_id'])) {
        $product = get_post(absint($_GET['product_id']));
        $output = $product->post_content;
    }
    return $output;
}
开发者ID:androidprojectwork,项目名称:WP-e-Commerce,代码行数:21,代码来源:page.php


示例8: wpsc_checkout

 /**
  * 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);
 }
开发者ID:hornet9,项目名称:Morato,代码行数:38,代码来源:checkout.class.php


示例9: wpsc_category_image

/**
* wpsc_category_image function, Gets the category image or returns false
* @param integer category ID, can be 0
* @return string url to the category image
*/
function wpsc_category_image($category_id = null)
{
    if ($category_id < 1) {
        $category_id = wpsc_category_id();
    }
    $category_image = wpsc_get_categorymeta($category_id, 'image');
    $category_path = WPSC_CATEGORY_DIR . basename($category_image);
    $category_url = WPSC_CATEGORY_URL . basename($category_image);
    if (file_exists($category_path) && is_file($category_path)) {
        return $category_url;
    }
    return false;
}
开发者ID:osuarcher,项目名称:WP-e-Commerce,代码行数:18,代码来源:category.functions.php


示例10: wpsc_display_category_loop

/**
* wpsc category loop function
* This function recursively loops through the categories to display the category tree.
* This function also generates a tree of categories at the same time
* WARNING: as this function is recursive, be careful what you do with it.
* @param array the category query
* @param string the category html
* @param array the category array branch, is an internal value, leave it alone.
* @return string - the finished category html
*/
function wpsc_display_category_loop($query, $category_html, &$category_branch = null)
{
    static $category_count_data = array();
    // the array tree is stored in this
    if (isset($query['parent_category_id'])) {
        $category_id = absint($query['parent_category_id']);
    } else {
        $category_id = 0;
    }
    $category_data = get_terms('wpsc_product_category', 'hide_empty=0&parent=' . $category_id, OBJECT, 'display');
    $output = '';
    // if the category branch is identical to null, make it a reference to $category_count_data
    if ($category_branch === null) {
        $category_branch =& $category_count_data;
    }
    $allowed_tags = array('a' => array('href' => array(), 'title' => array()), 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), 'code' => array(), 'em' => array(), 'strong' => array(), 'b' => array());
    $allowedtags = apply_filters('wpsc_category_description_allowed_tags', $allowed_tags);
    foreach ((array) $category_data as $category_row) {
        // modifys the query for the next round
        $modified_query = $query;
        $modified_query['parent_category_id'] = $category_row->term_id;
        // gets the count of products associated with this category
        $category_count = $category_row->count;
        // Sticks the category description in
        $category_description = '';
        if ($category_row->description != '' && !empty($query['description_container'])) {
            $start_element = $query['description_container']['start_element'];
            $end_element = $query['description_container']['end_element'];
            $category_description = $start_element . wpautop(wptexturize(wp_kses($category_row->description, $allowedtags))) . $end_element;
        }
        // Creates the list of classes on the category item
        $category_classes = wpsc_print_category_classes((array) $category_row, false);
        // Set the variables for this category
        $category_branch[$category_row->term_id]['children'] = array();
        $category_branch[$category_row->term_id]['count'] = (int) $category_count;
        // Recurse into the next level of categories
        $sub_categories = wpsc_display_category_loop($modified_query, $category_html, $category_branch[$category_row->term_id]['children']);
        // grab the product count from the subcategories
        foreach ((array) $category_branch[$category_row->term_id]['children'] as $child_category) {
            $category_branch[$category_row->term_id]['count'] += (int) $child_category['count'];
        }
        // stick the category count array together here
        // this must run after the subcategories and the count of products belonging to them has been obtained
        $category_count = $category_branch[$category_row->term_id]['count'];
        $start_element = '';
        $end_element = '';
        if (isset($query['products_count']['start_element'])) {
            $start_element = $query['products_count']['start_element'];
        }
        if (isset($query['products_count']['end_element'])) {
            $end_element = $query['products_count']['end_element'];
        }
        $category_count_html = $start_element . $category_count . $end_element;
        if (isset($query['subcategory_container']) && !empty($sub_categories)) {
            $start_element = $query['subcategory_container']['start_element'];
            $end_element = $query['subcategory_container']['end_element'];
            $sub_categories = $start_element . $sub_categories . $end_element;
        }
        // get the category images
        $category_image = wpsc_place_category_image($category_row->term_id, $modified_query);
        if (empty($query['image_size']['width'])) {
            if (!wpsc_category_grid_view()) {
                $width = wpsc_get_categorymeta($category_row->term_id, 'image_width');
            }
            if (empty($width)) {
                $width = get_option('category_image_width');
            }
        } else {
            $width = $query['image_size']['width'];
        }
        if (empty($query['image_size']['height'])) {
            if (!wpsc_category_grid_view()) {
                $height = wpsc_get_categorymeta($category_row->term_id, 'image_height');
            }
            if (empty($height)) {
                $height = get_option('category_image_height');
            }
        } else {
            $height = $query['image_size']['height'];
        }
        $category_image = wpsc_get_categorymeta($category_row->term_id, 'image');
        $category_image_html = '';
        if ($query['show_thumbnails'] == 1) {
            if (!empty($category_image) && is_file(WPSC_CATEGORY_DIR . $category_image)) {
                $category_image_html = "<img src='" . WPSC_CATEGORY_URL . "{$category_image}' alt='{$category_row->name}' title='{$category_row->name}' style='width: {$width}px; height: {$height}px;' class='wpsc_category_image' />";
            } elseif (isset($query['show_name']) && 1 == $query['show_name']) {
                $category_image_html .= "<span class='wpsc_category_image item_no_image ' style='width: {$width}px; height: {$height}px;'>\n\r";
                $category_image_html .= "\t<span class='link_substitute' >\n\r";
                $category_image_html .= "\t\t<span>" . __('N/A', 'wpsc') . "</span>\n\r";
                $category_image_html .= "\t</span>\n\r";
//.........这里部分代码省略.........
开发者ID:osuarcher,项目名称:WP-e-Commerce,代码行数:101,代码来源:product.php


示例11: wpsc_obtain_the_description

function wpsc_obtain_the_description()
{
    global $wpdb, $wp_query, $wpsc_title_data;
    $output = null;
    if (is_numeric($wp_query->query_vars['category_id'])) {
        $category_id = $wp_query->query_vars['category_id'];
    } else {
        if ($_GET['category']) {
            $category_id = absint($_GET['category']);
        }
    }
    if (is_numeric($category_id)) {
        $output = wpsc_get_categorymeta($category_id, 'description');
    }
    if (is_numeric($_GET['product_id'])) {
        $product_id = absint($_GET['product_id']);
        $output = $wpdb->get_var($wpdb->prepare("SELECT `post_content` FROM `" . $wpdb->posts . "` WHERE `id` = %d LIMIT 1", $product_id));
    }
    return $output;
}
开发者ID:arturo-mayorga,项目名称:am_com,代码行数:20,代码来源:display.functions.php


示例12: nzshpcrt_getcategoryform


//.........这里部分代码省略.........
            }
        }
        $output .= " </div><br /><br />";
        $output .= " <span class='wpscsmall description'>Select the markets you are selling this category to.<span>\n\r";
    }
    $output .= "   </td>\n\r";
    $output .= " </tr>\n\r";
    ////////
    $output .= "          <tr>\n\r";
    $output .= "          \t<td colspan='2' class='category_presentation_settings'>\n\r";
    $output .= "          \t\t<h4>" . __('Presentation Settings', 'wpsc') . "</h4>\n\r";
    $output .= "          \t\t<span class='small'>" . __('To over-ride the presentation settings for this group you can enter in your prefered settings here', 'wpsc') . "</span>\n\r";
    $output .= "          \t</td>\n\r";
    $output .= "          </tr>\n\r";
    $output .= "          <tr>\n\r";
    $output .= "          \t<td>\n\r";
    $output .= "          \t" . __('Catalog View', 'wpsc') . ":\n\r";
    $output .= "          \t</td>\n\r";
    $output .= "          \t<td>\n\r";
    $output .= "          \t\t<select name='display_type'>\n\r";
    $output .= "          \t\t\t<option value='' {$product_view0} >" . __('Please select', 'wpsc') . "</option>\n\r";
    $output .= "          \t\t\t<option value='default' {$product_view1} >" . __('Default View', 'wpsc') . "</option>\n\r";
    if (function_exists('product_display_list')) {
        $output .= "          \t\t\t<option value='list' " . $product_view2 . ">" . __('List View', 'wpsc') . "</option>\n\r";
    } else {
        $output .= "          \t\t\t<option value='list' disabled='disabled' " . $product_view2 . ">" . __('List View', 'wpsc') . "</option>\n\r";
    }
    if (function_exists('product_display_grid')) {
        $output .= "          \t\t\t<option value='grid' " . $product_view3 . ">" . __('Grid View', 'wpsc') . "</option>\n\r";
    } else {
        $output .= "          \t\t\t<option value='grid' disabled='disabled' " . $product_view3 . ">" . __('Grid View', 'wpsc') . "</option>\n\r";
    }
    $output .= "          \t\t</select>\n\r";
    $output .= "          \t</td>\n\r";
    $output .= "          </tr>\n\r";
    if (function_exists("getimagesize")) {
        $output .= "          <tr>\n\r";
        $output .= "            <td>\n\r";
        $output .= __('Thumbnail&nbsp;Size', 'wpsc') . ": ";
        $output .= "            </td>\n\r";
        $output .= "            <td>\n\r";
        $output .= __('Height', 'wpsc') . ": <input type='text' value='" . $product['image_height'] . "' name='product_height' size='6'/> ";
        $output .= __('Width', 'wpsc') . ": <input type='text' value='" . $product['image_width'] . "' name='product_width' size='6'/> <br/>";
        $output .= "            </td>\n\r";
        $output .= "          </tr>\n\r";
    }
    $output .= "          <tr>\n\r";
    $output .= "          \t<td colspan='2' class='category_presentation_settings'>\n\r";
    $output .= "          \t\t<h4>" . __('Checkout Settings', 'wpsc') . "</h4>\n\r";
    //$output .= "          		<span class='small'>".__('To over-ride the presentation settings for this group you can enter in your prefered settings here', 'wpsc')."</span>\n\r";
    $output .= "          \t</td>\n\r";
    $output .= "          </tr>\n\r";
    $used_additonal_form_set = wpsc_get_categorymeta($product['id'], 'use_additonal_form_set');
    $output .= "          <tr>\n\r";
    $output .= "            <td>\n\r";
    $output .= __("This category requires additional checkout form fields", 'wpsc') . ": ";
    $output .= "            </td>\n\r";
    $output .= "            <td>\n\r";
    $output .= "            <select name='use_additonal_form_set'>\n\r";
    $output .= "            \t<option value=''>" . __("None", 'wpsc') . "</option>\n\r";
    $checkout_sets = get_option('wpsc_checkout_form_sets');
    unset($checkout_sets[0]);
    foreach ((array) $checkout_sets as $key => $value) {
        $selected_state = "";
        if ($used_additonal_form_set == $key) {
            $selected_state = "selected='selected'";
        }
        $output .= "            <option {$selected_state} value='{$key}'>" . stripslashes($value) . "</option>\n\r";
    }
    $output .= "            </select>\n\r";
    //$output .= "            <label><input type='radio' value='1' name='uses_additonal_forms' ".(($uses_additional_forms == true) ? "checked='checked'" : "")." />".__("Yes",'wpsc')."</label>";
    //$output .= "            <label><input type='radio' value='0' name='uses_additonal_forms' ".(($uses_additional_forms != true) ? "checked='checked'" : "")." />".__("No",'wpsc')."</label>";
    $output .= "            </td>\n\r";
    $output .= "          </tr>\n\r";
    $output .= "          <tr>";
    $output .= "          \t<td colspan='2'>\t\t\t\t\t\t</td>";
    $output .= "          </tr>";
    $uses_billing_address = (bool) wpsc_get_categorymeta($product['id'], 'uses_billing_address');
    $output .= "          <tr>\n\r";
    $output .= "            <td>\n\r";
    $output .= __("Products in this category use the billing address to calculate shipping", 'wpsc') . ": ";
    $output .= "            </td>\n\r";
    $output .= "            <td>\n\r";
    $output .= "            <label><input type='radio' value='1' name='uses_billing_address' " . ($uses_billing_address == true ? "checked='checked'" : "") . " />" . __("Yes", 'wpsc') . "</label>";
    $output .= "            <label><input type='radio' value='0' name='uses_billing_address' " . ($uses_billing_address != true ? "checked='checked'" : "") . " />" . __("No", 'wpsc') . "</label>";
    $output .= "            </td>\n\r";
    $output .= "          </tr>\n\r";
    $output .= "          <tr>\n\r";
    $output .= "            <td>\n\r";
    $output .= "            </td>\n\r";
    $output .= "            <td class='last_row'>\n\r";
    $output .= "<input type='hidden' name='prodid' value='" . $product['id'] . "' />";
    $output .= "<input type='hidden' name='submit_action' value='edit' />";
    $output .= "<input class='button-primary' style='float:left;' type='submit' name='submit' value='" . __('Update Category', 'wpsc') . "' />";
    $output .= "<a class='delete_button' href='" . add_query_arg('deleteid', $product['id'], 'admin.php?page=wpsc-edit-groups') . "' onclick=\"return conf();\" >" . __('Delete', 'wpsc') . "</a>";
    $output .= "            </td>\n\r";
    $output .= "          </tr>\n\r";
    $output .= "        </table>\n\r";
    return $output;
}
开发者ID:kasima,项目名称:wp-e-commerce-ezp,代码行数:101,代码来源:admin-form-functions.php


示例13: wpsc_get_the_category_display

/**
 * Checks the category slug for a display type, if none set returns default
 * << May need reworking to be more specific to the taxonomy type >>
 * @access public
 *
 * @since 3.8
 * @param $slug(string)
 * @return $slug either from db or 'default' if none set
 */
function wpsc_get_the_category_display($slug)
{
    global $wpdb;
    $default_display_type = get_option('product_view');
    if (!empty($slug) && is_string($slug)) {
        $category_id = wpsc_get_the_category_id($slug, 'slug');
        $display_type = wpsc_get_categorymeta($category_id, 'display_type');
    }
    if (!empty($display_type)) {
        return $display_type;
    } else {
        return $default_display_type;
    }
}
开发者ID:rmccue,项目名称:WP-e-Commerce,代码行数:23,代码来源:theme.functions.php


示例14: get_item_shipping

 function get_item_shipping(&$cart_item)
 {
     global $wpdb, $wpsc_cart;
     $unit_price = $cart_item->unit_price;
     $quantity = $cart_item->quantity;
     $weight = $cart_item->weight;
     $product_id = $cart_item->product_id;
     $uses_billing_address = false;
     foreach ((array) $cart_item->category_id_list as $category_id) {
         $uses_billing_address = (bool) wpsc_get_categorymeta($category_id, 'uses_billing_address');
         if ($uses_billing_address === true) {
             break;
             /// just one true value is sufficient
         }
     }
     if (is_numeric($product_id) && get_option('do_not_use_shipping') != 1) {
         if ($uses_billing_address == true) {
             $country_code = $wpsc_cart->selected_country;
         } else {
             $country_code = $wpsc_cart->delivery_country;
         }
         $product_list = $wpdb->get_row("SELECT * FROM `" . WPSC_TABLE_PRODUCT_LIST . "` WHERE `id`='{$product_id}' LIMIT 1", ARRAY_A);
         if ($product_list['no_shipping'] == 0) {
             //if the item has shipping
             if ($country_code == get_option('base_country')) {
                 $additional_shipping = $product_list['pnp'];
             } else {
                 $additional_shipping = $product_list['international_pnp'];
             }
             $shipping = $quantity * $additional_shipping;
         } else {
             //if the item does not have shipping
             $shipping = 0;
         }
     } else {
         //if the item is invalid or all items do not have shipping
         $shipping = 0;
     }
     return $shipping;
 }
开发者ID:alx,项目名称:SBek-Arak,代码行数:40,代码来源:flatrate.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wpsc_get_checkout_url函数代码示例发布时间:2022-05-23
下一篇:
PHP wpsc_get_ajax_spinner函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap