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


PHP wpsc_update_meta函数代码示例

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


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

示例1: wpsc_ajax_set_category_order

/**
 * WP eCommerce edit and add product category page functions
 *
 * These are the main WPSC Admin functions
 *
 * @package wp-e-commerce
 * @since 3.7
 */
function wpsc_ajax_set_category_order()
{
    global $wpdb;
    $sort_order = $_POST['sort_order'];
    $parent_id = $_POST['parent_id'];
    $result = true;
    foreach ($sort_order as $key => $value) {
        if (!wpsc_update_meta($value, 'sort_order', $key, 'wpsc_category')) {
            $result = false;
        }
    }
}
开发者ID:hornet9,项目名称:Morato,代码行数:20,代码来源:save-data.functions.php

示例2: wpsc_ajax_set_category_order

/**
 * WP eCommerce edit and add product category page functions
 *
 * These are the main WPSC Admin functions
 *
 * @package wp-e-commerce
 * @since 3.7
 */
function wpsc_ajax_set_category_order()
{
    global $wpdb;
    $sort_order = $_POST['sort_order'];
    $parent_id = $_POST['parent_id'];
    $result = true;
    foreach ($sort_order as $key => $value) {
        if (empty($value)) {
            continue;
        }
        $value = preg_replace('/[^0-9]/', '', $value);
        if (!wpsc_update_meta($value, 'sort_order', $key, 'wpsc_category')) {
            $result = false;
        }
    }
}
开发者ID:RJHanson292,项目名称:WP-e-Commerce,代码行数:24,代码来源:save-data.functions.php

示例3: setOrderMeta

 /**
  * setOrderMeta - add some details about the transaction that came from authorize.net
  */
 function setOrderMeta()
 {
     $meta_key = '_wpsc_auth_net_status';
     $type = 'wpsc_purchase_log';
     wpsc_update_meta($this->purchase_id, $meta_key, $this->metaOrder, $type);
 }
开发者ID:benhuson,项目名称:Gold-Cart,代码行数:9,代码来源:wpec_auth_net.class.php

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

示例5: set

 /**
  * sets a property for a country, well know properties are not allowed to be set using this function,
  * but arbitrary properties can be set (and accessed later with get)
  *
  *
  * @access public
  *
  * @since 3.8.14
  *
  * @return self, to support method chaining
  */
 public function set($property, $value = '')
 {
     if (is_array($property)) {
         foreach ($property as $key => $value) {
             $this->set($key, $value);
         }
     } else {
         $key = $property;
         $property_name = '_' . $key;
         if (property_exists($this, $property_name)) {
             $value = $this->{$property_name};
             _wpsc_doing_it_wrong(__FUNCTION__, __('Using set to change a well-known WPSC_Country property is deprecated as of version 3.8.14.  Use the class constructor and specify all properties together to perform and insert or an update.', 'wpsc'), '3.8.14');
             if (defined('WPSC_LOAD_DEPRECATED') && WPSC_LOAD_DEPRECATED) {
                 $country_array = $this->as_array();
                 $country_array[$key] = $value;
                 $this->_save_country_data($country_array);
             }
         } else {
             wpsc_update_meta($this->_id, $key, $value, __CLASS__);
         }
     }
     return $this;
 }
开发者ID:VanessaGarcia-Freelance,项目名称:ButtonHut,代码行数:34,代码来源:wpsc-country.class.php

