/** * 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 <*****@*****.**> */ 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'); } }
/** * 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 <*****@*****.**> */ 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'); } }
/** * 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 <*****@*****.**> */ 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'); } }
/** * Add capabilities to vendor owner * * @param int $user_id User ID of vendor admin * * @author Andrea Grillo <*****@*****.**> * @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); } } }
/** * 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; }
/** * 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)); }
/** * 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(); }
/** * 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); }
/** * 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; }
/** * 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; }
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'); } }
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'); } }
/** * Get the vendor commission * * @Author Andrea Grillo <*****@*****.**> * @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); }
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); }
/** * Add vendor taxonomy to YITH Theme fw 2.0 in layouts section * * @return mixed Taxonomies array * @since 1.8.1 * @author Andrea Grillo <*****@*****.**> */ public function add_taxonomy_to_layouts($taxonomies) { $taxonomies[YITH_Vendors()->get_taxonomy_name()] = get_taxonomy(YITH_Vendors()->get_taxonomy_name()); return $taxonomies; }
/** * Check if vendor is on vacation * * @param $to_exclude term ids to exclude * @return array term ids to exclude * * @since 1.7 * @author Andrea Grillo <*****@*****.**> */ public function check_vendors_in_vacation($to_exclude) { if (YITH_Vendors()->frontend->is_vendor_page()) { return $to_exclude; } $vendors_ids = YITH_Vendors()->get_vendors(array('vacation_selling' => 'disabled', 'fields' => 'ids')); $on_vacation = array(); if (!empty($vendors_ids)) { foreach ($vendors_ids as $vendor_id) { $vendor = yith_get_vendor($vendor_id, 'vendor'); if ($vendor->is_on_vacation()) { $on_vacation[] = $vendor->id; } } } return !empty($on_vacation) ? array_merge($to_exclude, $on_vacation) : $to_exclude; }
/** * Print the Single Taxonomy Metabox * * @author Andrea Grillo <*****@*****.**> * @since 1.0.0 * * @param $taxonomy string Taxonomy Name * @param $taxonomy_box string Taxonomy Box * * @return void */ public function single_taxonomy_meta_box($taxonomy, $taxonomy_box) { $taxonomy_label = YITH_Vendors()->get_vendors_taxonomy_label(); $vendor = yith_get_vendor('current', 'product'); $args = array('id' => 'tax-input-yith_shop_vendor', 'name' => 'tax_input[yith_shop_vendor]', 'taxonomy' => $this->_taxonomy_name, 'show_option_none' => !$vendor->is_super_user() ? '' : sprintf(__('No %s'), strtolower($taxonomy_label['singular_name'])), 'hide_empty' => !$vendor->is_super_user(), 'selected' => $vendor ? $vendor->id : 0, 'walker' => YITH_Walker_CategoryDropdown(), 'option_none_value' => ''); $vendor = yith_get_vendor('current', 'user'); if ($vendor->is_valid() && $vendor->has_limited_access() && $vendor->is_user_admin()) { echo $vendor->name; } else { wp_dropdown_categories($args); } }
/** * Set up array of vendor admin capabilities * * @author Andrea Grillo <*****@*****.**> * * @return array Vendor capabilities * @since 1.0 */ public function vendor_enabled_capabilities() { $caps = parent::vendor_enabled_capabilities(); $live_chat_caps = $membership_caps = $size_charts_caps = $subscription_caps = $surveys_caps = array(); /* === View Report Capability === */ $caps['view_woocommerce_reports'] = true; /* === Coupon Capabilities === */ if ('yes' == get_option('yith_wpv_vendors_option_coupon_management', 'no')) { $caps['edit_shop_coupons'] = true; $caps['read_shop_coupons'] = true; $caps['delete_shop_coupons'] = true; $caps['publish_shop_coupons'] = true; $caps['edit_published_shop_coupons'] = true; $caps['delete_published_shop_coupons'] = true; $caps['edit_others_shop_coupons'] = true; $caps['delete_others_shop_coupons'] = true; } /* === Product reviews === */ if ('yes' == get_option('yith_wpv_vendors_option_review_management', 'no')) { $caps['moderate_comments'] = true; $caps['edit_posts'] = true; } /* === YITH Live Chat === */ if (YITH_Vendors()->addons->has_plugin('live-chat') && 'yes' == get_option('yith_wpv_vendors_option_live_chat_management', 'no')) { $live_chat_caps = apply_filters('yith_wcmv_live_chat_caps', array()); } /* === Surveys === */ if (YITH_Vendors()->addons->has_plugin('surveys') && 'yes' == get_option('yith_wpv_vendors_option_surveys_management', 'no')) { $surveys_caps = apply_filters('yith_wcmv_surveys_caps', array()); } /* === Add-Ons capabilities === */ $addons_caps = array(); if (YITH_Vendors()->addons->compatibility) { foreach (YITH_Vendors()->addons->compatibility->plugin_with_capabilities as $plugin_name => $plugin_options) { $slug = YITH_Vendors()->addons->compatibility->get_slug($plugin_name); if (YITH_Vendors()->addons->has_plugin($plugin_name) && 'yes' == get_option('yith_wpv_vendors_option_' . $slug . '_management', 'no')) { $addons_caps = array_merge($addons_caps, (array) $plugin_options['capabilities']); } } } return apply_filters('yith_wcmv_vendor_capabilities', array_merge($caps, $live_chat_caps, $membership_caps, $size_charts_caps, $subscription_caps, $surveys_caps, $addons_caps)); }
<?php /* * This file belongs to the YIT Framework. * * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://www.gnu.org/licenses/gpl-3.0.txt */ ?> <?php YITH_Vendors()->admin->add_upload_field('table', $vendor->header_image); ?> <tr class="form-field yith-choosen"> <th scope="row" valign="top"> <label for="key_user"><?php _e('Vendor Shop Owner', 'yith_wc_product_vendors'); ?> </label> </th> <td> <input type="hidden" class="wc-customer-search" id="key_user" name="yith_vendor_data[owner]" data-placeholder="<?php esc_attr_e('Search for a shop owner…', 'yith_wc_product_vendors'); ?>
/** * Add new record to DB * * @param array $args * * @return YITH_Commission */ public function add($args = array()) { global $wpdb; $defaults = array('line_item_id' => 0, 'order_id' => 0, 'user_id' => 0, 'vendor_id' => 0, 'rate' => YITH_Vendors()->get_base_commission(), 'amount' => 0, 'status' => 'pending'); // set commission by vendor if (!isset($args['rate']) && isset($args['vendor_id'])) { $vendor = yith_get_vendor($args['vendor_id']); if ($vendor->is_valid()) { $defaults['rate'] = $vendor->get_commission(); } } $args = wp_parse_args($args, $defaults); $wpdb->insert($wpdb->commissions, (array) $args); return $wpdb->insert_id; }
/** * Check for vendor without owner * * @author Andrea Grillo <*****@*****.**> * * @return void * @since 1.6 */ public function check_vendors_owner() { $vendor = yith_get_vendor('current', 'user'); if ($vendor->is_super_user()) { global $pagenow; $is_vendor_taxonomy_page = 'edit-' . YITH_Vendors()->get_taxonomy_name() == get_current_screen()->id && 'edit-tags.php' == $pagenow; $vendors = YITH_Vendors()->get_vendors(array('fields' => 'owner')); $no_owner_shop = $no_owner_vat = 0; foreach ($vendors as $vendor) { empty($vendor->owner) && $no_owner_shop++; YITH_Vendors()->is_vat_require() && empty($vendor->vat) && $no_owner_vat++; } if (!empty($no_owner_shop) || !empty($no_owner_vat)) { ?> <div class="notice notice-warning"> <?php if (!empty($no_owner_shop)) { ?> <p> <?php printf('<strong>%s</strong>: %d %s.', __('Warning: ', 'yith_wc_product_vendors'), $no_owner_shop, __('vendor shops have no owner set. Please, set an owner for each vendor shop in order to enable them', 'yith_wc_product_vendors')); if (!$is_vendor_taxonomy_page) { printf(' <a href="%s">%s</a>', esc_url(add_query_arg(array('post_type' => 'product', 'taxonomy' => YITH_Vendors()->get_taxonomy_name(), 'orderby' => 'owner'), admin_url('edit-tags.php'))), __('Go to Vendor page to fix it.')); } ?> </p> <?php } ?> <?php if (!empty($no_owner_vat)) { ?> <p> <?php printf('<strong>%s</strong>: %d %s.', __('Warning: ', 'yith_wc_product_vendors'), $no_owner_vat, __('vendor shops have no VAT/SSN set. Please, set VAT/SSN field for each vendor shop', 'yith_wc_product_vendors')); if (!$is_vendor_taxonomy_page) { printf(' <a href="%s">%s</a>', esc_url(add_query_arg(array('post_type' => 'product', 'taxonomy' => YITH_Vendors()->get_taxonomy_name()), admin_url('edit-tags.php'))), __('Go to Vendor page to fix it.')); } ?> </p> <?php } ?> </div> <?php } } elseif (YITH_Vendors()->is_vat_require() && $vendor->is_valid() && $vendor->has_limited_access()) { if (empty($vendor->vat)) { global $pagenow; $is_vendor_details_page = 'admin.php' == $pagenow && isset($_GET['page']) && 'yith_vendor_settings' == $_GET['page'] && (isset($_GET['tab']) && 'vendor-settings' == $_GET['tab'] || !isset($_GET['tab'])); ?> <div class="notice notice-warning"> <p> <?php printf('<strong>%s</strong>: %s.', __('Warning: ', 'yith_wc_product_vendors'), __('Please, set the VAT/SSN field to complete your profile in "Vendor profile"', 'yith_wc_product_vendors')); if (!$is_vendor_details_page) { printf(' <a href="%s">%s</a>', esc_url(add_query_arg(array('page' => 'yith_vendor_settings', 'tab' => 'vendor-settings'), admin_url('admin.php'))), __('Go to Vendor details page to fix it.')); } ?> </p> </div> <?php } } }
if (!function_exists('YITH_Vendors')) { /** * Unique access to instance of YITH_Vendors class * * @return YITH_Vendors|YITH_Vendors_Premium * @since 1.0.0 */ function YITH_Vendors() { // Load required classes and functions require_once YITH_WPV_PATH . 'includes/class.yith-vendors.php'; if (defined('YITH_WPV_PREMIUM') && file_exists(YITH_WPV_PATH . 'includes/class.yith-vendors-premium.php')) { require_once YITH_WPV_PATH . 'includes/class.yith-vendors-premium.php'; return YITH_Vendors_Premium::instance(); } return YITH_Vendors::instance(); } } /* Plugin Framework Version Check */ if (!function_exists('yit_maybe_plugin_fw_loader') && file_exists(YITH_WPV_PATH . 'plugin-fw/init.php')) { require_once YITH_WPV_PATH . 'plugin-fw/init.php'; } yit_maybe_plugin_fw_loader(YITH_WPV_PATH); /** * Instance main plugin class */ YITH_Vendors(); register_activation_hook(YITH_WPV_FILE, array('YITH_Commissions', 'create_commissions_table')); register_activation_hook(YITH_WPV_FILE, 'YITH_Vendors::add_vendor_role'); register_deactivation_hook(YITH_WPV_FILE, 'YITH_Vendors::setup'); register_deactivation_hook(YITH_WPV_FILE, 'YITH_Vendors::remove_vendor_role');
" /> <br/> <span class="description"><?php _e("Insert store telephone number.", 'yith_wc_product_vendors'); ?> </span> <label for="vendor_vat"><?php _e('VAT/SSN:', 'yith_wc_product_vendors'); ?> </label> <input id="vendor_vat" type="text" name="yith_vendor_data[vat]" value="<?php echo $vendor->vat; ?> " class="regular-text <?php echo !$vendor->vat && YITH_Vendors()->is_vat_require() ? 'required' : ''; ?> " /> <br /> <span class="description"><?php _e('The VAT/SSN of your store.', 'yith_wc_product_vendors'); ?> </span> <label for="vendor_legal_notes"><?php _e('Company legal notes', 'yith_wc_product_vendors'); ?> </label> <input id="vendor_vat" type="text" name="yith_vendor_data[legal_notes]" value="<?php echo $vendor->legal_notes; ?>
/** * Returns columns available in table * * @return array Array of columns of the table * @since 1.0.0 */ public function get_columns() { $columns = array('user' => __('User', 'yith_wc_product_vendors'), 'vendor' => YITH_Vendors()->get_vendors_taxonomy_label('singular_name'), 'oldest_commission' => __('Oldest unpaid commission', 'yith_wc_product_vendors'), 'amount' => __('Amount', 'yith_wc_product_vendors'), 'user_actions' => __('Actions', 'yith_wc_product_vendors')); return $columns; }
<?php /* * This file belongs to the YIT Framework. * * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://www.gnu.org/licenses/gpl-3.0.txt */ return array('add-ons' => array('vendors_seller_vacation_start' => array('type' => 'sectionstart'), 'vendors_seller_vacation_title' => array('title' => __('Seller vacation', 'yith_wc_product_vendors'), 'type' => 'title', 'desc' => '', 'id' => 'yith_wpv_vendors_seller_vacation_title'), 'vendors_seller_vacation_management' => array('title' => __('Enable seller vacation module', 'yith_wc_product_vendors'), 'type' => 'checkbox', 'desc' => __('If you enable this option, each vendor will be able to close his/her shop for vacation.', 'yith_wc_product_vendors'), 'id' => 'yith_wpv_vendors_option_seller_vacation_management', 'default' => 'no'), 'vendors_seller_vacation_end' => array('type' => 'sectionend'), 'vendors_live_chat_start' => array('type' => 'sectionstart'), 'vendors_live_chat_title' => array('title' => __('Live Chat', 'yith_wc_product_vendors'), 'type' => 'title', 'desc' => YITH_Vendors()->addons->get_plugin_landing_uri('live-chat', 'display'), 'id' => 'yith_wpv_vendors_live_chat_title'), 'vendors_enable_chat' => array('title' => __('Enable live chat for vendors', 'yith_wc_product_vendors'), 'type' => 'checkbox', 'desc' => YITH_Vendors()->addons->get_option_description('live-chat'), 'id' => 'yith_wpv_vendors_option_live_chat_management', 'default' => 'no', 'custom_attributes' => YITH_Vendors()->addons->has_plugin('live-chat') ? false : array('disabled' => 'disabled')), 'vendors_live_chat_end' => array('type' => 'sectionend'), 'vendors_membership_start' => array('type' => 'sectionstart'), 'vendors_membership_title' => array('title' => __('Membership', 'yith_wc_product_vendors'), 'type' => 'title', 'desc' => YITH_Vendors()->addons->get_plugin_landing_uri('membership', 'display'), 'id' => 'yith_wpv_vendors_membership_title'), 'vendors_enable_membership' => array('title' => __('Enable membership for vendors', 'yith_wc_product_vendors'), 'type' => 'checkbox', 'desc' => YITH_Vendors()->addons->get_option_description('membership'), 'id' => 'yith_wpv_vendors_option_membership_management', 'default' => 'no', 'custom_attributes' => YITH_Vendors()->addons->has_plugin('membership') ? false : array('disabled' => 'disabled')), 'vendors_membership_end' => array('type' => 'sectionend'), 'vendors_subscription_start' => array('type' => 'sectionstart'), 'vendors_subscription_title' => array('title' => __('Subscription', 'yith_wc_product_vendors'), 'type' => 'title', 'desc' => YITH_Vendors()->addons->get_plugin_landing_uri('subscription', 'display'), 'id' => 'yith_wpv_vendors_subscription_title'), 'vendors_enable_subscription' => array('title' => __('Enable subscription for vendors', 'yith_wc_product_vendors'), 'type' => 'checkbox', 'desc' => YITH_Vendors()->addons->get_option_description('subscription'), 'id' => 'yith_wpv_vendors_option_subscription_management', 'default' => 'no', 'custom_attributes' => YITH_Vendors()->addons->has_plugin('subscription') ? false : array('disabled' => 'disabled')), 'vendors_subscription_end' => array('type' => 'sectionend'), 'vendors_badge_management_start' => array('type' => 'sectionstart'), 'vendors_badge_management_title' => array('title' => __('Badge Management', 'yith_wc_product_vendors'), 'type' => 'title', 'desc' => YITH_Vendors()->addons->get_plugin_landing_uri('badge-management', 'display'), 'id' => 'yith_wpv_vendors_badge_management_title'), 'vendors_enable_badge_management' => array('title' => __('Enable badge management for vendors', 'yith_wc_product_vendors'), 'type' => 'checkbox', 'desc' => YITH_Vendors()->addons->get_option_description('badge-management'), 'id' => 'yith_wpv_vendors_option_badge_management_management', 'default' => 'no', 'custom_attributes' => YITH_Vendors()->addons->has_plugin('badge-management') ? false : array('disabled' => 'disabled')), 'vendors_badge_management_end' => array('type' => 'sectionend'), 'vendors_size_charts_start' => array('type' => 'sectionstart'), 'vendors_size_charts_title' => array('title' => __('Product Size Charts', 'yith_wc_product_vendors'), 'type' => 'title', 'desc' => YITH_Vendors()->addons->get_plugin_landing_uri('size-charts', 'display'), 'id' => 'yith_wpv_vendors_size_charts_title'), 'vendors_enable_size_charts' => array('title' => __('Enable product size charts for vendors', 'yith_wc_product_vendors'), 'type' => 'checkbox', 'desc' => YITH_Vendors()->addons->get_option_description('size-charts'), 'id' => 'yith_wpv_vendors_option_size_charts_management', 'default' => 'no', 'custom_attributes' => YITH_Vendors()->addons->has_plugin('size-charts') ? false : array('disabled' => 'disabled')), 'vendors_size_charts_end' => array('type' => 'sectionend'), 'vendors_name_your_price_start' => array('type' => 'sectionstart'), 'vendors_name_your_price_title' => array('title' => __('Name Your Price', 'yith_wc_product_vendors'), 'type' => 'title', 'desc' => YITH_Vendors()->addons->get_plugin_landing_uri('name-your-price', 'display'), 'id' => 'yith_wpv_vendors_name_your_price_title'), 'vendors_enable_name_your_price' => array('title' => __('Enable Name Your Price for vendors', 'yith_wc_product_vendors'), 'type' => 'checkbox', 'desc' => YITH_Vendors()->addons->get_option_description('name-your-price'), 'id' => 'yith_wpv_vendors_option_name_your_price_management', 'default' => 'no', 'custom_attributes' => YITH_Vendors()->addons->has_plugin('name-your-price') ? false : array('disabled' => 'disabled')), 'vendors_name_your_price_end' => array('type' => 'sectionend'), 'vendors_order_tracking_start' => array('type' => 'sectionstart'), 'vendors_order_tracking_title' => array('title' => __('Order Tracking', 'yith_wc_product_vendors'), 'type' => 'title', 'desc' => YITH_Vendors()->addons->get_plugin_landing_uri('order-tracking', 'display'), 'id' => 'yith_wpv_vendors_order_tracking_title'), 'vendors_enable_order_tracking' => array('title' => __('Enable Order Tracking for vendors', 'yith_wc_product_vendors'), 'type' => 'checkbox', 'desc' => YITH_Vendors()->addons->get_option_description('order-tracking'), 'id' => 'yith_wpv_vendors_option_order_tracking_management', 'default' => 'no', 'custom_attributes' => YITH_Vendors()->addons->has_plugin('order-tracking') ? false : array('disabled' => 'disabled')), 'vendors_order_tracking_end' => array('type' => 'sectionend'), 'vendors_waiting_list_start' => array('type' => 'sectionstart'), 'vendors_waiting_list_title' => array('title' => __('Waiting List', 'yith_wc_product_vendors'), 'type' => 'title', 'desc' => YITH_Vendors()->addons->get_plugin_landing_uri('waiting-list', 'display'), 'id' => 'yith_wpv_vendors_waiting_list_title'), 'vendors_enable_waiting_list' => array('title' => __('Enable Waiting List for vendors', 'yith_wc_product_vendors'), 'type' => 'checkbox', 'desc' => YITH_Vendors()->addons->get_option_description('waiting-list'), 'id' => 'yith_wpv_vendors_option_waiting_list_management', 'default' => 'no', 'custom_attributes' => YITH_Vendors()->addons->has_plugin('waiting-list') ? false : array('disabled' => 'disabled')), 'vendors_waiting_list_end' => array('type' => 'sectionend'), 'vendors_surveys_start' => array('type' => 'sectionstart'), 'vendors_surveys_title' => array('title' => __('Surveys', 'yith_wc_product_vendors'), 'type' => 'title', 'desc' => YITH_Vendors()->addons->get_plugin_landing_uri('surveys', 'display'), 'id' => 'yith_wpv_vendors_surveys_title'), 'vendors_enable_surveys' => array('title' => __('Enable surveys for vendors', 'yith_wc_product_vendors'), 'type' => 'checkbox', 'desc' => YITH_Vendors()->addons->get_option_description('surveys'), 'id' => 'yith_wpv_vendors_option_surveys_management', 'default' => 'no', 'custom_attributes' => YITH_Vendors()->addons->has_plugin('surveys') ? false : array('disabled' => 'disabled')), 'vendors_surveys_end' => array('type' => 'sectionend'), 'vendors_review_discounts_start' => array('type' => 'sectionstart'), 'vendors_review_discounts_title' => array('title' => __('Review For Discounts', 'yith_wc_product_vendors'), 'type' => 'title', 'desc' => YITH_Vendors()->addons->get_plugin_landing_uri('review-discounts', 'display'), 'id' => 'yith_wpv_vendors_review_discounts_title'), 'vendors_enable_review_discounts' => array('title' => __('Enable Review for Discounts for vendors', 'yith_wc_product_vendors'), 'type' => 'checkbox', 'desc' => YITH_Vendors()->addons->get_option_description('review-discounts'), 'id' => 'yith_wpv_vendors_option_review_discounts_management', 'default' => 'no', 'custom_attributes' => YITH_Vendors()->addons->has_plugin('review-discounts') ? false : array('disabled' => 'disabled')), 'vendors_review_discounts_end' => array('type' => 'sectionend'), 'vendors_coupon_email_system_start' => array('type' => 'sectionstart'), 'vendors_coupon_email_system_title' => array('title' => __('Coupon Email System', 'yith_wc_product_vendors'), 'type' => 'title', 'desc' => YITH_Vendors()->addons->get_plugin_landing_uri('coupon-email-system', 'display'), 'id' => 'yith_wpv_vendors_coupon_email_system_title'), 'vendors_enable_coupon_email_system' => array('title' => __('Coupon Email System for vendors', 'yith_wc_product_vendors'), 'type' => 'yith_premium_addons', 'desc' => sprintf('%s:', __('You can manage this features here', 'yith_wc_product_vendors')), 'settings_tab' => array('uri' => add_query_arg(array('page' => 'yith-wc-coupon-email-system', 'tab' => 'admin-vendor'), admin_url('admin.php')), 'desc' => __('Vendor Settings', 'yith-woocommerce-coupon-email-system'), 'plugin_name' => __('Coupon Email System', 'yith_wc_product_vendors')), 'id' => 'yith_wpv_vendors_option_coupon_email_system_management', 'default' => 'no', 'custom_attributes' => YITH_Vendors()->addons->has_plugin('coupon-email-system') ? false : array('disabled' => 'disabled')), 'vendors_coupon_email_system_end' => array('type' => 'sectionend'), 'vendors_pdf_invoice' => array('type' => 'sectionstart'), 'vendors_pdf_invoice_title' => array('title' => __('PDF Invoice', 'yith_wc_product_vendors'), 'type' => 'title', 'desc' => YITH_Vendors()->addons->get_plugin_landing_uri('pdf-invoice', 'display'), 'id' => 'yith_wpv_vendors_pdf_invoice_title'), 'vendors_enable_pdf_invoice' => array('title' => __('Enable PDF Invoice for vendors', 'yith_wc_product_vendors'), 'type' => 'checkbox', 'desc' => YITH_Vendors()->addons->get_option_description('pdf-invoice'), 'id' => 'yith_wpv_vendors_enable_pdf_invoice', 'default' => 'no', 'custom_attributes' => YITH_Vendors()->addons->has_plugin('pdf-invoice') ? false : array('disabled' => 'disabled')), 'vendors_pdf_invoice_end' => array('type' => 'sectionend')));
<div class="col-1"> <img src="<?php echo YITH_WPV_URL; ?> assets/images/23.png" alt="Screenshot"/> </div> </div> </div> <div class="section section-cta section-odd"> <div class="landing-container"> <div class="premium-cta"> <p> <?php echo sprintf(__('Upgrade to the %1$spremium version%2$s of %1$sYITH WooCommerce Multi Vendor%2$s to benefit from all features!', 'yith_wc_product_vendors'), '<span class="highlight">', '</span>'); ?> </p> <a href="<?php echo YITH_Vendors()->admin->get_premium_landing_uri(); ?> " target="_blank" class="premium-cta-button button btn"> <?php echo sprintf(__('%1$s UPGRADE %2$s %3$s to the premium version %2$s', 'yith_wc_product_vendors'), '<span class="highlight">', '</span>', '<span>'); ?> </a> </div> </div> </div> </div>
/** * Plugin Setup * * @fire register_activation_hook * @author Andrea Grillo <*****@*****.**> * @since 1.6.5 * @return void */ public static function setup($method) { $method = empty($method) ? 'remove_role' : $method; $vendors = YITH_Vendors()->get_vendors(); $caps = YITH_Vendors()->vendor_enabled_capabilities(); foreach ($vendors as $vendor) { /** @var $vendor YITH_Vendor */ if ($vendor->is_valid()) { $admins = $vendor->get_admins(); foreach ($admins as $admin) { $user = get_user_by('id', $admin); if ($user instanceof WP_User) { if ('remove_role' == $method) { foreach ($caps as $cap) { $user->remove_cap($cap); } } $user->{$method}(self::$_role_name); } } } } if ('remove_role' == $method) { delete_option('yith_wcmv_setup'); delete_option('yith_wcmv_version'); } //regenerate permalink flush_rewrite_rules(); }
/** * YITH Plugins support * * @return string * @since 1.0 */ function yit_plugins_support() { /* === YITH WooCommerce Multi Vendor */ if (class_exists('YITH_Vendors_Frontend_Premium') && function_exists('YITH_Vendors')) { $obj = YITH_Vendors()->frontend; remove_action('woocommerce_archive_description', array($obj, 'add_store_page_header')); add_action('yith_before_shop_page_meta', array($obj, 'add_store_page_header')); add_filter('yith_wpv_quick_info_button_class', 'yith_multi_vendor_button_class'); add_filter('yith_wpv_report_abuse_button_class', 'yith_multi_vendor_button_class'); } if (!function_exists('yith_multi_vendor_quick_info_button_class')) { /** * YITH Plugins support -> Multi Vendor widgets submit button * * @param string $class * @return string * @since 1.0 */ function yith_multi_vendor_button_class($class) { return 'button btn-flat pull-right'; } } /* === YITH WooCommerce Advanced Review */ if (defined('YITH_YWAR_VERSION')) { global $YWAR_AdvancedReview; remove_action('yith_advanced_reviews_before_reviews', array($YWAR_AdvancedReview, 'load_reviews_summary')); add_action('yith_advanced_reviews_before_review_list', array($YWAR_AdvancedReview, 'load_reviews_summary')); } if (defined('YITH_YWAR_PREMIUM')) { add_filter('yith_advanced_reviews_loader_gif', 'yit_loading_search_icon'); } /* Request a Quote */ if (defined('YITH_YWRAQ_VERSION')) { $yith_request_quote = YITH_Request_Quote(); if (method_exists($yith_request_quote, 'add_button_shop')) { remove_action('woocommerce_after_shop_loop_item', array($yith_request_quote, 'add_button_shop'), 15); add_action('woocommerce_before_shop_loop_item', array($yith_request_quote, 'add_button_shop'), 30); } add_filter('ywraq_product_in_list', 'yit_ywraq_change_product_in_list_message'); function yit_ywraq_change_product_in_list_message() { return __('In your quote list', 'yit'); } add_filter('ywraq_product_added_view_browse_list', 'yit_ywraq_product_added_view_browse_list_message'); function yit_ywraq_product_added_view_browse_list_message() { return __('View list >', 'yit'); } add_filter('yith_admin_tab_params', 'yith_wraq_remove_layout_options'); if (!function_exists('yith_wraq_remove_layout_options')) { /** * Remove Layout option from Request a Quote * * @param array $array * @return array * @since 1.0 */ function yith_wraq_remove_layout_options($array) { if ($array['page'] == 'yith_woocommerce_request_a_quote') { unset($array['available_tabs']['layout']); } return $array; } } } /*================ Colors and Label Variations Premium ==================*/ if (defined('YITH_WCCL_PREMIUM') && function_exists('YITH_WCCL_Frontend')) { remove_filter('woocommerce_loop_add_to_cart_link', array(YITH_WCCL_Frontend(), 'add_select_options'), 99, 2); add_action('woocommerce_after_shop_loop_item_title', array(YITH_WCCL_Frontend(), 'print_select_options'), 99); if (yit_get_option('shop-layout-type') == 'slideup') { add_filter('yith_wccl_add_to_cart_button_content', 'yit_get_add_to_cart_slideup'); } function yit_get_add_to_cart_slideup($arg) { $img = yit_get_option('shop-slide-add-cart-icon') != '' ? yit_get_option('shop-slide-add-cart-icon') : get_template_directory_uri() . '/images/ico-cart.png'; $image_size = yit_getimagesize($img); $button = '<img src="' . $img . '" alt="ico-cart" class="ico-cart" height="' . $image_size[1] . '" width="' . $image_size[0] . '"/>'; return $button; } } /* === WPML === */ function yit_wpml_endpoint_hack_for_after() { global $yit_wpml_hack_endpoint; $yit_wpml_hack_endpoint = WC()->query->query_vars; // add the options foreach ($yit_wpml_hack_endpoint as $endpoint => $value) { add_option('woocommerce_myaccount_' . $endpoint . '_endpoint', $value); } } add_action('after_setup_theme', 'yit_wpml_endpoint_hack_for_after', 11); function yit_wpml_my_account_endpoint() { global $woocommerce_wpml, $yit_wpml_hack_endpoint; if (!isset($woocommerce_wpml->endpoints)) { return; } $endpoints = array('recent-downloads', 'myaccount-wishlist'); $wc_vars = WC()->query->query_vars; foreach ($endpoints as $endpoint) { if (!isset($yit_wpml_hack_endpoint[$endpoint])) { return; } $wc_vars_endpoint = isset($wc_vars[$endpoint]) ? $wc_vars[$endpoint] : $endpoint; WC()->query->query_vars[$endpoint] = $woocommerce_wpml->endpoints->get_endpoint_translation($yit_wpml_hack_endpoint[$endpoint], $wc_vars_endpoint); } unset($yit_wpml_hack_endpoint); } add_action('init', 'yit_wpml_my_account_endpoint', 3); }
public static function become_a_vendor($sc_args = array()) { $user = wp_get_current_user(); $vendor = yith_get_vendor($user->ID, 'user'); if (!$vendor->is_valid() && (in_array('subscriber', $user->roles) || in_array('customer', $user->roles))) { yith_wcpv_get_template('become-a-vendor', array('is_vat_require' => YITH_Vendors()->is_vat_require()), 'shortcodes'); } }
/** * Add vendor taxonomy page to Ajax Product Filter plugin * * @param $pages The widget taxonomy pages * * @return mixed|array The allowed taxonomy */ public function add_taxonomy_page($pages) { $pages[] = YITH_Vendors()->get_taxonomy_name(); return $pages; }