/**
  * 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');
     }
 }
 /**
  * Output the report
  */
 public function output_report()
 {
     $this->chart_colours = array('totals' => '#3498db', 'enabled' => '#5cc488', 'disabled' => '#e74c3c');
     $current_range = YITH_Reports()->get_current_date_range();
     $this->calculate_current_range($current_range);
     $args = array('report' => $this, 'current_range' => $current_range, 'ranges' => YITH_Reports()->get_ranges());
     $this->get_chart_data();
     yith_wcpv_get_template('vendors-registered', $args, 'woocommerce/admin/reports');
 }
 /**
  * Output the report
  */
 public function output_report()
 {
     if (empty($this->vendor_ids) && !empty($_GET['vendor_ids'])) {
         $this->vendor_ids = $_GET['vendor_ids'];
     }
     $this->chart_colours = array('vendor_sales' => '#d4d9dc', 'vendor_amount' => '#3498db');
     $args = array('report' => $this, 'current_range' => YITH_Reports()->get_current_date_range(), 'ranges' => YITH_Reports()->get_ranges());
     yith_wcpv_get_template('vendor-sales', $args, 'woocommerce/admin/reports');
 }
<?php

/**
 * Admin new order email (plain text)
 *
 * @author		WooThemes
 * @package 	WooCommerce/Templates/Emails/Plain
 * @version 	2.0.0
 *
 * @var string $email_heading
 * @var YITH_Commission $commission
 * @var bool $sent_to_admin
 * @var bool $plain_text
 */
if (!defined('ABSPATH')) {
    exit;
    // Exit if accessed directly
}
echo "= " . $email_heading . " =\n\n";
echo __('New vendor registered', 'yith_wc_product_vendors') . "\n\n";
echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n";
do_action('woocommerce_email_before_new_vendor_table', $vendor, $sent_to_admin, $plain_text);
echo strtoupper(__('A new user has made a request to become a vendor in your store.', 'yith_wc_product_vendors')) . "\n";
echo "\n";
yith_wcpv_get_template('new-vendor-detail-table', array('vendor' => $vendor, 'owner' => $vendor->get_owner()), 'emails/plain');
do_action('woocommerce_email_after_new_vendor_table', $commission, $sent_to_admin, $plain_text);
echo "\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n";
echo apply_filters('woocommerce_email_footer_text', get_option('woocommerce_email_footer_text'));
 /**
  * get_content_plain function.
  *
  * @access public
  * @return string
  */
 function get_content_plain()
 {
     ob_start();
     yith_wcpv_get_template($this->template_plain, array('order' => $this->object, 'vendor' => $this->vendor, 'email_heading' => $this->get_heading(), 'sent_to_admin' => true, 'plain_text' => false, 'yith_wc_email' => $this), '');
     return ob_get_clean();
 }
 /**
  * Add vendor name after product title
  *
  * @return   string The title
  * @since    1.0
  * @author   Andrea Grillo <*****@*****.**>
  * @use     the_title filter
  */
 public function woocommerce_template_vendor_name()
 {
     global $product;
     if (!empty($product) && is_object($product)) {
         $vendor = yith_get_vendor($product, 'product');
         if ($vendor->is_valid()) {
             $args = array('vendor' => $vendor, 'label_color' => 'color: ' . get_option('yith_vendors_color_name'));
             $template_info = array('name' => 'vendor-name-title', 'args' => $args, 'section' => is_product() ? 'woocommerce/single-product' : 'woocommerce/loop');
             $template_info = apply_filters('yith_woocommerce_vendor_name_template_info', $template_info);
             extract($template_info);
             yith_wcpv_get_template($name, $args, $section);
         }
     }
 }