示例6: save_to_db

 /**
  * save to database method
  * @access public
  *
  * @param integer purchase log id
  */
 function save_to_db($purchase_log_id)
 {
     global $wpdb, $wpsc_shipping_modules;
     $method = $this->cart->selected_shipping_method;
     $shipping = 0;
     if (!empty($method) && method_exists($wpsc_shipping_modules[$method], "get_item_shipping")) {
         $shipping = $wpsc_shipping_modules[$this->cart->selected_shipping_method]->get_item_shipping($this);
     }
     if ($this->cart->has_total_shipping_discount()) {
         $shipping = 0;
     }
     $shipping = apply_filters('wpsc_item_shipping_amount_db', $shipping, $this);
     //initialize tax variables
     $tax = 0;
     $tax_rate = 0;
     //wpec_taxes - calculate product tax and add to total price
     $wpec_taxes_controller = new wpec_taxes_controller();
     if ($wpec_taxes_controller->wpec_taxes_isincluded() && $wpec_taxes_controller->wpec_taxes_isenabled()) {
         $taxes = $wpec_taxes_controller->wpec_taxes_calculate_included_tax($this);
         $tax_rate = $taxes['rate'];
         $tax = $taxes['tax'];
     }
     $wpdb->insert(WPSC_TABLE_CART_CONTENTS, array('prodid' => $this->product_id, 'name' => $this->get_title(), 'purchaseid' => $purchase_log_id, 'price' => $this->unit_price, 'pnp' => $shipping, 'tax_charged' => $tax, 'gst' => $tax_rate, 'quantity' => $this->quantity, 'donation' => $this->is_donation, 'no_shipping' => 0, 'custom_message' => $this->custom_message, 'files' => serialize($this->custom_file), 'meta' => NULL), array('%d', '%s', '%d', '%f', '%f', '%f', '%f', '%s', '%d', '%d', '%s', '%s', '%s'));
     $cart_id = $wpdb->get_var("SELECT " . $wpdb->insert_id . " AS `id` FROM `" . WPSC_TABLE_CART_CONTENTS . "` LIMIT 1");
     wpsc_update_cartmeta($cart_id, 'sku', $this->sku);
     $downloads = get_option('max_downloads');
     if ($this->is_downloadable == true) {
         $product_files = (array) get_posts(array('post_type' => 'wpsc-product-file', 'post_parent' => $this->product_id, 'numberposts' => -1, 'post_status' => 'inherit'));
         foreach ($product_files as $file) {
             // if the file is downloadable, check that the file is real
             $unique_id = sha1(uniqid(mt_rand(), true));
             $wpdb->insert(WPSC_TABLE_DOWNLOAD_STATUS, array('product_id' => $this->product_id, 'fileid' => $file->ID, 'purchid' => $purchase_log_id, 'cartid' => $cart_id, 'uniqueid' => $unique_id, 'downloads' => $downloads, 'active' => 0, 'datetime' => date('Y-m-d H:i:s')), array('%d', '%d', '%d', '%d', '%s', '%s', '%d', '%s'));
             $download_id = $wpdb->get_var("SELECT " . $wpdb->insert_id . " AS `id` FROM `" . WPSC_TABLE_DOWNLOAD_STATUS . "` LIMIT 1");
             wpsc_update_meta($download_id, '_is_legacy', 'false', 'wpsc_downloads');
         }
     }
     do_action('wpsc_save_cart_item', $cart_id, $this->product_id);
 }
开发者ID:pankajsinghjarial,项目名称:SYLC,代码行数:44,代码来源:cart.class.php

示例7: wpsc_update_categorymeta

/**
 * Update meta field for a category
 *
 * @param  int    $cat_id     Category ID.
 * @param  string $meta_key   The meta key to retrieve.
 * @param  string $meta_value The value to be stored.
 * @return mixed              True if updated
 */
function wpsc_update_categorymeta($cat_id, $meta_key, $meta_value)
{
    return wpsc_update_meta($cat_id, $meta_key, $meta_value, 'wpsc_category');
}
开发者ID:VanessaGarcia-Freelance,项目名称:ButtonHut,代码行数:12,代码来源:meta.functions.php

