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

PHP get_wcmp_vendor函数代码示例

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

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



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

示例1: output

 /**
  * Output the vendor coupon shortcode.
  *
  * @access public
  * @param array $atts
  * @return void
  */
 public static function output($attr)
 {
     global $WCMp;
     $WCMp->nocache();
     $coupon_arr = array();
     if (!defined('MNDASHBAOARD')) {
         define('MNDASHBAOARD', true);
     }
     if (is_user_logged_in()) {
         $user = wp_get_current_user();
         if (is_user_wcmp_vendor($user->ID)) {
             $vendor = get_wcmp_vendor($user->ID);
             if ($vendor) {
                 $args = array('posts_per_page' => -1, 'post_type' => 'shop_coupon', 'author' => $user->ID, 'post_status' => 'any');
                 $coupons = get_posts($args);
                 if (!empty($coupons)) {
                     foreach ($coupons as $coupon) {
                         $coupon_arr[] += $coupon->ID;
                     }
                 }
             }
             $WCMp->template->get_template('shortcode/vendor_coupon.php', array('coupons' => $coupon_arr));
         }
     }
 }
开发者ID:qhuit,项目名称:UrbanPekor,代码行数:32,代码来源:class-wcmp-shortcode-vendor-used-coupon.php


示例2: output

    /**
     * Output the vendor transaction details shortcode.
     *
     * @access public
     * @param array $atts
     * @return void
     */
    public static function output($attr)
    {
        global $WCMp;
        $WCMp->nocache();
        $transaction_ids = array();
        if (!defined('MNDASHBAOARD')) {
            define('MNDASHBAOARD', true);
        }
        $suffix = defined('WCMP_SCRIPT_DEBUG') && WCMP_SCRIPT_DEBUG ? '' : '.min';
        wp_enqueue_script('jquery-ui-datepicker');
        wp_enqueue_style('jquery_ui_css', $WCMp->plugin_url . 'assets/frontend/css/jquery-ui' . $suffix . '.css', array(), $WCMp->version);
        $frontend_script_path = $WCMp->plugin_url . 'assets/frontend/js/';
        $frontend_script_path = str_replace(array('http:', 'https:'), '', $frontend_script_path);
        $pluginURL = str_replace(array('http:', 'https:'), '', $WCMp->plugin_url);
        wp_enqueue_script('trans_dtl_js', $frontend_script_path . 'transaction_detail' . $suffix . '.js', array('jquery'), $WCMp->version, true);
        $user_id = get_current_user_id();
        if (is_user_wcmp_vendor($user_id)) {
            $vendor = get_wcmp_vendor($user_id);
            $start_date = date('01-m-Y');
            $end_date = date('t-m-Y');
            if ($_SERVER['REQUEST_METHOD'] == 'GET') {
                if (!empty($_GET['from_date']) && !empty($_GET['to_date'])) {
                    $transaction_details = $WCMp->transaction->get_transactions($vendor->term_id, $_GET['from_date'], $_GET['to_date'], false);
                } else {
                    if (!empty($_GET['from_date'])) {
                        $transaction_details = $WCMp->transaction->get_transactions($vendor->term_id, $_GET['from_date'], date('j-n-Y'), false);
                    } else {
                        $transaction_details = $WCMp->transaction->get_transactions($vendor->term_id, $start_date, $end_date, false);
                    }
                }
            } else {
                $transaction_details = $WCMp->transaction->get_transactions($vendor->term_id, $start_date, $end_date, false);
            }
            if (!empty($transaction_details)) {
                foreach ($transaction_details as $transaction_id => $detail) {
                    $transaction_ids[] = $transaction_id;
                }
            }
            ?>
			<div class="wcmp_remove_div">
				<div class="wcmp_main_page"> 
					<?php 
            $WCMp->template->get_template('vendor_dashboard_menu.php', array('selected_item' => 'history'));
            $WCMp->template->get_template('shortcode/vendor_transactions.php', array('transactions' => $transaction_ids));
            wp_localize_script('trans_dtl_js', 'wcmp_vendor_transactions_array', $transaction_ids);
            ?>
				</div>
			</div>
		<?php 
        }
    }
开发者ID:qhuit,项目名称:UrbanPekor,代码行数:58,代码来源:class-wcmp-shortcode-vendor-transaction.php


