/** * 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/>'; }
/** * * * @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; }
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; }
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'; }
/** * [pv_recent_vendor_sales] shortcode * * @param array $atts * * @return unknown */ public function display_vendor_settings($atts) { global $woocommerce; if (!$this->can_view_vendor_page()) { return false; } extract(shortcode_atts(array('user_id' => get_current_user_id(), 'paypal_address' => true, 'shop_description' => true), $atts)); $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'); ob_start(); wc_get_template('settings.php', array('description' => $description, 'global_html' => $global_html, 'has_html' => $has_html, 'paypal_address' => $paypal_address, 'seller_info' => $seller_info, 'shop_description' => $shop_description, 'shop_page' => $shop_page, 'user_id' => $user_id), 'wc-vendors/dashboard/settings/', wcv_plugin_dir . 'templates/dashboard/settings/'); return ob_get_clean(); }
function tokopress_wcvendors_user_vendorshop() { $user = get_query_var('author_name') ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author')); if (WCV_Vendors::is_vendor($user->ID)) { $shop_name = WCV_Vendors::get_vendor_shop_name($user->ID); $shop_page = WCV_Vendors::get_vendor_shop_page($user->user_login); if ($shop_name && $shop_page) { echo '<div class="user-vendorshop">'; echo '<p>' . sprintf(__('%s is a seller on "%s" shop.', 'tokopress'), '<strong>' . $user->display_name . '</strong>', $shop_name) . '</p>'; echo '<a href="' . $shop_page . '" class="button alt">' . sprintf(__('Visit "%s"', 'tokopress'), $shop_name) . '</a>'; echo '</div>'; } } }
public static function template_loop_sold_by($product_id) { $vendor_id = WCV_Vendors::get_vendor_from_product($product_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">%s</a>', WCV_Vendors::get_vendor_shop_page($vendor_id), WCV_Vendors::get_vendor_sold_by($vendor_id)) : get_bloginfo('name'); echo '<small class="wcvendors_sold_by_in_loop">' . apply_filters('wcvendors_sold_by_in_loop', $sold_by_label) . ' ' . $sold_by . '</small> <br />'; }
public function template_loop_sold_by($product_id) { $author = WCV_Vendors::get_vendor_from_product($product_id); $sold_by = WCV_Vendors::is_vendor($author) ? sprintf('<a href="%s">%s</a>', WCV_Vendors::get_vendor_shop_page($author), WCV_Vendors::get_vendor_shop_name($author)) : get_bloginfo('name'); echo '<small>' . apply_filters('wcvendors_sold_by_in_loop', __('Sold by: ', 'wcvendors')) . $sold_by . '</small> <br />'; }
function tpvc_wc_mini_wcvendors_shortcode($atts) { if (!class_exists('woocommerce')) { return; } if (!class_exists('WC_Vendors')) { return; } extract(shortcode_atts(array('tpvc_wc_vendor_title' => 'Vendors', 'tpvc_wc_vendor_title_color' => '', 'tpvc_wc_vendor_title_bg' => '', 'tpvc_wc_vendor_title_icon' => '', 'tpvc_wc_vendor_title_icon_color' => '', 'tpvc_wc_vendor_numbers' => 36, 'tpvc_wc_vendor_columns' => 12, 'tpvc_wc_vendor_columns_tablet' => 9, 'tpvc_wc_vendor_columns_mobile' => 4, 'tpvc_wc_vendor_orderby' => 'registered', 'tpvc_wc_vendor_order' => 'asc', 'tpvc_wc_vendor_hide_title' => '', 'tpvc_wc_vendor_show_products' => 'no', 'tpvc_wc_vendor_class' => ''), $atts)); $meta_query = WC()->query->get_meta_query(); if (intval($tpvc_wc_vendor_numbers) < 1) { $tpvc_wc_vendor_numbers = 36; } if (intval($tpvc_wc_vendor_columns) < 1) { $tpvc_wc_vendor_columns = 12; } if (intval($tpvc_wc_vendor_columns_tablet) < 1) { $tpvc_wc_vendor_columns_tablet = 9; } if (intval($tpvc_wc_vendor_columns_mobile) < 1) { $tpvc_wc_vendor_columns_mobile = 4; } $tpvc_wc_vendor_class .= ' tpvc-mini-product-col-md-' . $tpvc_wc_vendor_columns; $tpvc_wc_vendor_class .= ' tpvc-mini-product-col-sm-' . $tpvc_wc_vendor_columns_tablet; $tpvc_wc_vendor_class .= ' tpvc-mini-product-col-xs-' . $tpvc_wc_vendor_columns_mobile; $paged = 1; $offset = 0; // $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; // $offset = ($paged - 1) * $per_page; // Hook into the user query to modify the query to return users that have at least one product if ($tpvc_wc_vendor_show_products == 'yes') { add_action('pre_user_query', array($this, 'vendors_with_products')); } // Get all vendors // $vendor_total_args = array ( // 'role' => 'vendor', // 'meta_key' => 'pv_shop_slug', // 'meta_value' => '', // 'meta_compare' => '>', // 'orderby' => $tpvc_wc_vendor_orderby, // 'order' => $tpvc_wc_vendor_order, // ); // if ($tpvc_wc_vendor_show_products == 'yes') $vendor_total_args['query_id'] = 'vendors_with_products'; // $vendor_query = New WP_User_Query( $vendor_total_args ); // $all_vendors =$vendor_query->get_results(); // Get the paged vendors $vendor_paged_args = array('role' => 'vendor', 'meta_key' => 'pv_shop_slug', 'meta_value' => '', 'meta_compare' => '>', 'orderby' => $tpvc_wc_vendor_orderby, 'order' => $tpvc_wc_vendor_order, 'offset' => $offset, 'number' => $tpvc_wc_vendor_numbers); if ($tpvc_wc_vendor_show_products == 'yes') { $vendor_total_args['query_id'] = 'vendors_with_products'; } $vendor_paged_query = new WP_User_Query($vendor_paged_args); $paged_vendors = $vendor_paged_query->get_results(); // Pagination calcs // $total_vendors = count($all_vendors); // $total_vendors_paged = count($paged_vendors); // $total_pages = intval($total_vendors / $per_page) + 1; ob_start(); if (!empty($paged_vendors)) { ?> <div class="tpvc-mini-product woocommerce <?php echo $tpvc_wc_vendor_class; ?> "> <?php if ("hide" != $tpvc_wc_vendor_hide_title) { ?> <div class="tpvc-title" <?php if ("" !== $tpvc_wc_vendor_title_bg) { echo 'style="background-color:' . $tpvc_wc_vendor_title_bg . '"'; } ?> > <h2 <?php if ("" !== $tpvc_wc_vendor_title_color) { echo 'style="color:' . $tpvc_wc_vendor_title_color . '"'; } ?> > <?php if ("" != $tpvc_wc_vendor_title_icon) { echo '<i class="' . tpvc_icon($tpvc_wc_vendor_title_icon) . '" ' . ($tpvc_wc_vendor_title_icon_color ? 'style="color:' . $tpvc_wc_vendor_title_icon_color . '"' : '') . '></i>'; } ?> <?php echo $tpvc_wc_vendor_title; ?> </h2> </div> <?php } ?> <ul class="products"> <?php foreach ($paged_vendors as $vendor) { ?> <?php $vendor_link = WCV_Vendors::get_vendor_shop_page($vendor->ID); ?> <?php $vendor_name = $vendor->pv_shop_name; ?> <li class="product"> <?php echo get_avatar($vendor->ID, 200); ?> <div class="mini-icon-view"> <a href="<?php echo esc_url($vendor_link); ?> " title="<?php echo esc_attr($vendor_name); ?> "> <i class="fa fa-search"></i> </a> </div> </li> <?php } // end of the loop. ?> </ul> </div> <?php } return ob_get_clean(); }
echo get_permalink($dashboard_id); ?> "> <?php _e('My Dashboard', 'mango'); ?> <i class="icon-speedometer"></i> </a> </li> <?php } ?> <li> <a rel="nofollow" href="<?php echo WCV_Vendors::get_vendor_shop_page(wp_get_current_user()->user_login); ?> "> <?php _e('My Shop', 'mango'); ?> <i class="icon-bag"></i> </a> </li> <?php if ($settings_id = WC_Vendors::$pv_options->get_option('shop_settings_page')) { ?> <li> <a rel="nofollow" href="<?php echo get_permalink($settings_id); ?>
/** * list of vendors * * @param $atts shortcode attributs */ public function wcv_vendorslist($atts) { $html = ''; extract(shortcode_atts(array('orderby' => 'registered', 'order' => 'ASC', 'per_page' => '12', 'columns' => '4', 'show_products' => 'yes'), $atts)); $paged = get_query_var('paged') ? get_query_var('paged') : 1; $offset = ($paged - 1) * $per_page; // Hook into the user query to modify the query to return users that have at least one product if ($show_products == 'yes') { add_action('pre_user_query', array($this, 'vendors_with_products')); } // Get all vendors $vendor_total_args = array('role' => 'vendor', 'meta_key' => 'pv_shop_slug', 'meta_value' => '', 'meta_compare' => '>', 'orderby' => $orderby, 'order' => $order); if ($show_products == 'yes') { $vendor_total_args['query_id'] = 'vendors_with_products'; } $vendor_query = new WP_User_Query($vendor_total_args); $all_vendors = $vendor_query->get_results(); // Get the paged vendors $vendor_paged_args = array('role' => 'vendor', 'meta_key' => 'pv_shop_slug', 'meta_value' => '', 'meta_compare' => '>', 'orderby' => $orderby, 'order' => $order, 'offset' => $offset, 'number' => $per_page); if ($show_products == 'yes') { $vendor_paged_args['query_id'] = 'vendors_with_products'; } $vendor_paged_query = new WP_User_Query($vendor_paged_args); $paged_vendors = $vendor_paged_query->get_results(); // Pagination calcs $total_vendors = count($all_vendors); $total_vendors_paged = count($paged_vendors); $total_pages = ceil($total_vendors / $per_page); ob_start(); // Loop through all vendors and output a simple link to their vendor pages foreach ($paged_vendors as $vendor) { wc_get_template('vendor-list.php', array('shop_link' => WCV_Vendors::get_vendor_shop_page($vendor->ID), 'shop_name' => $vendor->pv_shop_name, 'vendor_id' => $vendor->ID, 'shop_description' => $vendor->pv_shop_description), 'wc-vendors/front/', wcv_plugin_dir . 'templates/front/'); } // End foreach $html .= '<ul class="wcv_vendorslist">' . ob_get_clean() . '</ul>'; if ($total_vendors > $total_vendors_paged) { $html .= '<div class="wcv_pagination">'; $current_page = max(1, get_query_var('paged')); $html .= paginate_links(array('base' => get_pagenum_link() . '%_%', 'format' => 'page/%#%/', 'current' => $current_page, 'total' => $total_pages, 'prev_next' => false, 'type' => 'list')); $html .= '</div>'; } return $html; }
function mango_wc_vendors_sold_by_meta() { global $mango_settings; $author_id = get_the_author_meta('ID'); $vendor_display_name = WC_Vendors::$pv_options->get_option('vendor_display_name'); switch ($vendor_display_name) { case 'display_name': $vendor = get_userdata($author_id); $vendor_name = $vendor->display_name; break; case 'user_login': $vendor = get_userdata($author_id); $vendor_name = $vendor->user_login; break; default: $vendor_name = WCV_Vendors::get_vendor_shop_name($author_id); break; } $sold_by = WCV_Vendors::is_vendor($author_id) ? sprintf('<a href="%s">%s</a>', WCV_Vendors::get_vendor_shop_page($author_id), $vendor_name) : get_bloginfo('name'); if ($mango_settings['mango_wcvendors_product_soldby']) { echo '<ul class="list-item-details"><li><span class="data-type">' . __('Sold by : ', 'mango') . '</span><span class="value">' . $sold_by . '</span></li></ul>'; } }
function mango_wc_vendor_header() { global $mango_settings, $post, $wp_query, $vendor_shop; $vendor_id = WCV_Vendors::get_vendor_id($vendor_shop); $shop_name = get_user_meta($vendor_id, 'pv_shop_name', true); $description = do_shortcode(get_user_meta($vendor_id, 'pv_shop_description', true)); if ($vendor_shop) { if ($mango_settings['mango_wcvendors_shop_description']) { ?> <?php $product_id = get_the_ID(); $author = WCV_Vendors::get_vendor_from_product($product_id); $link = WCV_Vendors::get_vendor_shop_page($author); $author = WCV_Vendors::get_vendor_from_product(get_the_ID()); $user = get_userdata($author); ?> <?php $r = get_user_meta($user->ID, 'picture', true); $r = $r['url']; if ($r) { ?> <div class="vendor-profile-bg" style="background:url('<?php echo $r; ?> ') ;background-size:cover"> <?php } else { ?> <div class="vendor-profile-bg"> <?php } ?> <div class="overlay-vendor-effect"> <?php if ($mango_settings['mango_wcvendors_shop_avatar']) { ?> <div class="vendor_userimg"> <div class="profile-img"> <a href="<?php echo $link; ?> "> <?php echo get_avatar($vendor_id, 80); ?> </a> </div> </div> <?php } ?> <h1><a href="<?php echo $link; ?> "><?php echo $shop_name; ?> </a></h1> <div class="custom_shop_description"> <?php echo wpautop($description); ?> </div> <?php $author = WCV_Vendors::get_vendor_from_product(get_the_ID()); $user = get_userdata($author); if ($mango_settings['mango_wcvendors_shop_profile']) { ?> <?php if ($mango_settings['mango_wcvendors_phone']) { if ($user->phone_number) { ?> <span class="vendorcustom-mail"><i class="fa fa-phone aligmentvendor"></i> <?php echo $user->phone_number; ?> </span> <?php } } ?> <?php if ($mango_settings['mango_wcvendors_email']) { if ($user->user_email) { ?> <span class="vendorcustom-mail"><i class="fa fa-envelope aligmentvendor"></i> <?php echo $user->user_email; ?> </span> <?php } } ?> <?php if ($mango_settings['mango_wcvendors_url']) { if ($user->user_url) { ?> <span class="vendorcustom-mail"><i class="fa fa-globe aligmentvendor"></i> <?php echo $user->user_url; ?> </span> <?php } } ?> <p class="vendor-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-square"></i></a></span> <?php } ?> <?php if ($user->twitter_url) { ?> <span class="user-twitter"><a rel="nofollow" href="<?php echo esc_url($user->twitter_url); ?> "><i class="fa fa-twitter-square"></i></a></span> <?php } ?> <?php if ($user->gplus_url) { ?> <span class="user-googleplus"><a rel="nofollow" href="<?php echo esc_url($user->gplus_url); ?> "><i class="fa fa-google-plus-square"></i></a></span> <?php } ?> <?php if ($user->youtube_url) { ?> <span class="user-youtube"><a rel="nofollow" href="<?php echo esc_url($user->youtube_url); ?> "><i class="fa fa-youtube-square"></i></a></span> <?php } ?> <?php if ($user->linkedin_url) { ?> <span class="user-linkedin"><a rel="nofollow" href="<?php echo esc_url($user->linkedin_url); ?> "><i class="fa fa-linkedin-square"></i></a></span> <?php } ?> <?php if ($user->flickr_url) { ?> <span class="user-flicker"><a rel="nofollow" href="<?php echo esc_url($user->flickr_url); ?> "><i class="fa fa-flickr-square"></i></a></span> <?php } ?> </p> <?php } ?> </div> </div> <?php } } if (is_product()) { global $mango_settings, $post; $shop_name = get_user_meta($post->post_author, 'pv_shop_name', true); $Shop_description = get_user_meta($post->post_author, 'pv_shop_description', true); ?> <?php if ($mango_settings['mango_single_wcvendors_product_description']) { ?> <?php $product_id = get_the_ID(); $author = WCV_Vendors::get_vendor_from_product($product_id); $link = WCV_Vendors::get_vendor_shop_page($author); $author = WCV_Vendors::get_vendor_from_product(get_the_ID()); $user = get_userdata($author); ?> <?php $r = get_user_meta($user->ID, 'picture', true); $r = $r['url']; if ($r) { ?> <div class="vendor-profile-bg" style="background:url('<?php echo $r; ?> ') ;background-size:cover"> <?php } else { ?> <div class="vendor-profile-bg"> <?php } ?> <div class="overlay-vendor-effect"> <?php if ($mango_settings['mangowcvendors_product_avatar']) { ?> <div class="vendor_userimg"> <div class="profile-img"> <a href="<?php echo $link; ?> "> <?php echo get_avatar($author, 80); ?> </a> </div> </div> <?php } ?> <h1> <a href="<?php echo $link; ?> "><?php echo $shop_name; ?> </a> </h1> <div class="custom_shop_description"> <?php echo wpautop($Shop_description); ?> </div> <?php $author = WCV_Vendors::get_vendor_from_product(get_the_ID()); $user = get_userdata($author); if ($mango_settings['mango_wcvendors_product_profile']) { ?> <?php if ($mango_settings['mango_wcvendors_phone']) { if ($user->phone_number) { ?> <span class="vendorcustom-mail"><i class="fa fa-phone aligmentvendor"></i> <?php echo $user->phone_number; ?> </span> <?php } } ?> <?php if ($mango_settings['mango_wcvendors_email']) { if ($user->user_email) { ?> <span class="vendorcustom-mail"><i class="fa fa-envelope aligmentvendor"></i> <?php echo $user->user_email; ?> </span> <?php } } ?> <?php if ($mango_settings['mango_wcvendors_url']) { if ($user->user_url) { ?> <span class="vendorcustom-mail"><i class="fa fa-globe aligmentvendor"></i> <?php echo $user->user_url; ?> </span> <?php } } ?> <p class="vendor-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-square"></i></a></span> <?php } ?> <?php if ($user->twitter_url) { ?> <span class="user-twitter"><a rel="nofollow" href="<?php echo esc_url($user->twitter_url); ?> "><i class="fa fa-twitter-square"></i></a></span> <?php } ?> <?php if ($user->gplus_url) { ?> <span class="user-googleplus"><a rel="nofollow" href="<?php echo esc_url($user->gplus_url); ?> "><i class="fa fa-google-plus-square"></i></a></span> <?php } ?> <?php if ($user->youtube_url) { ?> <span class="user-youtube"><a rel="nofollow" href="<?php echo esc_url($user->youtube_url); ?> "><i class="fa fa-youtube-square"></i></a></span> <?php } ?> <?php if ($user->linkedin_url) { ?> <span class="user-linkedin"><a rel="nofollow" href="<?php echo esc_url($user->linkedin_url); ?> "><i class="fa fa-linkedin-square"></i></a></span> <?php } ?> <?php if ($user->flickr_url) { ?> <span class="user-flicker"><a rel="nofollow" href="<?php echo esc_url($user->flickr_url); ?> "><i class="fa fa-flickr-square"></i></a></span> <?php } ?> </p> <?php } ?> </div> <?php } ?> <?php } }
/** * */ public static function sold_by_meta() { $author_id = get_the_author_meta('ID'); $sold_by = WCV_Vendors::is_vendor($author_id) ? sprintf('<a href="%s">%s</a>', WCV_Vendors::get_vendor_shop_page($author_id), WCV_Vendors::get_vendor_shop_name($author_id)) : get_bloginfo('name'); echo apply_filters('wcvendors_cart_sold_by_meta', __('Sold by: ', 'wcvendors')) . $sold_by . '<br/>'; }