示例8: generate_tickets

 /**
  * Generate and store all the attendees information for a new order.
  *
  * @param int $id
  * @param string $status (unused)
  * @param string $old_status (unused)
  * @param $purchase_log
  */
 public function generate_tickets($id, $status, $old_status, $purchase_log)
 {
     if (empty($purchase_log)) {
         return;
     }
     // Do not generate tickets until payment has been accepted/job dispatched
     $complete = $purchase_log->is_accepted_payment() || $purchase_log->is_job_dispatched();
     apply_filters('wpectickets_order_is_complete', $complete, $purchase_log);
     if (!$complete) {
         return;
     }
     // Bail if we already generated the info for this order
     $done = wpsc_get_meta($id, $this->order_done, 'tribe_tickets');
     if (!empty($done)) {
         return;
     }
     $has_tickets = false;
     // Get the items purchased in this order
     $order_items = $purchase_log->get_cart_contents();
     // Bail if the order is empty
     if (empty($order_items)) {
         return;
     }
     // Iterate over each product
     foreach ((array) $order_items as $item) {
         $order_attendee_id = 0;
         $product_id = $item->prodid;
         // Get the event this tickets is for
         $event_id = get_post_meta($product_id, $this->event_key, true);
         $optout = (bool) wpsc_get_cart_item_meta($item->purchaseid, self::ATTENDEE_OPTOUT_KEY, true);
         if (!empty($event_id)) {
             $has_tickets = true;
             // Iterate over all the amount of tickets purchased (for this product)
             $quantity = intval($item->quantity);
             for ($i = 0; $i < $quantity; $i++) {
                 $attendee = array('post_status' => 'publish', 'post_title' => $id . ' | ' . $item->name . ' | ' . ($i + 1), 'post_type' => self::ATTENDEE_OBJECT, 'ping_status' => 'closed');
                 // Insert individual ticket purchased
                 $attendee_id = wp_insert_post($attendee);
                 update_post_meta($attendee_id, self::ATTENDEE_PRODUCT_KEY, $product_id);
                 update_post_meta($attendee_id, self::ATTENDEE_ORDER_KEY, $id);
                 update_post_meta($attendee_id, self::ATTENDEE_EVENT_KEY, $event_id);
                 update_post_meta($attendee_id, $this->security_code, $this->generate_security_code($id, $attendee_id));
                 update_post_meta($attendee_id, self::ATTENDEE_OPTOUT_KEY, $optout);
                 /**
                  * WPEC specific action fired when a WPEC-driven attendee ticket for an event is generated
                  *
                  * @param $attendee_id ID of attendee ticket
                  * @param $event_id ID of event
                  * @param $order_id WPEC order ID
                  * @param $product_id WPEC product ID
                  */
                 do_action('event_tickets_wpec_attendee_created', $attendee_id, $event_id, $product_id);
                 /**
                  * Action fired when an attendee ticket is generated
                  *
                  * @param $attendee_id ID of attendee ticket
                  * @param $purchase_log WPEC purchase log object
                  * @param $product_id Product ID attendee is "purchasing"
                  * @param $order_attendee_id Attendee # for order
                  * @param $event_id The Event which this ticket belongs
                  */
                 do_action('event_tickets_wpec_ticket_created', $attendee_id, $purchase_log, $product_id, $order_attendee_id, $event_id);
                 $this->record_attendee_user_id($attendee_id);
                 $order_attendee_id++;
             }
         }
     }
     if ($has_tickets) {
         wpsc_update_meta($id, $this->order_done, '1', 'tribe_tickets');
         // Send the email to the user
         do_action('wpectickets-send-tickets-email', $purchase_log);
     }
 }
开发者ID:TakenCdosG,项目名称:chefs,代码行数:81,代码来源:Main.php

示例9: generate_tickets

 /**
  * Generate and store all the attendees information for a new order.
  * @param $purchase_log_object
  */
 public function generate_tickets($id, $status, $old_status, $purchase_log)
 {
     if (empty($purchase_log)) {
         return;
     }
     // Do not generate tickets until payment has been accepted/job dispatched
     $complete = $purchase_log->is_accepted_payment() || $purchase_log->is_job_dispatched();
     apply_filters('wpectickets_order_is_complete', $complete, $purchase_log);
     if (!$complete) {
         return;
     }
     // Bail if we already generated the info for this order
     $done = wpsc_get_meta($id, $this->order_done, 'tribe_tickets');
     if (!empty($done)) {
         return;
     }
     $has_tickets = false;
     // Get the items purchased in this order
     $order_items = $purchase_log->get_cart_contents();
     // Bail if the order is empty
     if (empty($order_items)) {
         return;
     }
     // Iterate over each product
     foreach ((array) $order_items as $item) {
         $product_id = $item->prodid;
         // Get the event this tickets is for
         $event_id = get_post_meta($product_id, $this->event_key, true);
         if (!empty($event_id)) {
             $has_tickets = true;
             // Iterate over all the amount of tickets purchased (for this product)
             $quantity = intval($item->quantity);
             for ($i = 0; $i < $quantity; $i++) {
                 $attendee = array('post_status' => 'publish', 'post_title' => $id . ' | ' . $item->name . ' | ' . ($i + 1), 'post_type' => self::ATTENDEE_OBJECT, 'ping_status' => 'closed');
                 // Insert individual ticket purchased
                 $attendee_id = wp_insert_post($attendee);
                 update_post_meta($attendee_id, self::ATTENDEE_PRODUCT_KEY, $product_id);
                 update_post_meta($attendee_id, self::ATTENDEE_ORDER_KEY, $id);
                 update_post_meta($attendee_id, self::ATTENDEE_EVENT_KEY, $event_id);
                 update_post_meta($attendee_id, $this->security_code, $this->generate_security_code($id, $attendee_id));
             }
         }
     }
     if ($has_tickets) {
         wpsc_update_meta($id, $this->order_done, '1', 'tribe_tickets');
         // Send the email to the user
         do_action('wpectickets-send-tickets-email', $purchase_log);
     }
 }
