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


PHP wpshop_tools::create_custom_hook方法代码示例

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


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

示例1: __construct

 public function __construct()
 {
     global $wpshop;
     $wpshop_paypal = new wpshop_paypal();
     // If the CIC payment method is active
     $wpshop_paymentMethod = get_option('wps_payment_mode');
     if (WPSHOP_PAYMENT_METHOD_CIC && (!empty($wpshop_paymentMethod['mode']) && !empty($wpshop_paymentMethod['mode']['cic']) && !empty($wpshop_paymentMethod['mode']['cic']['active']))) {
         $wpshop_cic = new wpshop_CIC();
     }
     wpshop_tools::create_custom_hook('wpshop_bankserver_reponse');
 }
开发者ID:fedeB-IT-dept,项目名称:fedeB_website,代码行数:11,代码来源:payment.class.php

示例2:

<div class="wps-boxed">
<?php 
echo wpshop_tools::create_custom_hook('wpshop_payment_actions');
// Empty the cart
$wps_cart->empty_cart();
?>
</div>
开发者ID:pronoSoupe,项目名称:pronobo_soupe,代码行数:7,代码来源:confirmation-others.php

示例3: process_checkout

 public static function process_checkout($paymentMethod = 'paypal', $order_id = 0, $customer_id = 0, $customer_billing_address_id = 0, $customer_shipping_address_id = 0)
 {
     global $wpdb, $wpshop, $wpshop_cart;
     $wps_message = new wps_message_ctr();
     $shipping_address_option = get_option('wpshop_shipping_address_choice');
     if (is_user_logged_in()) {
         $user_id = get_current_user_id();
         if ($customer_id != 0) {
             $user_id = $customer_id;
         }
         // If the order is already created in the db
         if (!empty($order_id) && is_numeric($order_id)) {
             $order = get_post_meta($order_id, '_order_postmeta', true);
             if (!empty($order)) {
                 if ($order['customer_id'] == $user_id) {
                     $order['payment_method'] = $paymentMethod;
                     $_SESSION['order_id'] = wpshop_tools::varSanitizer($order_id);
                     // Store cart in session
                     //wpshop_cart::store_cart_in_session($order);
                     // Add a payment
                     $order['order_payment']['received'][] = array('method' => $paymentMethod, 'waited_amount' => $order['order_amount_to_pay_now'], 'status' => 'waiting_payment', 'author' => get_current_user_id());
                     // On enregistre la commande
                     update_post_meta($order_id, '_order_postmeta', $order);
                     update_post_meta($order_id, '_wpshop_order_customer_id', $user_id);
                 } else {
                     $wpshop->add_error(__('You don\'t own the order', 'wpshop'));
                 }
             } else {
                 $wpshop->add_error(__('The order doesn\'t exist.', 'wpshop'));
             }
         } else {
             $order_data = array('post_type' => WPSHOP_NEWTYPE_IDENTIFIER_ORDER, 'post_title' => sprintf(__('Order - %s', 'wpshop'), mysql2date('d M Y\\, H:i:s', current_time('mysql', 0), true)), 'post_status' => 'publish', 'post_excerpt' => !empty($_POST['wps-customer-comment']) ? $_POST['wps-customer-comment'] : '', 'post_author' => $user_id, 'comment_status' => 'closed');
             // Cart items
             $order_items = array();
             $order_tva = array();
             //$cart = (array)$wpshop_cart->cart;
             if (!empty($_SESSION['cart']) && !empty($_SESSION['cart']['shipping_method'])) {
                 $_SESSION['cart']['shipping_method'] = __('Standard shipping method', 'wpshop');
             }
             $cart = (array) $_SESSION['cart'];
             $download_codes = array();
             // Nouvelle commande
             $order_id = wp_insert_post($order_data);
             $_SESSION['order_id'] = $order_id;
             // Cr�ation des codes de t�l�chargement si il y a des produits t�l�chargeable dans le panier
             if (!empty($cart['order_items'])) {
                 foreach ($cart['order_items'] as $c) {
                     $product = wpshop_products::get_product_data($c['item_id']);
                     /** Check if it's a variation and check the parent product **/
                     if (get_post_type($c['item_id']) == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION) {
                         $parent_def = wpshop_products::get_parent_variation($c['item_id']);
                         if (!empty($parent_def) && !empty($parent_def['parent_post_meta']) && !empty($parent_def['parent_post_meta']['is_downloadable_'])) {
                             $product['is_downloadable_'] = $parent_def['parent_post_meta']['is_downloadable_'];
                         }
                     }
                     if (!empty($product['is_downloadable_'])) {
                         $download_codes[$c['item_id']] = array('item_id' => $c['item_id'], 'download_code' => uniqid('', true));
                     }
                 }
             }
             if (!empty($download_codes)) {
                 update_user_meta($user_id, '_order_download_codes_' . $order_id, $download_codes);
             }
             // Informations de commande � stocker
             $currency = wpshop_tools::wpshop_get_currency(true);
             $order = array_merge(array('order_key' => NULL, 'customer_id' => $user_id, 'order_status' => 'awaiting_payment', 'order_date' => current_time('mysql', 0), 'order_shipping_date' => null, 'order_invoice_ref' => '', 'order_currency' => $currency, 'order_payment' => array('customer_choice' => array('method' => $paymentMethod), 'received' => array('0' => array('method' => $paymentMethod, 'waited_amount' => $cart['order_amount_to_pay_now'], 'status' => 'waiting_payment', 'author' => $user_id)), 'shipping_method' => !empty($_SESSION['shipping_method']) ? wpshop_tools::varSanitizer($_SESSION['shipping_method']) : __('Standard shipping method', 'wpshop'))), $cart);
             // Si c'est un devis
             if ($paymentMethod == 'quotation') {
                 $order['order_temporary_key'] = wpshop_orders::get_new_pre_order_reference();
             } else {
                 $order['order_key'] = wpshop_orders::get_new_order_reference();
             }
             //Round final amount
             $order['order_grand_total'] = number_format(round($order['order_grand_total'], 2), 2, '.', '');
             $order['order_total_ttc'] = number_format(round($order['order_total_ttc'], 2), 2, '.', '');
             $order['order_amount_to_pay_now'] = number_format(round($order['order_amount_to_pay_now'], 2), 2, '.', '');
             /** On enregistre la commande	*/
             update_post_meta($order_id, '_order_postmeta', $order);
             update_post_meta($order_id, '_wpshop_order_customer_id', $order['customer_id']);
             update_post_meta($order_id, '_wpshop_order_shipping_date', $order['order_shipping_date']);
             update_post_meta($order_id, '_wpshop_order_status', $order['order_status']);
             do_action('wps_order_extra_save', $order_id);
             //Add an action to extra actions on order save
             $args = array('order_id' => $order_id, 'posted_data' => $_REQUEST);
             wpshop_tools::create_custom_hook('wps_order_extra_save_action', $args);
             /**	Set custmer information for the order	*/
             $shipping_address = !empty($shipping_address_option) && !empty($shipping_address_option['activate']) ? !empty($_SESSION['shipping_address']) ? wpshop_tools::varSanitizer($_SESSION['shipping_address']) : $customer_shipping_address_id : '';
             $billing_address = !empty($_SESSION['billing_address']) ? wpshop_tools::varSanitizer($_SESSION['billing_address']) : $customer_billing_address_id;
             if (!empty($billing_address)) {
                 wpshop_orders::set_order_customer_addresses($user_id, $order_id, $shipping_address, $billing_address);
             }
             if (!empty($_SESSION['shipping_address_to_save'])) {
                 $order_infos_postmeta = get_post_meta($order_id, '_order_info', true);
                 $order_infos_postmeta['shipping']['address'] = $_SESSION['shipping_address_to_save'];
                 $order_infos_postmeta['shipping']['address_id'] = '';
                 update_post_meta($order_id, '_order_info', $order_infos_postmeta);
                 unset($_SESSION['shipping_address_to_save']);
             }
             /** Save Coupon use **/
             if (!empty($_SESSION['cart']['coupon_id'])) {
//.........这里部分代码省略.........
开发者ID:fedeB-IT-dept,项目名称:fedeB_website,代码行数:101,代码来源:checkout.class.php

示例4: wps_reload_mini_cart

 /** Ajax action to reload mini cart */
 public static function wps_reload_mini_cart()
 {
     $wps_cart = new wps_cart();
     $result = $wps_cart->mini_cart_content(sanitize_title($_POST['type']));
     $count_items = !empty($_SESSION) && !empty($_SESSION['cart']) && !empty($_SESSION['cart']['order_items']) ? $wps_cart->total_cart_items($_SESSION['cart']['order_items']) : 0;
     $free_shipping_alert = wpshop_tools::create_custom_hook('wpshop_free_shipping_cost_alert');
     echo json_encode(array('response' => $result, 'count_items' => $count_items, 'free_shipping_alert' => $free_shipping_alert));
     die;
 }
开发者ID:fedeB-IT-dept,项目名称:fedeB_website,代码行数:10,代码来源:wps_cart_ctr.php

示例5: get_current_user_id

require_once '../../../wp-load.php';
/*	Wordpress - Admin page that define some needed vars and include file	*/
require_once ABSPATH . 'wp-admin/includes/admin.php';
// T�l�chargement produit t�l�chargeable
if (!empty($_GET['download']) && !empty($_GET['oid'])) {
    $variation_id = '';
    if (is_user_logged_in()) {
        $user_id = get_current_user_id();
        $order = get_post_meta($_GET['oid'], '_order_postmeta', true);
        if (!empty($order)) {
            $download_codes = get_user_meta($user_id, '_order_download_codes_' . $_GET['oid'], true);
            if (!empty($download_codes) && is_array($download_codes)) {
                foreach ($download_codes as $downloadable_product_id => $d) {
                    $is_encrypted = false;
                    if ($d['download_code'] == $_GET['download']) {
                        wpshop_tools::create_custom_hook('encrypt_actions_for_downloadable_product', array('order_id' => $_GET['oid'], 'download_product_id' => $downloadable_product_id));
                        if (get_post_type($downloadable_product_id) == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION) {
                            $parent_def = wpshop_products::get_parent_variation($downloadable_product_id);
                            if (!empty($parent_def) && !empty($parent_def['parent_post'])) {
                                $parent_post = $parent_def['parent_post'];
                                $variation_id = $downloadable_product_id;
                                $downloadable_product_id = $parent_post->ID;
                            }
                        }
                        $link = wpshop_attributes::get_attribute_option_output(array('item_id' => $downloadable_product_id, 'item_is_downloadable_' => 'yes'), 'is_downloadable_', 'file_url', $order);
                        if ($link !== false) {
                            $uploads = wp_upload_dir();
                            $basedir = $uploads['basedir'];
                            $pos = strpos($link, 'uploads');
                            $link = $basedir . substr($link, $pos + 7);
                            /** If plugin is encrypted **/
开发者ID:fedeB-IT-dept,项目名称:fedeB_website,代码行数:31,代码来源:download_file.php

示例6: _e

    } else {
        ?>
	<button class="wps-bton-first-alignRight-rounded" id="wps-cart-order-action"><?php 
        _e('Order', 'wpshop');
        ?>
</button>
	<?php 
    }
    ?>
	<button class="wps-bton-second-alignRight-rounded emptyCart"><?php 
    _e('Empty the cart', 'wpshop');
    ?>
</button>
</div>
<div style="clear : both; text-align : right; padding : 8px 0; margin-top : 8px; font-size : 14px; font-style : italic; font-weight : bold; color : #C7CE06;"><span class="wps-mini-cart-free-shipping-alert"><?php 
    echo wpshop_tools::create_custom_hook('wpshop_free_shipping_cost_alert');
    ?>
</span></div>
<?php 
}
?>

<?php 
if (!empty($cart_type) && $cart_type == 'admin-panel' && (empty($cart_content['order_status']) || $cart_content['order_status'] == 'awaiting_payment')) {
    ?>
<button class="wps-bton-second-rounded alignRight" id="wps-orders-update-cart-informations"><i class="dashicons dashicons-update"></i><?php 
    _e('Update order informations', 'wpshop');
    ?>
</button>
<?php 
}
开发者ID:fedeB-IT-dept,项目名称:fedeB_website,代码行数:31,代码来源:cart-total.php

示例7: wps_checkout_valid_step_five

 /**
  * AJAX - Valid Checkout step four
  */
 function wps_checkout_valid_step_five()
 {
     $status = false;
     $response = '';
     $payment_method = !empty($_POST['wps-payment-method']) ? wpshop_tools::varSanitizer($_POST['wps-payment-method']) : null;
     $order_id = !empty($_SESSION['cart']['order_id']) ? wpshop_tools::varSanitizer($_SESSION['cart']['order_id']) : 0;
     $customer_comment = !empty($_POST['wps-customer-comment']) ? wpshop_tools::varSanitizer($_POST['wps-customer-comment']) : null;
     $terms_of_sale_checking = isset($_POST['terms_of_sale_indicator']) && !empty($_POST['terms_of_sale']) || !empty($_POST['terms_of_sale']) || !isset($_POST['terms_of_sale_indicator']) && empty($_POST['terms_of_sale']) ? true : false;
     if ($terms_of_sale_checking) {
         if (!empty($payment_method)) {
             /** Check if the payment method exist for the shop **/
             $payment_option = get_option('wps_payment_mode');
             if (!empty($payment_option) && !empty($payment_option['mode']) && array_key_exists($payment_method, $payment_option['mode']) && !empty($payment_option['mode'][$payment_method]['active'])) {
                 $order_id = wpshop_checkout::process_checkout($payment_method, $order_id, get_current_user_id(), $_SESSION['billing_address'], $_SESSION['shipping_address']);
                 if (!empty($order_id) && !empty($customer_comment)) {
                     wp_update_post(array('ID' => $order_id, 'post_excerpt' => $customer_comment));
                 }
                 $permalink_option = get_option('permalink_structure');
                 $checkout_page_id = wpshop_tools::get_page_id(get_option('wpshop_checkout_page_id'));
                 $response = get_permalink($checkout_page_id) . (!empty($permalink_option) ? '?' : '&') . 'order_step=6';
                 $_SESSION['payment_method'] = $payment_method;
                 $status = true;
                 //Add an action to extra actions on order save
                 $args = array('order_id' => $order_id, 'posted_data' => $_REQUEST);
                 wpshop_tools::create_custom_hook('wps_order_extra_save_action', $args);
             } else {
                 $response = '<div class="wps-alert-error">' . __('This payment method is unavailable', 'wpshop') . '</div>';
             }
         } else {
             $response = '<div class="wps-alert-error">' . __('You must choose a payment method', 'wpshop') . '</div>';
         }
     } else {
         $response = '<div class="wps-alert-error">' . __('You must accept the terms of sale to order', 'wpshop') . '</div>';
     }
     echo json_encode(array('status' => $status, 'response' => $response));
     die;
 }
开发者ID:fedeB-IT-dept,项目名称:fedeB_website,代码行数:40,代码来源:wps_classic_checkout.php


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