Forum Replies Created
-
AuthorPosts
-
sanjayParticipant
you mean this is possible with wc vendor pro version ?????
sanjayParticipantHi jamie is possible to you provide us that 12 files name so we can perfectly add multiple user roles.
sanjayParticipantI have done this with simple text field with submit button.bellow is the code.
function wc_vendors_location78( $atts ) { $html = ''; extract( shortcode_atts( array( 'orderby' => 'display_name', 'order' => 'ASC', 'per_page' => '1', 'columns' => '4', 'show_products' => 'yes', 'pv_shop_name' => '', 'meta_compare' => 'LIKE', //'org' => '', ), $atts ) ); // Hook into the user query to modify the query to return users that have at least one product if ($show_products == 'yes') //remove_action( 'pre_user_query', array( $this, 'vendors_with_products') ); //add_action( 'pre_user_query', array( $this, 'vendors_with_products1') ); add_action( 'pre_user_query','vendors_with_products' ); // Get all vendors $vendor_total_args = array ( 'role' => 'vendor', 'meta_key' => 'pv_shop_slug', 'meta_value' => '', 'meta_key' => 'pv_shop_name', 'meta_value' => $_POST[ 'serchbyvendornamessss' ], 'meta_compare' => 'LIKE' //'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(); ob_start(); // Loop through all vendors and output a simple link to their vendor pages foreach ($all_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>'; $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(1) . '%_%', 'format' => 'page/%#%/', 'current' => $current_page, 'total' => $total_pages, 'prev_next' => false, 'type' => 'list', )); $html .= '</div>'; } return $html; //return $html; } //start speciality if ( !empty($_POST[ 'serchbyvendornamessss' ] ) ) { add_shortcode('wc_vendors_location', 'wc_vendors_location78'); }
sanjayParticipantOk can you please give just one trick i am able search vendor by name suppose if i have vendor sam telyor and sandy teld,sarin teron ok suppose if i put the sandy teld in serch box and hit enter its shows the sandy teld vendor but i am looking for something if put “sa” or “te” in serch box and hit the enter button so it will show the vendor which have starting name from “sa” or surname “te” so that i have to use comapre operator for this so can you just boost me to create this.
sanjayParticipantfinally i got it
function overwrite_vendor_title($desc) {
// Return the default value if we're not on a vendor shop page
if(!WCV_Vendors::is_vendor_page()) return $desc;// Get the vendor description and return it
$vendor_shop = urldecode( get_query_var( 'vendor_shop' ) );
$vendor_id = WCV_Vendors::get_vendor_id( $vendor_shop );
//$desc = get_user_meta( $vendor_id, 'pv_shop_description', true );
$name = get_user_meta( $vendor_id, 'pv_shop_name', true );
$city = get_user_meta( $vendor_id, 'pv_merchant_id2', true );
$specialization = get_user_meta( $vendor_id, 'pv_merchant_specialization', true );$desc=$name." | ".$specialization." in ".$city." | Team Web";
// Remove line breaks
$desc = str_replace(array("\r", "\n"), " ", strip_tags($desc));
// Remove extra spaces
$desc = preg_replace( '/\s+/', ' ', $desc );
// Escape special characters
$desc = htmlspecialchars($desc);
// Shorten it to 156 characters (153 + '...')
$desc = substr($desc ,0,500).'...';return $desc;
}
add_filter( 'wpseo_title', 'overwrite_vendor_title', 10, 1);sanjayParticipantthanks bean. i will check.
August 6, 2015 at 5:10 am in reply to: vendor is displaying on vendor list page without any product. #7297sanjayParticipantI have resolved the bug
$vendor_total_args['query_id']
replaced with$vendor_paged_args['query_id']
if ($show_products == 'yes' ) $vendor_paged_args['query_id'] = 'vendors_with_products';
/**
* 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;
error_log(print_r($atts, true));
// 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 = intval($total_vendors / $per_page) +1;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() . '';
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(1) . '%_%',
'format' => 'page/%#%/',
'current' => $current_page,
'total' => $total_pages,
'prev_next' => false,
'type' => 'list',
));
$html .= '</div>';
}
return $html;
}
August 5, 2015 at 12:27 am in reply to: vendor is displaying on vendor list page without any product. #7269sanjayParticipanthope you will fix asap for your plugin lovers.
August 4, 2015 at 12:26 am in reply to: vendor is displaying on vendor list page without any product. #7208sanjayParticipanthi been is there any update?
July 29, 2015 at 1:49 am in reply to: vendor is displaying on vendor list page without any product. #7107sanjayParticipantIs there any update on this and isconfirmed as bug ?????.
July 29, 2015 at 1:43 am in reply to: extract shortcode_atts with multiple meta key and meta value #7106sanjayParticipanti have done it in own way click here
Do not post site link publiclyJuly 25, 2015 at 4:36 am in reply to: vendor is displaying on vendor list page without any product. #7015sanjayParticipantno that vendor dont have any hidden product the problem in updated code you can check add vendor with old class-wcv-shortcodes.php and with new code so you will realize the actual.but need to sort out asap.
July 24, 2015 at 6:50 am in reply to: vendor is displaying on vendor list page without any product. #7004sanjayParticipantthere is bug in new updated version for pagination in file class-wcv-shortcodes.php this file i have replace with old code which was not show pagination for vendor list after updating old code vendor not displaying which dont have any product.
something wrong on 505 line on bellow code
$paged_vendors = $vendor_paged_query->get_results();
July 24, 2015 at 2:51 am in reply to: vendor is displaying on vendor list page without any product. #7002sanjayParticipantvendor list link http://www.justforhearts.org/experts/page/5/
and check the vendor DR ARCHANA CHOPADE
vendor detail link http://www.justforhearts.org/experts/dr-archana-chopade/
her you can see the vendor dont have any product after that is displayed on list<h1>Note:- do not post site link publicly.</h1>
sanjayParticipanti know bin you dont have large team but i am just asking idea not a all code.
sanjayParticipantanybody?????
sanjayParticipantworking charm Jamie thanks.
sanjayParticipant@ben updated version code getting issue like suppose if i have 38 vendors and i am showing
[wcv_vendorslist per_page=10]
using this short code so its showing only 30 vendor of them with 3 page pagination if i increase the size of vendors to 40 then its displaying vendor 40 with 4 page pagination i think there some little bit bug can you please look into thissanjayParticipantthanks ben for a great support issue resolved working charm.
sanjayParticipantcan you please tell me in which file you have made the changes.
sanjayParticipantThanks ben for announcing me a winner i hope as soon as possible this will get resolved.
sanjayParticipantok
sanjayParticipantyes it not works with wc vendor like this
[wcv_vendorslist per_page=10]
sanjayParticipantthanks done ):
sanjayParticipanti am very new to php and wordpress at this point i am not able to figure out how do i code or query’s to achive this i have seen your plugin code for vendor list but i am to much confusing how do i start with code to achieve this goal can you please provide some sample code to sort vendor by them custom field.
-
AuthorPosts