示例3: output

    /**
     * Output the shop settings shortcode.
     *
     * @access public
     * @param array $atts
     * @return void
     */
    public static function output($attr)
    {
        global $WCMp;
        $WCMp->nocache();
        if (!defined('MNDASHBAOARD')) {
            define('MNDASHBAOARD', true);
        }
        $frontend_script_path = $WCMp->plugin_url . 'assets/frontend/js/';
        $frontend_script_path = str_replace(array('http:', 'https:'), '', $frontend_script_path);
        $pluginURL = str_replace(array('http:', 'https:'), '', $WCMp->plugin_url);
        $suffix = defined('WCMP_SCRIPT_DEBUG') && WCMP_SCRIPT_DEBUG ? '' : '.min';
        wp_enqueue_script('wcmp_profile_edit_js', $frontend_script_path . '/profile_edit' . $suffix . '.js', array('jquery'), $WCMp->version, true);
        $user_id = get_current_user_id();
        $vendor = get_wcmp_vendor($user_id);
        $is_saved = 0;
        if ($_SERVER['REQUEST_METHOD'] == 'POST') {
            if (isset($_POST['store_save'])) {
                $WCMp->vendor_dashboard->save_store_settings($vendor->id, $_POST);
                $is_saved = 1;
            }
        }
        $user_array = $WCMp->user->get_vendor_fields($vendor->id);
        $user_array['is_shop_settings_saved'] = $is_saved;
        ?>
		<?php 
        if ($user_array['is_shop_settings_saved'] == 1) {
            ?>
						<div style="margin-bottom:10px; width:98%;" class="green_massenger"><i class="fa fa-check"></i> &nbsp; <?php 
            _e('All Options Saved', $WCMp->text_domain);
            ?>
</div>
						
					<?php 
        }
        ?>
		<div class="wcmp_remove_div">
		
			<div class="wcmp_main_page">  <?php 
        $WCMp->template->get_template('vendor_dashboard_menu.php', array('selected_item' => 'shop_front'));
        $WCMp->template->get_template('shortcode/shop_settings.php', $user_array);
        ?>
			</div>
		</div>
		<?php 
    }
开发者ID:qhuit,项目名称:UrbanPekor,代码行数:52,代码来源:class-wcmp-shortcode-vendor-shop-settings.php


示例4: output

    /**
     * Output the vendor dashboard shortcode.
     *
     * @access public
     * @param array $atts
     * @return void
     */
    public static function output($attr)
    {
        global $WCMp;
        $WCMp->nocache();
        if (!defined('MNDASHBAOARD')) {
            define('MNDASHBAOARD', true);
        }
        $suffix = defined('WCMP_SCRIPT_DEBUG') && WCMP_SCRIPT_DEBUG ? '' : '.min';
        $frontend_script_path = $WCMp->plugin_url . 'assets/frontend/js/';
        $frontend_script_path = str_replace(array('http:', 'https:'), '', $frontend_script_path);
        $pluginURL = str_replace(array('http:', 'https:'), '', $WCMp->plugin_url);
        wp_enqueue_script('wcmp_frontend_vdashboard_js', $frontend_script_path . 'wcmp_vendor_dashboard' . $suffix . '.js', array('jquery'), $WCMp->version, true);
        $user = wp_get_current_user();
        if (is_user_logged_in()) {
            if (is_user_wcmp_vendor($user->ID)) {
                $vendor = get_wcmp_vendor($user->ID);
                $vendor_all_orders = $vendor->get_orders();
                if ($vendor_all_orders) {
                    $count_orders = count($vendor_all_orders);
                } else {
                    $count_orders = 0;
                }
                $customer_orders = array();
                $customer_orders = $vendor->get_orders(5, 0);
                ?>
				<div class="wcmp_remove_div">
					<div class="wcmp_main_page"> 
						<?php 
                $WCMp->template->get_template('vendor_dashboard_menu.php', array('selected_item' => 'dashboard'));
                $WCMp->template->get_template('shortcode/vendor_dashboard.php', array('vendor' => $vendor, 'customer_orders' => $customer_orders));
                ?>
 
					</div>
				</div>
				<?php 
            } else {
                $WCMp->template->get_template('shortcode/non_vendor_dashboard.php');
            }
        }
    }
开发者ID:qhuit,项目名称:UrbanPekor,代码行数:47,代码来源:class-wcmp-shortcode-vendor-dashboard.php


示例5: output

    /**
     * Output the vendor report shortcode.
     *
     * @access public
     * @param array $atts
     * @return void
     */
    public static function output($attr)
    {
        global $WCMp;
        $WCMp->nocache();
        if (!defined('MNDASHBAOARD')) {
            define('MNDASHBAOARD', true);
        }
        $user = wp_get_current_user();
        if (is_user_logged_in()) {
            if (is_user_wcmp_vendor($user->ID)) {
                if (isset($_GET['wcmp_stat_start_dt'])) {
                    $start_date = $_GET['wcmp_stat_start_dt'];
                } else {
                    $start_date = date('01-m-Y');
                }
                // hard-coded '01' for first day
                if (isset($_GET['wcmp_stat_end_dt'])) {
                    $end_date = $_GET['wcmp_stat_end_dt'];
                } else {
                    $end_date = date('t-m-Y');
                }
                // hard-coded '01' for first day
                $vendor = get_wcmp_vendor($user->ID);
                $WCMp_Plugin_Post_Reports = new WCMp_Report();
                $array_report = $WCMp_Plugin_Post_Reports->vendor_sales_stat_overview($vendor, $start_date, $end_date);
                ?>
				<div class="wcmp_remove_div">
					<div class="wcmp_main_page"> 
						<?php 
                $WCMp->template->get_template('vendor_dashboard_menu.php', array('selected_item' => 'vendor_report'));
                $WCMp->template->get_template('shortcode/vendor_report.php', $array_report);
                ?>
 
					</div>
				</div>
				<?php 
            }
        }
    }
