View My Store Tab on Directory Listing

This topic contains 4 replies, has 3 voices, and was last updated by  Giri 7 years, 10 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #381402

    la818
    Free User
    Post count: 4

    Hi! I sent in a Pre-Sale questions before purchasing your membership about adding a “View Store” button to directory listings. I received a response — Whenever you join, just ask in the forum for help with that code and we’ll send a developer your way to assist you…so here I am 🙂

    I am using BuddyPress and WC Vendors with GeoDirectory.

    I would like to add some code to have a “Shop My Store” button listed on all directory listings if listing owners are also Vendors with the WC Vendors plugin.

    I am not that familiar with how to code. I found the following snippet from WC Vendors that adds a “Visit Store” button to the Buddypress profiles if the user is also a Vendor. Is there a simple modification to this code that could be performed to also have a \”Visit Store\” button on any listings that a user creates if that user is also a Vendor?

    /* WC Vendors Pro Only – Adds View Store button to BuddyPress profiles */
    add_action(\’bp_member_header_actions\’, \’wcvendors_pro_bp_member_header_actions\’);
    function wcvendors_pro_bp_member_header_actions(){
    $wcv_profile_id = bp_displayed_user_id();
    $wcv_profile_info = get_userdata( bp_displayed_user_id() );
    $wcv_profile_role = implode( $wcv_profile_info->roles );
    $store_url = WCVendors_Pro_Vendor_Controller::get_vendor_store_url( $wcv_profile_id );
    $sold_by = \'<div class=\”generic-button\” id=\”post-mention\”>Visit Store</div>\’;

    if ( $wcv_profile_info->roles[0] == \”vendor\” ) {
    $vendor_name_message = get_the_author_meta( \’user_login\’ );
    $current_user = wp_get_current_user();
    echo $sold_by;
    }
    }

    The respondent to my Pre-Sale questions said I could even add a new tab on each listing created by a vendor and show their products within the listing.

    That would be so amazing! Any help you could offer would be extremely appreciated!!

    #381412

    Guust
    Moderator
    Post count: 29970

    I’ll get a developer to have a look at your question, it may be after the weekend though.
    Please post your URL and WP admin details in a private reply so we can review your site and add the code.

    Thanks

    #381451

    la818
    Free User
    Post count: 4
    This reply has been marked as private.
    #381454

    la818
    Free User
    Post count: 4
    This reply has been marked as private.
    #381673

    Giri
    Expired Member
    Post count: 3155

    Hi there,

    I’m not sure which theme you are using in your website.

    But you can try this code. This will add a Visit Store link in your detail page sidebar.

    
    
    add_action('geodir_before_detail_page_more_info', 'gd_visit_store_button');
    function gd_visit_store_button(){
    	global $post;
    	$author = $post->post_author;
    	$author_info = get_userdata( $author );
    	if ( $author_info->roles[0] == "vendor" ) {
    		$store_url = WCVendors_Pro_Vendor_Controller::get_vendor_store_url( $author );
    		echo '<a href="'.$store_url.'">Visit Store</a>';
    	}
    }

    Let me know if you face any problem.

    Thanks

Viewing 5 posts - 1 through 5 (of 5 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount