本文整理汇总了PHP中WCV_Vendors类的典型用法代码示例。如果您正苦于以下问题:PHP WCV_Vendors类的具体用法?PHP WCV_Vendors怎么用?PHP WCV_Vendors使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WCV_Vendors类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show_vendor_in_email
/**
*
*
* @param unknown $name
* @param unknown $_product
*
* @return unknown
*/
function show_vendor_in_email($name, $_product)
{
$product = get_post($_product->id);
$sold_by = WCV_Vendors::is_vendor($product->post_author) ? sprintf('<a href="%s">%s</a>', WCV_Vendors::get_vendor_shop_page($product->post_author), WCV_Vendors::get_vendor_sold_by($product->post_author)) : get_bloginfo('name');
$name .= '<small class="wcvendors_sold_by_in_email"><br />' . apply_filters('wcvendors_sold_by_in_email', __('Sold by: ', 'wcvendors')) . $sold_by . '</small><br />';
return $name;
}
示例2: manage_commissions_column_content
function manage_commissions_column_content($column, $order_id)
{
if ('commissions' == $column) {
$order = new WC_Order($order_id);
$dues = WCV_Vendors::get_vendor_dues_from_order($order, false);
foreach ($dues as $vendor_id => $details) {
/*
$commission = 0;
$shipping = 0;
$tax = 0;*/
$total = 0;
foreach ($details as $value) {
/*
$commission += $value['commission'];
$shipping += $value['shipping'];
$tax += $value['tax'];*/
$total += $value['total'];
}
echo sprintf("%01.2f € ", $total);
$vendor = get_user_by('id', $vendor_id);
echo __('for', 'wcvendors') . ' <a href="/wp-admin/user-edit.php?user_id=' . $vendor_id . '">' . $vendor->display_name . '</a>';
echo '<br />';
}
}
}
示例3: __construct
/**
* Constructor
*/
function __construct()
{
if (!is_admin()) {
return;
}
add_action('edit_user_profile', array($this, 'show_extra_profile_fields'));
add_action('edit_user_profile_update', array($this, 'save_extra_profile_fields'));
add_filter('add_menu_classes', array($this, 'show_pending_number'));
// Disabling non-vendor related items on the admin screens
if (WCV_Vendors::is_vendor(get_current_user_id())) {
add_filter('woocommerce_csv_product_role', array($this, 'csv_import_suite_compatibility'));
add_filter('woocommerce_csv_product_export_args', array($this, 'csv_import_suite_compatibility_export'));
// Admin page lockdown
remove_action('admin_init', 'woocommerce_prevent_admin_access');
add_action('admin_init', array($this, 'prevent_admin_access'));
add_filter('woocommerce_prevent_admin_access', array($this, 'deny_admin_access'));
// WC > Product page fixes
add_action('load-post-new.php', array($this, 'confirm_access_to_add'));
add_action('load-edit.php', array($this, 'edit_nonvendors'));
add_filter('views_edit-product', array($this, 'hide_nonvendor_links'));
// Filter user attachments so they only see their own attachements
add_action('ajax_query_attachments_args', array($this, 'show_user_attachment_ajax'));
add_filter('parse_query', array($this, 'show_user_attachment_page'));
add_action('admin_menu', array($this, 'remove_menu_page'), 99);
add_action('add_meta_boxes', array($this, 'remove_meta_boxes'), 99);
add_filter('product_type_selector', array($this, 'filter_product_types'), 99, 2);
add_filter('product_type_options', array($this, 'filter_product_type_options'), 99);
add_filter('woocommerce_duplicate_product_capability', array($this, 'add_duplicate_capability'));
// WC > Product featured
$product_misc = (array) WC_Vendors::$pv_options->get_option('hide_product_misc');
if (isset($product_misc['featured'])) {
add_filter('manage_product_posts_columns', array($this, 'manage_product_columns'), 99);
}
}
}
示例4: sold_by_meta
/**
* Single product meta
*/
public static function sold_by_meta()
{
$vendor_id = get_the_author_meta('ID');
$sold_by_label = WC_Vendors::$pv_options->get_option('sold_by_label');
$sold_by = WCV_Vendors::is_vendor($vendor_id) ? sprintf('<a href="%s" class="wcvendors_cart_sold_by_meta">%s</a>', WCV_Vendors::get_vendor_shop_page($vendor_id), WCV_Vendors::get_vendor_sold_by($vendor_id)) : get_bloginfo('name');
echo apply_filters('wcvendors_cart_sold_by_meta', $sold_by_label) . $sold_by . '<br/>';
}
示例5: filter_products_json
/**
*
*
* @param unknown $products
*
* @return unknown
*/
public function filter_products_json($products)
{
$vendor_products = WCV_Vendors::get_vendor_products($this->vendor_id);
$ids = array();
foreach ($vendor_products as $vendor_product) {
$ids[$vendor_product->ID] = $vendor_product->post_title;
}
return array_intersect_key($products, $ids);
}
示例6: filter_comment
public function filter_comment($commentdata, $order)
{
$user_id = get_current_user_id();
$commentdata['user_id'] = $user_id;
$commentdata['comment_author'] = WCV_Vendors::get_vendor_shop_name($user_id);
$commentdata['comment_author_url'] = WCV_Vendors::get_vendor_shop_page($user_id);
$commentdata['comment_author_email'] = wp_get_current_user()->user_email;
return $commentdata;
}
示例7: settings_page
function settings_page()
{
$user_id = get_current_user_id();
$paypal_address = true;
$shop_description = true;
$description = get_user_meta($user_id, 'pv_shop_description', true);
$seller_info = get_user_meta($user_id, 'pv_seller_info', true);
$has_html = get_user_meta($user_id, 'pv_shop_html_enabled', true);
$shop_page = WCV_Vendors::get_vendor_shop_page(wp_get_current_user()->user_login);
$global_html = WC_Vendors::$pv_options->get_option('shop_html_enabled');
include 'views/html-vendor-settings-page.php';
}
示例8: trigger
/**
* trigger function.
*
* @access public
* @return void
*
* @param unknown $order_id
*/
function trigger($post_id, $post)
{
if (!WCV_Vendors::is_vendor($post->post_author)) {
return;
}
$this->find[] = '{product_name}';
$this->product_name = $post->post_title;
$this->replace[] = $this->product_name;
$this->find[] = '{vendor_name}';
$this->vendor_name = WCV_Vendors::get_vendor_shop_name($post->post_author);
$this->replace[] = $this->vendor_name;
$this->post_id = $post->ID;
$this->send($this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments());
}
示例9: check_items
/**
*
*
* @param unknown $items
* @param unknown $order
*
* @return unknown
*/
public function check_items($items, $order)
{
foreach ($items as $key => $product) {
if (empty($product['product_id'])) {
unset($items[$key]);
continue;
}
$author = WCV_Vendors::get_vendor_from_product($product['product_id']);
if ($this->current_vendor != $author) {
unset($items[$key]);
continue;
}
}
return $items;
}
示例10: display_product_orders
/**
* Use views to display the Orders page
*
* @return html
*/
public function display_product_orders()
{
if (!WCV_Vendors::is_vendor(get_current_user_id())) {
ob_start();
wc_get_template('denied.php', array(), 'wc-vendors/dashboard/', wcv_plugin_dir . 'templates/dashboard/');
return ob_get_clean();
}
if (empty($_GET['orders_for_product'])) {
return __('You haven\'t selected a product\'s orders to view! Please go back to the Vendor Dashboard and click Show Orders on the product you\'d like to view.', 'wcvendors');
}
if (!$this->orders) {
return __('No orders.', 'wcvendors');
}
if (!empty($_POST['submit_comment'])) {
require_once wcv_plugin_dir . 'classes/front/orders/class-submit-comment.php';
WCV_Submit_Comment::new_comment($this->orders);
}
if (isset($_POST['mark_shipped'])) {
$order_id = (int) $_POST['order_id'];
$product_id = (int) $_POST['product_id'];
exit;
}
$headers = WCV_Orders::get_headers();
$all = WCV_Orders::format_order_details($this->orders, $this->product_id);
wp_enqueue_style('pv_frontend_style', wcv_assets_url . 'css/wcv-frontend.css');
wp_enqueue_script('pv_frontend_script', wcv_assets_url . 'js/front-orders.js');
$providers = array();
$provider_array = array();
// WC Shipment Tracking Providers
if (class_exists('WC_Shipment_Tracking')) {
$WC_Shipment_Tracking = new WC_Shipment_Tracking();
$providers = method_exists($WC_Shipment_Tracking, 'get_providers') ? $WC_Shipment_Tracking->get_providers() : $WC_Shipment_Tracking->providers;
$provider_array = array();
foreach ($providers as $all_providers) {
foreach ($all_providers as $provider => $format) {
$provider_array[sanitize_title($provider)] = urlencode($format);
}
}
}
ob_start();
// Show the Export CSV button
if ($this->can_export_csv) {
wc_get_template('csv-export.php', array(), 'wc-vendors/orders/', wcv_plugin_dir . 'templates/orders/');
}
wc_get_template('orders.php', array('headers' => $headers, 'body' => $all['body'], 'items' => $all['items'], 'product_id' => $all['product_id'], 'providers' => $providers, 'provider_array' => $provider_array), 'wc-vendors/orders/', wcv_plugin_dir . 'templates/orders/');
return ob_get_clean();
}
示例11: trigger
/**
* trigger function.
*
* @access public
* @return void
*
* @param unknown $order_id
*/
function trigger($new_status, $old_status, $post)
{
// Ensure this is only firing on products
if (!in_array($post->post_type, array('product', 'product_variation'))) {
return;
}
// Ensure that the post author is a vendor
if (!WCV_Vendors::is_vendor($post->post_author)) {
return;
}
if (!$this->is_enabled()) {
return;
}
$this->find[] = '{product_name}';
$this->product_name = $post->post_title;
$this->replace[] = $this->product_name;
$this->find[] = '{vendor_name}';
$this->vendor_name = WCV_Vendors::get_vendor_shop_name($post->post_author);
$this->replace[] = $this->vendor_name;
$this->post_id = $post->ID;
$this->send($this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments());
}
示例12: wpautop
</h2>
<?php
}
?>
<div class="wcv_shop_description">
<?php
echo wpautop($shop_description);
?>
</div>
<?php
if (of_get_option('tokopress_wcvendors_shop_profile') != 'no') {
?>
<?php
$author = WCV_Vendors::get_vendor_from_product(get_the_ID());
$user = get_userdata($author);
?>
<p class="user-social">
<?php
if ($user->facebook_url) {
?>
<span class="user-facebook"><a rel="nofollow" href="<?php
echo esc_url($user->facebook_url);
?>
"><i class="fa fa-facebook"></i></a></span>
<?php
}
?>
<?php
示例13: display_product_orders
/**
* Use views to display the Orders page
*
* @return html
*/
public function display_product_orders()
{
if (!WCV_Vendors::is_vendor(get_current_user_id())) {
ob_start();
wc_get_template('denied.php', array(), 'wc-vendors/dashboard/', wcv_plugin_dir . 'templates/dashboard/');
return ob_get_clean();
}
if (empty($_GET['orders_for_product'])) {
return __('You haven\'t selected a product\'s orders to view! Please go back to the Vendor Dashboard and click Show Orders on the product you\'d like to view.', 'wcvendors');
}
if (!$this->orders) {
return __('No orders.', 'wcvendors');
}
if (!empty($_POST['submit_comment'])) {
require_once wcv_plugin_dir . 'classes/front/orders/class-submit-comment.php';
WCV_Submit_Comment::new_comment($this->orders);
}
if (isset($_POST['mark_shipped'])) {
$order_id = (int) $_POST['order_id'];
$product_id = (int) $_POST['product_id'];
exit;
}
if (isset($_POST['update_tracking'])) {
$order_id = (int) $_POST['order_id'];
$product_id = (int) $_POST['product_id'];
$tracking_provider = woocommerce_clean($_POST['tracking_provider']);
$custom_tracking_provider = woocommerce_clean($_POST['custom_tracking_provider']);
$custom_tracking_link = woocommerce_clean($_POST['custom_tracking_link']);
$tracking_number = woocommerce_clean($_POST['tracking_number']);
$date_shipped = woocommerce_clean(strtotime($_POST['date_shipped']));
$order = new WC_Order($order_id);
$products = $order->get_items();
foreach ($products as $key => $value) {
if ($value['product_id'] == $product_id || $value['variation_id'] == $product_id) {
$order_item_id = $key;
break;
}
}
if ($order_item_id) {
woocommerce_delete_order_item_meta($order_item_id, __('Tracking number', 'wcvendors'));
woocommerce_add_order_item_meta($order_item_id, __('Tracking number', 'wcvendors'), $tracking_number);
$message = __('Success. Your tracking number has been updated.', 'wcvendors');
wc_add_notice($message, 'success');
// Update order data
update_post_meta($order_id, '_tracking_provider', $tracking_provider);
update_post_meta($order_id, '_custom_tracking_provider', $custom_tracking_provider);
update_post_meta($order_id, '_tracking_number', $tracking_number);
update_post_meta($order_id, '_custom_tracking_link', $custom_tracking_link);
update_post_meta($order_id, '_date_shipped', $date_shipped);
}
}
$headers = WCV_Orders::get_headers();
$all = WCV_Orders::format_order_details($this->orders, $this->product_id);
wp_enqueue_style('pv_frontend_style', wcv_assets_url . 'css/wcv-frontend.css');
wp_enqueue_script('pv_frontend_script', wcv_assets_url . 'js/front-orders.js');
// WC Shipment Tracking Providers
global $WC_Shipment_Tracking;
$providers = !empty($WC_Shipment_Tracking->providers) ? $WC_Shipment_Tracking->providers : false;
$provider_array = array();
if ($providers) {
foreach ($providers as $providerss) {
foreach ($providerss as $provider => $format) {
$provider_array[sanitize_title($provider)] = urlencode($format);
}
}
}
// End
ob_start();
// Show the Export CSV button
if ($this->can_export_csv) {
wc_get_template('csv-export.php', array(), 'wc-vendors/orders/', wcv_plugin_dir . 'templates/orders/');
}
wc_get_template('orders.php', array('headers' => $headers, 'body' => $all['body'], 'items' => $all['items'], 'product_id' => $all['product_id'], 'providers' => $providers, 'provider_array' => $provider_array), 'wc-vendors/orders/', wcv_plugin_dir . 'templates/orders/');
return ob_get_clean();
}
示例14: of_get_option
$vendor_profile = of_get_option('tokopress_wcvendors_product_profile') != 'no' ? true : false;
}
$vendor = get_userdata($vendor_id);
if (!$vendor) {
return;
}
$vendor_display_name = WC_Vendors::$pv_options->get_option('vendor_display_name');
switch ($vendor_display_name) {
case 'display_name':
$vendor_name = $vendor->display_name;
break;
case 'user_login':
$vendor_name = $vendor->user_login;
break;
default:
$vendor_name = WCV_Vendors::get_vendor_shop_name($vendor_id);
break;
}
$vendor_description = do_shortcode(get_user_meta($vendor_id, 'pv_shop_description', true));
$has_html = get_user_meta($vendor_id, 'pv_shop_html_enabled', true);
$global_html = WC_Vendors::$pv_options->get_option('shop_html_enabled');
$store_banner = get_user_meta($vendor_id, 'tppv_shop_banner', true);
$store_info = '';
if ($vendor_name) {
$store_info .= '<li class="store-name">' . esc_html($vendor_name) . '</li>';
}
if (trim($vendor_description)) {
$store_info .= '<li class="store-description">' . ($global_html || $has_html) ? wpautop(wptexturize(wp_kses_post($vendor_description))) : sanitize_text_field($vendor_description) . '</li>';
}
$store_contact = '';
if ($vendor_profile) {
示例15: can_view_vendor_page
/**
*
*
* @return unknown
*/
public static function can_view_vendor_page()
{
if (!is_user_logged_in()) {
return false;
} else {
if (!WCV_Vendors::is_vendor(get_current_user_id())) {
wc_get_template('denied.php', array(), 'wc-vendors/dashboard/', wcv_plugin_dir . 'templates/dashboard/');
return false;
}
}
return true;
}