Example #9
0
 /**
  * get the email vendor order table
  *
  * @return array The review average and the product with reviews count
  */
 public function email_order_items_table($order, $show_download_links = false, $show_sku = false, $show_purchase_note = false, $show_image = false, $image_size = array(32, 32), $plain_text = false)
 {
     ob_start();
     $template = $plain_text ? 'emails/plain/vendor-email-order-items.php' : 'emails/vendor-email-order-items.php';
     yith_wcpv_get_template($template, array('order' => $order, 'vendor' => $this, 'items' => $order->get_items(), 'show_download_links' => $show_download_links, 'show_sku' => $show_sku, 'show_purchase_note' => $show_purchase_note, 'show_image' => $show_image, 'image_size' => $image_size), '');
     return ob_get_clean();
 }
 /**
  * get_content_plain function.
  *
  * @access public
  * @return string
  */
 function get_content_plain()
 {
     ob_start();
     yith_wcpv_get_template($this->template_plain, array('email_heading' => $this->get_heading(), 'blogname' => $this->get_blogname(), 'sent_to_admin' => false, 'plain_text' => true), '');
     return ob_get_clean();
 }
 /**
  * Output the report
  */
 public function output_report()
 {
     $this->chart_colours = array('orders_gross' => '#b1d4ea', 'orders_net' => '#3498db', 'orders_count' => '#95a5a6', 'products_count' => '#dbe1e3');
     $current_range = YITH_Reports()->get_current_date_range();
     $this->calculate_current_range($current_range);
     $args = array('report' => $this, 'current_range' => $current_range, 'ranges' => YITH_Reports()->get_ranges());
     yith_wcpv_get_template('sales-by-date', $args, 'woocommerce/admin/reports');
 }
 /**
  * Add commission tab in single product "Product Data" section
  */
 public function single_product_commission_content()
 {
     if (current_user_can('manage_woocommerce')) {
         global $post;
         $meta_value = get_post_meta($post->ID, '_product_commission', true);
         $args = array('field_args' => array('id' => 'yith_wpv_product_commission', 'label' => __('Product commission', 'yith_wc_product_vendors'), 'desc_tip' => 'true', 'description' => __('You can set a specific commission for a single product. Keep this field blank or zero to use the vendor commission', 'yith_wc_product_vendors'), 'value' => $meta_value ? $meta_value : '', 'type' => 'number', 'custom_attributes' => array('step' => 0.1, 'min' => 0, 'max' => 100)));
         yith_wcpv_get_template('product-data-commission', $args, 'woocommerce/admin');
     }
 }
 /**
  * Retrieve the table for commission details
  *
  * @param bool $plain_text
  *
  * @return string
  */
 public function email_commission_details_table($plain_text = false)
 {
     ob_start();
     $template = $plain_text ? 'plain/commission-detail-table' : 'commission-detail-table';
     yith_wcpv_get_template($template, array('commission' => $this, 'order' => $this->get_order(), 'vendor' => $this->get_vendor(), 'item' => $this->get_item(), 'product' => $this->get_product()), 'emails');
     $return = apply_filters('woocommerce_email_commission_detail_table', ob_get_clean(), $this);
     return $return;
 }
 * @var YITH_Commission $commission
 * @var bool $sent_to_admin
 * @var bool $plain_text
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}

?>

<?php do_action( 'woocommerce_email_header', $email_heading ); ?>

<p><?php _e( 'New vendor registered', 'yith_wc_product_vendors' ) ?></p>

<p><?php _e( 'A new user has made a request to become a vendor in your store.', 'yith_wc_product_vendors' ) ?></p>

<?php do_action( 'woocommerce_email_before_commission_table', $vendor, $sent_to_admin, $plain_text ); ?>

<h2><a href="<?php echo admin_url() ?>"><?php _e( 'Vendor detail', 'yith_wc_product_vendors ') ?></a></h2>

<table cellspacing="0" cellpadding="6" style="width: 100%; border: 1px solid #eee;" border="1" bordercolor="#eee">
	<tbody>
		<?php yith_wcpv_get_template( 'new-vendor-detail-table', array( 'vendor' => $vendor, 'owner' => get_user_by( 'id', absint( $vendor->get_owner() ) ) ), 'emails' ); ?>
	</tbody>
</table>

<?php do_action( 'woocommerce_email_after_commission_table', $vendor, $sent_to_admin, $plain_text ); ?>

