本文整理汇总了PHP中YITH_Vendors函数的典型用法代码示例。如果您正苦于以下问题:PHP YITH_Vendors函数的具体用法?PHP YITH_Vendors怎么用?PHP YITH_Vendors使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了YITH_Vendors函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: widget
/**
* Echo the widget content.
*
* Subclasses should over-ride this function to generate their widget code.
*
* @param array $args Display arguments including before_title, after_title,
* before_widget, and after_widget.
* @param array $instance The settings for the particular instance of the widget.
*
* @author Andrea Grillo <andrea.grillo@yithemes.com>
*/
public function widget($args, $instance)
{
$vendor = yith_get_vendor(get_query_var('term'));
$hide_from_guests = !empty($instance['hide_from_guests']) ? true : false;
$show = true;
if ($hide_from_guests) {
$show = is_user_logged_in();
}
if (YITH_Vendors()->frontend->is_vendor_page() && !empty($vendor->store_email) && $show) {
$args = array('instance' => $instance, 'vendor' => $vendor, 'current_user' => wp_get_current_user(), 'widget' => $this);
$this->_instance = $instance;
yith_wcpv_get_template('quick-info', $args, 'widgets');
}
}
示例2: widget
/**
* Echo the widget content.
*
* Subclasses should over-ride this function to generate their widget code.
*
* @param array $args Display arguments including before_title, after_title,
* before_widget, and after_widget.
* @param array $instance The settings for the particular instance of the widget.
*
* @author Andrea Grillo <andrea.grillo@yithemes.com>
*/
public function widget($args, $instance)
{
$hide = !empty($instance['hide_on_vendor_page']) && is_product_taxonomy(YITH_Vendors()->get_taxonomy_name());
if (!$hide) {
yith_wcpv_get_template('vendors-list', $instance, 'widgets');
}
}
示例3: widget
/**
* Echo the widget content.
*
* Subclasses should over-ride this function to generate their widget code.
*
* @param array $args Display arguments including before_title, after_title,
* before_widget, and after_widget.
* @param array $instance The settings for the particular instance of the widget.
*
* @author Andrea Grillo <andrea.grillo@yithemes.com>
*/
public function widget($args, $instance)
{
$vendor = yith_get_vendor(get_query_var('term'));
if (YITH_Vendors()->frontend->is_vendor_page() && !empty($vendor->location)) {
$args = array('instance' => $instance, 'vendor' => $vendor, 'gmaps_link' => esc_url(add_query_arg(array('q' => urlencode($vendor->location)), '//maps.google.com/')));
yith_wcpv_get_template('store-location', $args, 'widgets');
}
}
示例4: yith_wcpv_add_vendor_caps
/**
* Add capabilities to vendor owner
*
* @param int $user_id User ID of vendor admin
*
* @author Andrea Grillo <andrea.grillo@yithemes.com>
* @since 1.0
* @return void
*/
function yith_wcpv_add_vendor_caps($user_id = 0)
{
if ($user_id > 0) {
$user = new WP_User($user_id);
$caps = YITH_Vendors()->vendor_enabled_capabilities();
foreach ($caps as $cap) {
$user->add_cap($cap);
}
}
}
示例5: get_columns
/**
* Returns columns available in table
*
* @return array Array of columns of the table
* @since 1.0.0
*/
public function get_columns()
{
$columns = array('commission_id' => __('ID', 'yith_wc_product_vendors'), 'commission_status' => '<span class="status_head tips" data-tip="' . esc_attr__('Status', 'yith_wc_product_vendors') . '">' . esc_attr__('Status', 'yith_wc_product_vendors') . '</span>', 'order_id' => __('Order', 'yith_wc_product_vendors'), 'line_item' => __('Product', 'yith_wc_product_vendors'), 'rate' => __('Rate', 'yith_wc_product_vendors'), 'user' => __('User', 'yith_wc_product_vendors'), 'vendor' => YITH_Vendors()->get_vendors_taxonomy_label('singular_name'), 'amount' => __('Amount', 'yith_wc_product_vendors'), 'date' => __('Date', 'yith_wc_product_vendors'), 'date_edit' => __('Last update', 'yith_wc_product_vendors'), 'user_actions' => __('Actions', 'yith_wc_product_vendors'));
if ($this->_vendor->is_valid() && $this->_vendor->has_limited_access() && $this->_vendor->is_owner()) {
$to_remove = apply_filters('yith_columns_to_remove', array('user', 'vendor', 'cb'));
foreach ($to_remove as $remove) {
unset($columns[$remove]);
}
}
return $columns;
}
开发者ID:tib07,项目名称:yith-woocommerce-product-vendors,代码行数:17,代码来源:class.yith-commissions-list-table.php
示例6: get_chart_data
/**
* The chart data
*/
public function get_chart_data()
{
global $wpdb;
$vendors = array('totals' => count(YITH_Vendors()->get_vendors(array('fields' => 'ids'))), 'enabled' => count(YITH_Vendors()->get_vendors(array('fields' => 'ids', 'enabled_selling' => 'yes'))));
$vendors['disabled'] = absint($vendors['totals'] - $vendors['enabled']);
$this->chart_data = $vendors;
$sql = "SELECT meta_value as post_date, count(term_id) as vendors_number\r\n FROM {$wpdb->woocommerce_termmeta} as wtm\r\n JOIN {$wpdb->term_taxonomy} as tt\r\n ON wtm.woocommerce_term_id = tt.term_id\r\n WHERE tt.taxonomy = %s\r\n AND wtm.meta_key = %s\r\n GROUP BY post_date";
$results = $wpdb->get_results($wpdb->prepare($sql, YITH_Vendors()->get_taxonomy_name(), 'registration_date'));
$prepared_chart_data = $this->prepare_chart_data($results, 'post_date', 'vendors_number', $this->chart_interval, $this->start_date, $this->chart_groupby);
$this->chart_data['series'] = json_encode(array_values($prepared_chart_data));
}
示例7: __construct
/**
* Constructor
*/
function __construct()
{
$this->id = 'vendor_commissions_paid';
$this->title = __('Commission paid (for Vendor)', 'yith_wc_product_vendors');
$this->description = __('New commissions have been credited to vendor', 'yith_wc_product_vendors');
$this->heading = __('Vendor\'s Commission paid', 'yith_wc_product_vendors');
$this->subject = __('[{site_title}] - Commission paid', 'yith_wc_product_vendors');
$this->template_html = 'emails/vendor-commissions-paid.php';
$this->template_plain = 'emails/plain/vendor-commissions-paid.php';
$this->recipient = YITH_Vendors()->get_vendors_taxonomy_label('singular_name');
// Triggers for this email
add_action('yith_vendors_commissions_paid', array($this, 'trigger'));
// Call parent constructor
parent::__construct();
}
示例8: __construct
/**
* Constructor
*
* @access public
* @return void
*/
function __construct()
{
$this->id = 'vendor_new_account';
$this->title = __("Vendor's new account approvation", 'yith_wc_product_vendors');
$this->description = __('Emails are sent to the vendor as soon as the admin approves his/her account', 'yith_wc_product_vendors');
$this->template_html = 'emails/vendor-new-account.php';
$this->template_plain = 'emails/plain/vendor-new-account.php';
$this->subject = __('Your vendor account on the website {site_title} has been approved.', 'yith_wc_product_vendors');
$this->heading = __('Welcome to {site_title}', 'yith_wc_product_vendors');
$this->recipient = YITH_Vendors()->get_vendors_taxonomy_label('singular_name');
// Call parent constuctor
parent::__construct();
// Triggers for this email
add_action('yith_vendors_account_approved_notification', array($this, 'trigger'), 10, 1);
}
示例9: __construct
/**
* Constructor
*/
function __construct()
{
$this->id = 'cancelled_order';
$this->title = __('Cancelled order (to vendor)', 'yith_wc_product_vendors');
$this->description = __('Cancelled order emails are sent when orders have been marked as cancelled (if they were previously set as pending or on-hold).', 'woocommerce');
$this->heading = __('Cancelled order', 'woocommerce');
$this->subject = __('[{site_title}] Cancelled order ({order_number})', 'woocommerce');
$this->template_html = 'emails/vendor-cancelled-order.php';
$this->template_plain = 'emails/plain/vendor-cancelled-order.php';
$this->recipient = YITH_Vendors()->get_vendors_taxonomy_label('singular_name');
// Triggers for this email
add_action('woocommerce_order_status_pending_to_cancelled_notification', array($this, 'trigger'));
add_action('woocommerce_order_status_on-hold_to_cancelled_notification', array($this, 'trigger'));
// Call parent constructor
parent::__construct();
$this->vendor = null;
}
示例10: __construct
/**
* Construct
*/
function __construct()
{
$this->id = 'new_order';
$this->title = __('New order (to vendor)', 'yith_wc_product_vendors');
$this->description = __('New order emails are sent to vendor(s) when an order is received.', 'yith_wc_product_vendors');
$this->heading = __('New customer order', 'woocommerce');
$this->subject = __('[{site_title}] New customer order ({order_number}) - {order_date}', 'woocommerce');
$this->template_html = 'emails/vendor-new-order.php';
$this->template_plain = 'emails/plain/vendor-new-order.php';
$this->recipient = YITH_Vendors()->get_vendors_taxonomy_label('singular_name');
// Triggers for this email
add_action('woocommerce_order_status_pending_to_processing_notification', array($this, 'trigger'));
add_action('woocommerce_order_status_pending_to_completed_notification', array($this, 'trigger'));
add_action('woocommerce_order_status_pending_to_on-hold_notification', array($this, 'trigger'));
add_action('woocommerce_order_status_failed_to_processing_notification', array($this, 'trigger'));
add_action('woocommerce_order_status_failed_to_completed_notification', array($this, 'trigger'));
add_action('woocommerce_order_status_failed_to_on-hold_notification', array($this, 'trigger'));
// Call parent constructor
parent::__construct();
$this->vendor = null;
}
示例11: yith_vendors_update_1_0_2
function yith_vendors_update_1_0_2()
{
$vendors_db_option = get_option('yith_product_vendors_db_version');
//Add support to YITH Product Vendors 1.0.2
if ($vendors_db_option && version_compare($vendors_db_option, '1.0.1', '<')) {
global $wpdb;
$sql = "SELECT woocommerce_term_id as vendor_id, meta_value as user_id\r\n FROM {$wpdb->woocommerce_termmeta} as wtm\r\n WHERE wtm.meta_key = %s\r\n AND woocommerce_term_id IN (\r\n SELECT DISTINCT term_id as vendor_id\r\n FROM {$wpdb->term_taxonomy} as tt\r\n WHERE tt.taxonomy = %s\r\n )";
$results = $wpdb->get_results($wpdb->prepare($sql, 'owner', YITH_Vendors()->get_taxonomy_name()));
foreach ($results as $result) {
$user = get_user_by('id', $result->user_id);
if ($user) {
update_woocommerce_term_meta($result->vendor_id, 'registration_date', get_date_from_gmt($user->user_registered));
update_woocommerce_term_meta($result->vendor_id, 'registration_date_gmt', $user->user_registered);
if (defined('YITH_WPV_PREMIUM')) {
$user->add_cap('view_woocommerce_reports');
}
}
}
$sql = "ALTER TABLE `{$wpdb->prefix}yith_vendors_commissions` CHANGE `rate` `rate` DECIMAL(5,4) NOT NULL";
$wpdb->query($sql);
update_option('yith_product_vendors_db_version', '1.0.1');
}
}
示例12: yith_vendors_update_db_1_0_3
function yith_vendors_update_db_1_0_3()
{
$vendors_db_option = get_option('yith_product_vendors_db_version');
if ($vendors_db_option && version_compare($vendors_db_option, '1.0.3', '<')) {
/**
* Create "Become a Vendor" Page
*/
if (defined('YITH_WPV_PREMIUM')) {
$become_a_vendor_page = get_option('yith_wpv_become_a_vendor_page_id');
$become_a_vendor_page === false && YITH_Vendors_Admin_Premium::create_become_a_vendor_page();
}
/**
* Show Gravatar Option
*/
$vendors = YITH_Vendors()->get_vendors();
foreach ($vendors as $vendor) {
if (empty($vendor->show_gravatar)) {
$vendor->show_gravatar = 'yes';
}
}
update_option('yith_product_vendors_db_version', '1.0.3');
}
}
示例13: get_commission
/**
* Get the vendor commission
*
* @Author Andrea Grillo <andrea.grillo@yithemes.com>
* @return string The vendor commission
* @fire yith_vendor_commission filter
*/
public function get_commission($product_id = false)
{
$base_commission = YITH_Vendors()->get_base_commission();
return apply_filters('yith_vendor_commission', $base_commission, $this->id, $this);
}
示例14: prepare_report_data
public function prepare_report_data()
{
$report_data = array();
$series = array();
$current_range = YITH_Reports()->get_current_date_range();
$this->calculate_current_range($current_range);
$vendors = YITH_Vendors()->get_vendors();
/* @var $vendor YITH_Vendor */
foreach ($vendors as $vendor) {
$order_ids = $vendor->get_orders();
$amount = $items_number = 0;
foreach ($order_ids as $order_id) {
$order = wc_get_order($order_id);
/**
* WC return start date and end date in midnight form.
* To compare it with wc order date I need to convert
* order date in midnight form too.
*/
$order_date = $order instanceof WC_Order ? strtotime('midnight', strtotime($order->order_date)) : false;
if ($order_date && $order_date >= $this->start_date && $order_date <= $this->end_date) {
$vendor_product_ids = $vendor->get_products();
$order_items = $order->get_items();
foreach ($order_items as $order_item) {
if (in_array($order_item['product_id'], $vendor_product_ids)) {
if (!empty($order_item['line_total'])) {
/* === Chart Data === */
$series = new stdClass();
$series->order_date = $order->order_date;
$series->qty = absint($order_item['qty']);
$series->line_total = wc_format_decimal($order_item['line_total'], wc_get_price_decimals());
$report_data['series'][$vendor->id][] = $series;
}
$items_number += $order_item['qty'];
$amount += floatval($order_item['line_total']);
}
}
}
}
if (!empty($amount)) {
$report_data[$vendor->id] = array('vendor' => $vendor, 'sales' => $amount, 'items_number' => $items_number);
}
}
$this->set_report_data($report_data);
}
示例15: add_taxonomy_to_layouts
/**
* Add vendor taxonomy to YITH Theme fw 2.0 in layouts section
*
* @return mixed Taxonomies array
* @since 1.8.1
* @author Andrea Grillo <andrea.grillo@yithemes.com>
*/
public function add_taxonomy_to_layouts($taxonomies)
{
$taxonomies[YITH_Vendors()->get_taxonomy_name()] = get_taxonomy(YITH_Vendors()->get_taxonomy_name());
return $taxonomies;
}