开发者ID:qhuit,项目名称:UrbanPekor,代码行数:46,代码来源:class-wcmp-shortcode-vendor-report.php


示例6: output

    /**
     * Output the vendor dashboard shortcode.
     *
     * @access public
     * @param array $atts
     * @return void
     */
    public static function output($attr)
    {
        global $WCMp;
        $WCMp->nocache();
        if (!defined('MNDASHBAOARD')) {
            define('MNDASHBAOARD', true);
        }
        $user = wp_get_current_user();
        $vendor = get_wcmp_vendor($user->ID);
        if ($vendor) {
            $frontend_script_path = $WCMp->plugin_url . 'assets/frontend/js/';
            $frontend_script_path = str_replace(array('http:', 'https:'), '', $frontend_script_path);
            $pluginURL = str_replace(array('http:', 'https:'), '', $WCMp->plugin_url);
            $suffix = defined('WCMP_SCRIPT_DEBUG') && WCMP_SCRIPT_DEBUG ? '' : '.min';
            wp_enqueue_script('vendor_withdrawal_js', $frontend_script_path . 'vendor_withdrawal' . $suffix . '.js', array('jquery'), $WCMp->version, true);
            $meta_query['meta_query'] = array(array('key' => '_paid_status', 'value' => 'unpaid', 'compare' => '='), array('key' => '_commission_vendor', 'value' => absint($vendor->term_id), 'compare' => '='));
            $vendor_all_orders = $vendor->get_orders(false, false, $meta_query);
            if ($vendor_all_orders) {
                $count_orders = count($vendor_all_orders);
            } else {
                $count_orders = 0;
            }
            $customer_orders = array();
            $customer_orders = $vendor->get_orders(6, 0, $meta_query);
            ?>
			<div class="wcmp_remove_div">
				<div class="wcmp_main_page"> 
					<?php 
            $WCMp->template->get_template('vendor_dashboard_menu.php', array('selected_item' => 'widthdrawal'));
            $WCMp->template->get_template('shortcode/vendor_withdrawal.php', array('vendor' => $vendor, 'commissions' => $customer_orders, 'total_orders' => $count_orders));
            ?>
				</div>
			</div>
			<?php 
        }
    }
开发者ID:qhuit,项目名称:UrbanPekor,代码行数:43,代码来源:class-wcmp-shortcode-vendor-widthdrawal-settings.php