开发者ID:jamestrevorlees,项目名称:odd-web-v1.00,代码行数:53,代码来源:Main.php

示例10: wpsc_st_save_ip_address

 function wpsc_st_save_ip_address($purchase_log_object, $session_id, $display_to_screen)
 {
     if ($session_id) {
         $purchase_id = wpsc_st_get_purchase_id($session_id);
         if ($purchase_id) {
             wpsc_update_meta($purchase_id, 'ip_address', wpsc_st_capture_ip_address(), 'purchase_log');
         }
     }
 }
开发者ID:Kilbourne,项目名称:restart,代码行数:9,代码来源:release-3_8.php

示例11: save_to_db

 /**
  * save to database method
  * @access public
  *
  * @param integer purchase log id
  */
 function save_to_db($purchase_log_id)
 {
     global $wpdb, $wpsc_shipping_modules;
     $method = $this->cart->selected_shipping_method;
     $shipping = 0;
     if (!empty($method) && method_exists($wpsc_shipping_modules[$method], "get_item_shipping")) {
         $shipping = $wpsc_shipping_modules[$this->cart->selected_shipping_method]->get_item_shipping($this);
     }
     if ($this->cart->has_total_shipping_discount()) {
         $shipping = 0;
     }
     //initialize tax variables
     $tax = 0;
     $tax_rate = 0;
     //wpec_taxes - calculate product tax and add to total price
     $wpec_taxes_controller = new wpec_taxes_controller();
     if ($wpec_taxes_controller->wpec_taxes_isincluded() && $wpec_taxes_controller->wpec_taxes_isenabled()) {
         $taxes = $wpec_taxes_controller->wpec_taxes_calculate_included_tax($this);
         $tax_rate = $taxes['rate'];
         $tax = $taxes['tax'];
     }
     $wpdb->query($wpdb->prepare("INSERT INTO `" . WPSC_TABLE_CART_CONTENTS . "` (\n         `prodid`, `name`, `purchaseid`,  `price`, `pnp`,\n         `tax_charged`, `gst`, `quantity`, `donation`,\n         `no_shipping`, `custom_message`, `files`, `meta`\n      ) VALUES ('%d', '%s', '%d', '%s', '%s', '%s', '%s', '%s', '%d', '0', '%s', '%s', NULL)", $this->product_id, $this->product_name, $purchase_log_id, $this->unit_price, (double) $shipping, (double) $tax, (double) $tax_rate, $this->quantity, $this->is_donation, $this->custom_message, serialize($this->custom_file)));
     $cart_id = $wpdb->get_var("SELECT LAST_INSERT_ID() AS `id` FROM `" . WPSC_TABLE_CART_CONTENTS . "` LIMIT 1");
     wpsc_update_cartmeta($cart_id, 'sku', $this->sku);
     $downloads = get_option('max_downloads');
     if ($this->is_downloadable == true) {
         $product_files = (array) get_posts(array('post_type' => 'wpsc-product-file', 'post_parent' => $this->product_id, 'numberposts' => -1, 'post_status' => 'inherit'));
         foreach ($product_files as $file) {
             // if the file is downloadable, check that the file is real
             $unique_id = sha1(uniqid(mt_rand(), true));
             $wpdb->query("INSERT INTO `" . WPSC_TABLE_DOWNLOAD_STATUS . "` (\n               `product_id` , `fileid` ,\n               `purchid` , `cartid`,\n               `uniqueid`, `downloads`,\n               `active` , `datetime`\n            ) VALUES (\n               '{$this->product_id}', '{$file->ID}',\n               '{$purchase_log_id}', '{$cart_id}',\n               '{$unique_id}', '{$downloads}',\n               '0', NOW()\n            );");
             $download_id = $wpdb->get_var("SELECT LAST_INSERT_ID() AS `id` FROM `" . WPSC_TABLE_DOWNLOAD_STATUS . "` LIMIT 1");
             wpsc_update_meta($download_id, '_is_legacy', 'false', 'wpsc_downloads');
         }
     }
     do_action('wpsc_save_cart_item', $cart_id, $this->product_id);
 }
开发者ID:hornet9,项目名称:Morato,代码行数:43,代码来源:cart.class.php

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