<?php do_action( 'woocommerce_email_footer' ); ?>
 /**
  * get_content_plain function.
  *
  * @access public
  * @return string
  */
 function get_content_plain()
 {
     ob_start();
     yith_wcpv_get_template($this->template_plain, array('commission' => $this->object, 'email_heading' => $this->get_heading(), 'sent_to_admin' => true, 'plain_text' => true), '');
     return ob_get_clean();
 }
 /**
  * Add a report abuse link in single product page
  *
  * @since    1.0
  * @author   Andrea Grillo <*****@*****.**>
  * @return   void
  */
 public function add_report_abuse_link()
 {
     $abuse = get_option('yith_wpv_report_abuse_link', 'none');
     $vendor = yith_get_vendor('current', 'product');
     $args = array('abuse_text' => get_option('yith_wpv_report_abuse_link_text'), 'button_class' => apply_filters('yith_wpv_report_abuse_button_class', 'submit'), 'submit_label' => apply_filters('yith_wpv_report_submit_button_label', __('Report', 'yith_wc_product_vendors')), 'vendor' => $vendor, 'product' => wc_get_product());
     if ('all' == $abuse) {
         yith_wcpv_get_template('abuse', $args, 'woocommerce/single-product');
     }
     if ('vendor' == $abuse) {
         if ($vendor->is_valid()) {
             yith_wcpv_get_template('abuse', $args, 'woocommerce/single-product');
         }
     }
 }
 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)) || $vendor->is_super_user()) {
         $args = array('is_vat_require' => YITH_Vendors()->is_vat_require(), 'is_terms_and_conditions_require' => YITH_Vendors()->is_terms_and_conditions_require());
         yith_wcpv_get_template('become-a-vendor', $args, 'shortcodes');
     } else {
         YITH_Vendors()->frontend->vendor_dashboard_endpoint($vendor);
     }
 }
 /**
  * Add vacation part to add to cart template
  *
  * @param $template_name
  * @param $template_path
  * @param $located
  * @param $args
  *
  * @return void
  *
  * @since    1.7
  * @author   Andrea Grillo <*****@*****.**>
  */
 public function add_vacation_template($template_name, $template_path, $located, $args)
 {
     if (is_singular('product') && preg_match('/single-product\\/add-to-cart\\/(\\S+).php/', $template_name)) {
         $vendor = yith_get_vendor('current', 'product');
         $vendor->is_on_vacation() && 'enabled' == $vendor->vacation_selling && yith_wcpv_get_template('store-vacation', array('vendor' => $vendor), 'woocommerce/single-product');
     }
 }
 /**
  * Show the Commissions page
  *
  * @author Andrea Grillo <*****@*****.**>
  * @since  1.0
  * @return void
  * @fire yith_vendors_commissions_template hooks
  */
 public function commissions_details_page()
 {
     if (isset($_GET['view'])) {
         $commission = YITH_Commission(absint($_GET['view']));
         $args = apply_filters('yith_vendors_commission_view_template', array('commission' => $commission));
         yith_wcpv_get_template('commission-view', $args, 'admin');
     } else {
         if (!class_exists('WP_List_Table')) {
             require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
         }
         $path_class = YITH_WPV_PATH . 'includes/lib/class.yith-commissions-list-table';
         $class = 'YITH_Commissions_List_Table';
         require_once $path_class . '.php';
         if (file_exists($path_class . '-premium.php')) {
             require_once $path_class . '-premium.php';
             $class .= '_Premium';
         }
         /** @var YITH_Commissions_List_Table|YITH_Commissions_List_Table_Premium $commissions_table */
         $commissions_table = new $class();
         $commissions_table->prepare_items();
         $args = apply_filters('yith_vendors_commissions_template', array('commissions_table' => $commissions_table));
         yith_wcpv_get_template('commissions', $args, 'admin');
     }
 }
 /**
  * Show the premium tabs
  *
  * @since   1.0.0
  * @author  Andrea Grillo <*****@*****.**>
  * @return  string The premium landing link
  */
 public function show_premium_tab()
 {
     yith_wcpv_get_template('premium', array(), 'admin');
 }
 /**
  * Output the report
  */
 public function output_report()
 {
     $this->chart_colours = array('commissions_amount' => '#0300c6', 'commissions_paid' => '#2ea2cc', 'commissions_unpaid' => '#ffba00', 'commissions_processing' => '#73a724', 'commissions_pending' => '#e74c3c', 'commissions_refunded' => '#999', 'commissions_cancelled' => '#a00', 'commissions_count' => '#ecf0f1');
     $current_range = YITH_Reports()->get_current_date_range();
     $this->calculate_current_range($current_range);
     $args = array('report' => $this, 'current_range' => $current_range, 'ranges' => YITH_Reports()->get_ranges());
     yith_wcpv_get_template('sale-commissions', $args, 'woocommerce/admin/reports');
 }
 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');
     }
 }
 /**
  * Show the Commissions page
  *
  * @author Andrea Grillo <*****@*****.**>
  * @since  1.8.4
  * @return void
  * @fire yith_vendors_commissions_template hooks
  */
 public function earnings_by_vendor()
 {
     if (!class_exists('WP_List_Table')) {
         require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
     }
     $path_class = YITH_WPV_PATH . 'includes/lib/class.yith-commissions-earnings-by-vendor-table';
     $class = 'YITH_Commissions_Earnings_By_Vendor_Table';
     require_once $path_class . '.php';
     if (file_exists($path_class . '-premium.php')) {
         require_once $path_class . '-premium.php';
         $class .= '_Premium';
     }
     /** @var YITH_Commissions_List_Table|YITH_Commissions_List_Table_Premium $commissions_table */
     $commissions_table = new $class();
     $commissions_table->prepare_items();
     $args = apply_filters('yith_vendors_commissions_template', array('commissions_table' => $commissions_table, 'page_title' => __('Earnings by vendor', 'yith_wc_product_vendors')));
     yith_wcpv_get_template('commissions', $args, 'admin');
 }