示例7: vendor_sales_stat_overview

 /**
  * get vendor commission by date
  *
  * @access public
  * @param mixed $vars
  * @return array
  */
 public function vendor_sales_stat_overview($vendor, $start_date = false, $end_date = false)
 {
     global $WCMp;
     $total_sales = 0;
     $total_vendor_earnings = 0;
     $total_order_count = 0;
     $total_purchased_products = 0;
     $total_coupon_used = 0;
     $total_coupon_discuont_value = 0;
     $total_earnings = 0;
     $total_customers = array();
     $vendor = get_wcmp_vendor(get_current_user_id());
     for ($date = strtotime($start_date); $date <= strtotime('+1 day', strtotime($end_date)); $date = strtotime('+1 day', $date)) {
         $year = date('Y', $date);
         $month = date('n', $date);
         $day = date('j', $date);
         $line_total = $sales = $comm_amount = $vendor_earnings = $earnings = 0;
         $args = array('post_type' => 'shop_order', 'posts_per_page' => -1, 'post_status' => array('wc-pending', 'wc-processing', 'wc-on-hold', 'wc-completed', 'wc-cancelled', 'wc-refunded', 'wc-failed'), 'meta_query' => array(array('key' => '_commissions_processed', 'value' => 'yes', 'compare' => '=')), 'date_query' => array(array('year' => $year, 'month' => $month, 'day' => $day)));
         $qry = new WP_Query($args);
         $orders = apply_filters('wcmp_filter_orders_report_overview', $qry->get_posts(), $vendor->id);
         if (!empty($orders)) {
             foreach ($orders as $order_obj) {
                 $order = new WC_Order($order_obj->ID);
                 $items = $order->get_items('line_item');
                 $commission_array = array();
                 foreach ($items as $item_id => $item) {
                     $comm_pro_id = $product_id = $order->get_item_meta($item_id, '_product_id', true);
                     $line_total = $order->get_item_meta($item_id, '_line_total', true);
                     $variation_id = $order->get_item_meta($item_id, '_variation_id', true);
                     if ($variation_id) {
                         $comm_pro_id = $variation_id;
                     }
                     if ($product_id && $line_total) {
                         $product_vendors = get_wcmp_product_vendors($product_id);
                         if ($product_vendors) {
                             $sales += $line_total;
                             $total_sales += $line_total;
                             $args = array('post_type' => 'dc_commission', 'post_status' => array('publish', 'private'), 'posts_per_page' => -1, 'meta_query' => array(array('key' => '_commission_vendor', 'value' => absint($product_vendors->term_id), 'compare' => '='), array('key' => '_commission_order_id', 'value' => absint($order_obj->ID), 'compare' => '='), array('key' => '_commission_product', 'value' => absint($comm_pro_id), 'compare' => 'LIKE')));
                             $commissions = get_posts($args);
                             $comm_amount = 0;
                             if (!empty($commissions)) {
                                 foreach ($commissions as $commission) {
                                     if (in_array($commission->ID, $commission_array)) {
                                         continue;
                                     }
                                     $comm_amount += (double) get_post_meta($commission->ID, '_commission_amount', true);
                                     $commission_array[] = $commission->ID;
                                 }
                             }
                             $vendor_earnings += $comm_amount;
                             $total_vendor_earnings += $comm_amount;
                             $earnings += $line_total - $comm_amount;
                             $total_earnings += $line_total - $comm_amount;
                             $total_purchased_products++;
                         }
                     }
                 }
                 //coupons count
                 $coupon_used = array();
                 $coupons = $order->get_items('coupon');
                 foreach ($coupons as $coupon_item_id => $item) {
                     $coupon = new WC_Coupon(trim($item['name']));
                     $coupon_post = get_post($coupon->id);
                     $author_id = $coupon_post->post_author;
                     if ($vendor->id == $author_id) {
                         $total_coupon_used++;
                         $total_coupon_discuont_value += (double) wc_add_order_item_meta($coupon_item_id, 'discount_amount', true);
                     }
                 }
                 ++$total_order_count;
                 //user count
                 if ($order->customer_user != 0 && $order->customer_user != 1) {
                     array_push($total_customers, $order->customer_user);
                 }
             }
         }
     }
     return array('total_order_count' => $total_order_count, 'total_vendor_sales' => $total_sales, 'total_vendor_earning' => $total_vendor_earnings, 'total_coupon_discuont_value' => $total_coupon_discuont_value, 'total_coupon_used' => $total_coupon_used, 'total_customers' => array_unique($total_customers), 'total_purchased_products' => $total_purchased_products);
 }
开发者ID:itsunus,项目名称:wstore,代码行数:86,代码来源:class-wcmp-report.php


示例8: reject_pending_vendor

 /**
  * Reject Pending Vendor via AJAX
  *
  * @return void
  */
 function reject_pending_vendor()
 {
     global $WCMp;
     $user_id = $_POST['user_id'];
     $user = new WP_User(absint($user_id));
     if (is_array($user->roles) && in_array('dc_pending_vendor', $user->roles)) {
         $user->remove_role('dc_pending_vendor');
     }
     $user->add_role('dc_rejected_vendor');
     $user_dtl = get_userdata(absint($user_id));
     $email = WC()->mailer()->emails['WC_Email_Rejected_New_Vendor_Account'];
     $email->trigger($user_id, $user_dtl->user_pass);
     if (in_array('dc_vendor', $old_role)) {
         $vendor = get_wcmp_vendor($user_id);
         if ($vendor) {
             wp_delete_term($vendor->term_id, 'dc_vendor_shop');
         }
     }
     wp_delete_user($user_id);
     die;
 }
开发者ID:itsunus,项目名称:wstore,代码行数:26,代码来源:class-wcmp-ajax.php


