Home Forums WC Vendors Pro Support My Products Tab… Not working anymore?

NOTICE: We've Moved to a Ticket System for Support

As of August 31, 2017 (12am EST) our support forums will be retired (read-only), and we will be moving to a support ticket system.  This will allow us to better organize and answer support requests, and provide a more personalized experience as we assist our customers.

For the time being, we will leave our forums open for reading and learning while we work on creating a more robust Knowledge Base for everyone to use.

If you are a WC Vendors Pro customer please open a support ticket here. 

If you are a WC Vendors user please open a support ticket on the Wordpress.org forums.

The information on this forum is outdated and in most instances no longer relevant. Please be sure to check our documentation for the most up to date information.

https://docs.wcvendors.com/

Thank you to all of our customers!

 

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #32325
    Anna
    Member

    Hello there!
    I had used this chunk of code to show a “My Products” section in our buddypress profiles. It worked wonderfully. When you were visitng a vendor’s profile, you could click on that tab to get a view of their products.. all within their profile.

    Now, however, when you click on the tab in the vendor’s BP profile, it shows ALL products by all vendors, rather than showing ONLY the vendor’s products who’s profile you are visiting.

    I’ve tried to work out what the issue is… I am stumped. Any ideas?

    function my_bp_nav_adder() {
    
    	if (class_exists('WC_Vendors')) { 
    		$wcv_profile_id = bp_displayed_user_id();
    		$wcv_profile_info = get_userdata( bp_displayed_user_id() );
    		
    		if ( $wcv_profile_info->roles[0] == "vendor" ) { 
            global $bp;
    		 bp_core_new_nav_item(
    			array(
    				'name'                => __( 'My Products', 'buddypress' ),
    				'slug'                => 'my-products',
    				'position'            => 30,
    				'screen_function'     => 'wcv_store_display',
    				'default_subnav_slug' => 'my-products',
    				'parent_url'          => $bp->loggedin_user->domain . $bp->slug . '/',
    				'parent_slug'         => $bp->slug
    				) );
    	   } 
    	}
    }
    function wcv_store_display() {
    	//add title and content here - last is to call the members plugin.php template
    	add_action( 'bp_template_title', 'wcv_page_function_to_show_screen_title' );
    	add_action( 'bp_template_content', 'wcv_page_function_to_show_screen_content' );
    	bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
    }
    function wcv_page_function_to_show_screen_title() {
    
    	echo 'My Products';
    }
    function wcv_page_function_to_show_screen_content() {
    	$wcv_user = get_userdata( bp_displayed_user_id() );
    	
    	// You can use any WCV_ shortcode available
    	echo do_shortcode('[wcv_products vendor="'.$wcv_user->user_login.'"]'); 
    }
    add_action( 'bp_setup_nav', 'my_bp_nav_adder', 100 );

    Thank you. 🙂

    #32326
    WC Vendors Support
    Participant

    Reading the code, it looks perfect. I copied/pasted it onto a test site and it shows me only the vendors products….. Looks like it should work just fine! Plugins active were Free, Pro, and BuddyPress.

    #32343
    Anna
    Member

    Well… damn.
    I guess I’ll have to do the dreaded plugin check again. I hadn’t found there to be a conflict.. but I guess I will need to try again. Weird!

    Thanks, Ben!

    #32438
    Anna
    Member

    I stripped down to only bp, wcvpro & free. Still showing me ALL vendor’s products instead of just THAT vendor’s products. I thought maybe it was the line: echo do_shortcode(‘[wcv_products vendor=”‘.$wcv_user->user_login.'”]’); .. like maybe I should change the user_login. Nothing I have done has helped.

    This isn’t a priority issue, by any means. If you have any ideas that’d be great. Otherwise, I guess I’ll do without it- though it was cool. 🙁

    #32544
    WC Vendors Support
    Participant

    Change:

    // You can use any WCV_ shortcode available
    echo do_shortcode('[wcv_products vendor="'.$wcv_user->user_login.'"]'); 

    to:

    // You can use any WCV_ shortcode available
    echo do_shortcode('[wcv_products vendor="'.$wcv_user->user_login.'"]'); 
    echo '<pre>The vendors user_login that is showing in the shortcode is ' . $wcv_user->user_login . '</pre>';

    Then check the user ID it’s showing you and confirm it’s the same user ID of the vendor? That’s about all I got. 🙂 It did work just fine on the demo/dev server when I pasted your code though………

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘WC Vendors Pro Support’ is closed to new topics and replies.