示例9: get_commission_amount

 /**
  * Get assigned commission percentage
  *
  * @param  int $product_id ID of product
  * @param  int $vendor_id  ID of vendor
  * @return int             Relevent commission percentage
  */
 public function get_commission_amount($product_id = 0, $vendor_id = 0, $variation_id = 0, $item_id = '', $order = array())
 {
     global $WCMp;
     $data = array();
     if ($product_id > 0 && $vendor_id > 0) {
         $vendor_idd = $order->get_item_meta($item_id, '_vendor_id', true);
         if ($vendor_idd) {
             $vendor = get_wcmp_vendor($vendor_idd);
         } else {
             $vendor = get_wcmp_product_vendors($product_id);
         }
         if ($vendor->term_id == $vendor_id) {
             if ($WCMp->vendor_caps->payment_cap['commission_type'] == 'fixed_with_percentage') {
                 if ($variation_id > 0) {
                     $data['commission_val'] = get_post_meta($variation_id, '_product_vendors_commission_percentage', true);
                     $data['commission_fixed'] = get_post_meta($variation_id, '_product_vendors_commission_fixed_per_trans', true);
                     if (empty($data)) {
                         $data['commission_val'] = get_post_meta($product_id, '_commission_percentage_per_product', true);
                         $data['commission_fixed'] = get_post_meta($product_id, '_commission_fixed_with_percentage', true);
                     }
                 } else {
                     $data['commission_val'] = get_post_meta($product_id, '_commission_percentage_per_product', true);
                     $data['commission_fixed'] = get_post_meta($product_id, '_commission_fixed_with_percentage', true);
                 }
                 if (!empty($data['commission_val'])) {
                     return $data;
                     // Use product commission percentage first
                 } else {
                     $vendor_commission_percentage = 0;
                     $vendor_commission_percentage = get_user_meta($vendor->id, '_vendor_commission_percentage', true);
                     $vendor_commission_fixed_with_percentage = 0;
                     $vendor_commission_fixed_with_percentage = get_user_meta($vendor->id, '_vendor_commission_fixed_with_percentage', true);
                     if ($vendor_commission_percentage > 0) {
                         return array('commission_val' => $vendor_commission_percentage, 'commission_fixed' => $vendor_commission_fixed_with_percentage);
                         // Use vendor user commission percentage
                     } else {
                         if (isset($WCMp->vendor_caps->payment_cap['default_percentage'])) {
                             return array('commission_val' => $WCMp->vendor_caps->payment_cap['default_percentage'], 'commission_fixed' => $WCMp->vendor_caps->payment_cap['fixed_with_percentage']);
                         } else {
                             return false;
                         }
                     }
                 }
             } else {
                 if ($WCMp->vendor_caps->payment_cap['commission_type'] == 'fixed_with_percentage_qty') {
                     if ($variation_id > 0) {
                         $data['commission_val'] = get_post_meta($variation_id, '_product_vendors_commission_percentage', true);
                         $data['commission_fixed'] = get_post_meta($variation_id, '_product_vendors_commission_fixed_per_qty', true);
                         if (!$data) {
                             $data['commission_val'] = get_post_meta($product_id, '_commission_percentage_per_product', true);
                             $data['commission_fixed'] = get_post_meta($product_id, '_commission_fixed_with_percentage_qty', true);
                         }
                     } else {
                         $data['commission_val'] = get_post_meta($product_id, '_commission_percentage_per_product', true);
                         $data['commission_fixed'] = get_post_meta($product_id, '_commission_fixed_with_percentage_qty', true);
                     }
                     if (!empty($data['commission_val'])) {
                         return $data;
                         // Use product commission percentage first
                     } else {
                         $vendor_commission_percentage = 0;
                         $vendor_commission_fixed_with_percentage = 0;
                         $vendor_commission_percentage = get_user_meta($vendor->id, '_vendor_commission_percentage', true);
                         $vendor_commission_fixed_with_percentage = get_user_meta($vendor->id, '_vendor_commission_fixed_with_percentage_qty', true);
                         if ($vendor_commission_percentage > 0) {
                             return array('commission_val' => $vendor_commission_percentage, 'commission_fixed' => $vendor_commission_fixed_with_percentage);
                             // Use vendor user commission percentage
                         } else {
                             if (isset($WCMp->vendor_caps->payment_cap['default_percentage'])) {
                                 return array('commission_val' => $WCMp->vendor_caps->payment_cap['default_percentage'], 'commission_fixed' => $WCMp->vendor_caps->payment_cap['fixed_with_percentage_qty']);
                             } else {
                                 return false;
                             }
                         }
                     }
                 } else {
                     if ($variation_id > 0) {
                         $data['commission_val'] = get_post_meta($variation_id, '_product_vendors_commission', true);
                         if (!$data) {
                             $data['commission_val'] = get_post_meta($product_id, '_commission_per_product', true);
                         }
                     } else {
                         $data['commission_val'] = get_post_meta($product_id, '_commission_per_product', true);
                     }
                     if (!empty($data['commission_val'])) {
                         return $data;
                         // Use product commission percentage first
                     } else {
                         $vendor_commission = get_user_meta($vendor->id, '_vendor_commission', true);
                         if ($vendor_commission) {
                             return array('commission_val' => $vendor_commission);
                             // Use vendor user commission percentage
                         } else {
//.........这里部分代码省略.........
开发者ID:itsunus,项目名称:wstore,代码行数:101,代码来源:class-wcmp-calculate-commission.php


示例10: output_report

    /**
     * Output the report
     */
    public function output_report()
    {
        global $wpdb, $woocommerce, $WCMp;
        $ranges = array('year' => __('Year', $WCMp->text_domain), 'last_month' => __('Last Month', $WCMp->text_domain), 'month' => __('This Month', $WCMp->text_domain), '7day' => __('Last 7 Days', $WCMp->text_domain));
        $current_range = !empty($_GET['range']) ? sanitize_text_field($_GET['range']) : '7day';
        if (!in_array($current_range, array('custom', 'year', 'last_month', 'month', '7day'))) {
            $current_range = '7day';
        }
        $this->calculate_current_range($current_range);
        if (isset($_POST['search_product'])) {
            $is_variation = false;
            $product_id = $_POST['search_product'];
            $_product = get_product($product_id);
            if ($_product->is_type('variation')) {
                $title = $_product->get_formatted_name();
                $is_variation = true;
            } else {
                $title = $_product->get_title();
            }
        }
        if (isset($product_id)) {
            $option = '<option value="' . $product_id . '" selected="selected">' . $title . '</option>';
        } else {
            $option = '<option></option>';
        }
        $start_date = $this->start_date;
        $end_date = $this->end_date;
        $end_date = strtotime('+1 day', $end_date);
        $products = $product_ids = array();
        $vendor = false;
        $current_user_id = '';
        $current_user_id = get_current_user_id();
        $vendor = get_wcmp_vendor($current_user_id);
        if ($vendor) {
            $products = $vendor->get_products();
            foreach ($products as $product) {
                $product_ids[] = $product->ID;
            }
        } else {
            $args = array('posts_per_page' => -1, 'offset' => 0, 'orderby' => 'date', 'order' => 'DESC', 'post_type' => 'product', 'post_status' => 'publish');
            $products = get_posts($args);
            foreach ($products as $product) {
                $product_ids[] = $product->ID;
            }
        }
        $total_sales = $admin_earnings = array();
        $max_total_sales = $index = 0;
        $product_report = $report_bk = array();
        if (isset($product_ids) && !empty($product_ids)) {
            foreach ($product_ids as $product_id) {
                $is_variation = false;
                $_product = array();
                $vendor = false;
                $_product = get_product($product_id);
                if ($_product->is_type('variation')) {
                    $title = $_product->get_formatted_name();
                    $is_variation = true;
                } else {
                    $title = $_product->get_title();
                }
                if (isset($product_id) && !$is_variation) {
                    $vendor = get_wcmp_product_vendors($product_id);
                } else {
                    if (isset($product_id) && $is_variation) {
                        $variation_parent = wp_get_post_parent_id($product_id);
                        $vendor = get_wcmp_product_vendors($variation_parent);
                    }
                }
                if ($vendor) {
                    $orders = array();
                    if ($_product->is_type('variable')) {
                        $get_children = $_product->get_children();
                        if (!empty($get_children)) {
                            foreach ($get_children as $child) {
                                $orders = array_merge($orders, $vendor->get_vendor_orders_by_product($vendor->term_id, $child));
                            }
                            $orders = array_unique($orders);
                        }
                    } else {
                        $orders = array_unique($vendor->get_vendor_orders_by_product($vendor->term_id, $product_id));
                    }
                }
                $order_items = array();
                $i = 0;
                if (!empty($orders)) {
                    foreach ($orders as $order_id) {
                        $order = new WC_Order($order_id);
                        $order_line_items = $order->get_items('line_item');
                        if (!empty($order_line_items)) {
                            foreach ($order_line_items as $line_item) {
                                if ($line_item['product_id'] == $product_id) {
                                    if ($_product->is_type('variation')) {
                                        $order_items_product_id = $line_item['product_id'];
                                        $order_items_variation_id = $line_item['variation_id'];
                                    } else {
                                        $order_items_product_id = $line_item['product_id'];
                                        $order_items_variation_id = $line_item['variation_id'];
//.........这里部分代码省略.........
开发者ID:qhuit,项目名称:UrbanPekor,代码行数:101,代码来源:class-wcmp-report-product.php


示例11: get_option

<?php

global $WCMp;
$pages = get_option('wcmp_pages_settings_name');
$vendor = get_wcmp_vendor(get_current_user_id());
$notice_data = get_option('wcmp_notices_settings_name');
$notice_to_be_display = '';
if (!isset($selected_item)) {
    $selected_item = '';
}
if (!$vendor->image) {
    $vendor->image = $WCMp->plugin_url . 'assets/images/WP-stdavatar.png';
}
$wcmp_payment_settings_name = get_option('wcmp_payment_settings_name');
$_vendor_give_shipping = get_user_meta(get_current_user_id(), '_vendor_give_shipping', true);
$wcmp_capabilities_settings_name = get_option('wcmp_capabilities_settings_name');
$_vendor_submit_coupon = get_user_meta(get_current_user_id(), '_vendor_submit_coupon', true);
$policies_settings = get_option('wcmp_general_policies_settings_name');
$customer_support_details_settings = get_option('wcmp_general_customer_support_details_settings_name');
$is_policy_show_in_menu = 0;
$is_university_show_in_menu = 0;
if (isset($policies_settings['is_policy_on']) && isset($wcmp_capabilities_settings_name['policies_can_override_by_vendor']) || isset($customer_support_details_settings['is_customer_support_details']) && isset($wcmp_capabilities_settings_name['can_vendor_add_customer_support_details'])) {
    $is_policy_show_in_menu = 1;
}
$general_settings = get_option('wcmp_general_settings_name');
if (isset($general_settings['is_university_on'])) {
    $is_university_show_in_menu = 1;
}
?>
<div class="wcmp_side_menu">
	<div class="wcmp_top_logo_div"> <img src="<?php 
开发者ID:itsunus,项目名称:wstore,代码行数:31,代码来源:vendor_dashboard_menu.php


示例12: save_store_settings

 function save_store_settings($user_id, $post)
 {
     global $WCMp;
     $vendor = get_wcmp_vendor($user_id);
     $fields = $WCMp->user->get_vendor_fields($user_id);
     foreach ($fields as $fieldkey => $value) {
         if (isset($post[$fieldkey])) {
             if ($fieldkey == "vendor_page_slug" && !empty($post[$fieldkey])) {
                 if ($vendor && !$vendor->update_page_slug(wc_clean($_POST[$fieldkey]))) {
                     echo _e('Slug already exists', $WCMp->text_domain);
                 } else {
                     update_user_meta($user_id, '_' . $fieldkey, wc_clean($post[$fieldkey]));
                 }
                 continue;
             }
             if ($fieldkey == 'vendor_description') {
                 update_user_meta($user_id, '_' . $fieldkey, $post[$fieldkey]);
             } else {
                 update_user_meta($user_id, '_' . $fieldkey, wc_clean($post[$fieldkey]));
             }
             if ($fieldkey == 'vendor_page_title') {
                 if (!$vendor->update_page_title(wc_clean($post[$fieldkey]))) {
                     echo _e('Shop Title Update Error', $WCMp->text_domain);
                 } else {
                     wp_update_user(array('ID' => $user_id, 'display_name' => $post[$fieldkey]));
                 }
             }
         } else {
             if (!isset($post['vendor_hide_description']) && $fieldkey == 'vendor_hide_description') {
                 delete_user_meta($user_id, '_vendor_hide_description');
             } else {
                 if (!isset($post['vendor_hide_email']) && $fieldkey == 'vendor_hide_email') {
                     delete_user_meta($user_id, '_vendor_hide_email');
                 } else {
                     if (!isset($post['vendor_hide_address']) && $fieldkey == 'vendor_hide_address') {
                         delete_user_meta($user_id, '_vendor_hide_address');
                     } else {
                         if (!isset($post['vendor_hide_phone']) && $fieldkey == 'vendor_hide_phone') {
                             delete_user_meta($user_id, '_vendor_hide_phone');
                         } else {
                             if (!isset($post['vendor_hide_message_to_buyers']) && $fieldkey == 'vendor_hide_message_to_buyers') {
                                 delete_user_meta($user_id, '_vendor_hide_message_to_buyers');
                             }
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:qhuit,项目名称:UrbanPekor,代码行数:50,代码来源:class-wcmp-vendor-dashboard.php


示例13: json_filter_report_products

 /**
  * Filter product search with vendor specific
  *
  * @access public
  * @return void
  */
 function json_filter_report_products($products)
 {
     $current_userid = get_current_user_id();
     $filtered_product = array();
     if (is_user_wcmp_vendor($current_userid)) {
         $vendor = get_wcmp_vendor($current_userid);
         $vendor_products = $vendor->get_products();
         if (!empty($vendor_products)) {
             foreach ($vendor_products as $vendor_product) {
                 if (isset($products[$vendor_product->ID])) {
                     $filtered_product[$vendor_product->ID] = $products[$vendor_product->ID];
                 }
             }
         }
         $products = $filtered_product;
     }
     return $products;
 }
开发者ID:qhuit,项目名称:UrbanPekor,代码行数:24,代码来源:class-wcmp-coupon.php


示例14: output_capability_css

    /**
     * Set output capability css
     */
    function output_capability_css()
    {
        global $post;
        $screen = get_current_screen();
        $custom_css = '';
        if (in_array($screen->id, array('product'))) {
            if (is_user_wcmp_vendor(get_current_user_id())) {
                if (!$this->vendor_can('taxes')) {
                    $custom_css .= '
					._tax_status_field, ._tax_class_field {
						display: none !important;
					}
					';
                }
                if (!$this->vendor_can('add_comment')) {
                    $custom_css .= '
					.comments-box {
						display: none !important;
					}
					';
                }
                if (!$this->vendor_can('comment_box')) {
                    $custom_css .= '
					#add-new-comment {
						display: none !important;
					}
					';
                }
                if ($this->vendor_can('stylesheet')) {
                    $custom_css .= $this->capability['stylesheet'];
                }
                $vendor_id = get_current_user_id();
                $vendor = get_wcmp_vendor($vendor_id);
                if ($vendor && $post->post_author != $vendor_id) {
                    $custom_css .= '.options_group.pricing.show_if_simple.show_if_external {
														display: none !important;
													}';
                }
                wp_add_inline_style('woocommerce_admin_styles', $custom_css);
            }
        }
    }
开发者ID:itsunus,项目名称:wstore,代码行数:45,代码来源:class-wcmp-capabilities.php


示例15: output

    /**
     * Output the Vendor Orders shortcode.
     *
     * @access public
     * @param array $atts
     * @return void
     */
    public static function output($attr)
    {
        global $woocommerce, $WCMp, $wpdb;
        $WCMp->nocache();
        if (!defined('MNDASHBAOARD')) {
            define('MNDASHBAOARD', true);
        }
        $frontend_script_path = $WCMp->plugin_url . 'assets/frontend/js/';
        $frontend_script_path = str_replace(array('http:', 'https:'), '', $frontend_script_path);
        $pluginURL = str_replace(array('http:', 'https:'), '', $WCMp->plugin_url);
        $suffix = defined('WCMP_SCRIPT_DEBUG') && WCMP_SCRIPT_DEBUG ? '' : '.min';
        wp_enqueue_script('vendor_orders_js', $frontend_script_path . 'vendor_orders' . $suffix . '.js', array('jquery'), $WCMp->version, true);
        wp_localize_script('vendor_orders_js', 'wcmp_mark_shipped_text', array('text' => __('Order is marked as shipped.', $WCMp->text_domain), 'image' => $WCMp->plugin_url . 'assets/images/roket-green.png'));
        $user = wp_get_current_user();
        $vendor = get_wcmp_vendor($user->ID);
        if ($vendor) {
            if (!empty($_GET['wcmp_start_date_order'])) {
                $start_date = $_GET['wcmp_start_date_order'];
            } else {
                $start_date = date('01-m-Y');
            }
            // hard-coded '01' for first day
            if (!empty($_GET['wcmp_end_date_order'])) {
                $end_date = $_GET['wcmp_end_date_order'];
            } else {
                $end_date = date('t-m-Y');
            }
            // hard-coded '01' for first day
            $start_date = date('Y-m-d G:i:s', strtotime($start_date));
            $end_date = date('Y-m-d G:i:s', strtotime($end_date . ' +1 day'));
            $customer_orders = $wpdb->get_results("SELECT DISTINCT order_id from `{$wpdb->prefix}wcmp_vendor_orders` where commission_id > 0 AND vendor_id = '" . $vendor->id . "' AND (`created` >= '" . $start_date . "' AND `created` <= '" . $end_date . "') ORDER BY `created` ASC", ARRAY_A);
            $orders_array = array();
            if (!empty($customer_orders)) {
                foreach ($customer_orders as $order_obj) {
                    if (isset($order_obj['order_id'])) {
                        if (get_post_status($order_obj['order_id']) == 'wc-completed') {
                            $orders_array['completed'][] = $order_obj['order_id'];
                        } else {
                            if (get_post_status($order_obj['order_id']) == 'wc-processing') {
                                $orders_array['processing'][] = $order_obj['order_id'];
                            }
                        }
                        $orders_array['all'][] = $order_obj['order_id'];
                    }
                }
            }
            if (!isset($orders_array['all'])) {
                $orders_array['all'] = array();
            }
            if (!isset($orders_array['processing'])) {
                $orders_array['processing'] = array();
            }
            if (!isset($orders_array['completed'])) {
                $orders_array['completed'] = array();
            }
            ?>
			<div class="wcmp_remove_div">
				<div class="wcmp_main_page"> 
					<?php 
            $WCMp->template->get_template('vendor_dashboard_menu.php', array('selected_item' => 'orders'));
            $WCMp->template->get_template('shortcode/vendor_orders.php', array('vendor' => $vendor, 'customer_orders' => $orders_array));
            wp_localize_script('vendor_orders_js', 'wcmp_vendor_all_orders_array', $orders_array['all']);
            wp_localize_script('vendor_orders_js', 'wcmp_vendor_processing_orders_array', $orders_array['processing']);
            wp_localize_script('vendor_orders_js', 'wcmp_vendor_completed_orders_array', $orders_array['completed']);
            ?>
 
				</div>
			</div>
			<?php 
        }
    }
开发者ID:itsunus,项目名称:wstore,代码行数:78,代码来源:class-wcmp-shortcode-vendor-orders.php


示例16: output_report

    /**
     * Output the report
     */
    public function output_report()
    {
        global $wpdb, $woocommerce, $WCMp;
        $vendor = $vendor_id = $order_items = false;
        $ranges = array('year' => __('Year', $WCMp->text_domain), 'last_month' => __('Last Month', $WCMp->text_domain), 'month' => __('This Month', $WCMp->text_domain), '7day' => __('Last 7 Days', $WCMp->text_domain));
        $current_range = !empty($_GET['range']) ? sanitize_text_field($_GET['range']) : '7day';
        if (!in_array($current_range, array('custom', 'year', 'last_month', 'month', '7day'))) {
            $current_range = '7day';
        }
        $this->calculate_current_range($current_range);
        if (isset($_POST['vendor'])) {
            $vendor_id = $_POST['vendor'];
            $vendor = get_wcmp_vendor_by_term($vendor_id);
            if ($vendor) {
                $products = $vendor->get_products();
            }
            if (!empty($products)) {
                foreach ($products as $product) {
                    $chosen_product_ids[] = $product->ID;
                }
            }
        }
        if ($vendor_id && $vendor) {
            $option = '<option value="' . $vendor_id . '" selected="selected">' . $vendor->user_data-> 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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