Home Forums Theme Support Dokan Seller Link under Product title

This topic is: resolved

This topic contains 13 replies, has 2 voices, and was last updated by  Nayem 4 years, 7 months ago.

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #32710

    Boris GAB
    Member
    Post count: 48

    Hello,

    How can i set a link from the seller under the product title? I would like to have the same link as in the seller info tab under the product title?

    Thanks,

    #32721

    Nayem
    Moderator
    Post count: 6480

    Hello Boris,

    You have to customize this in your child theme because child theme is safe for overriding. You can not do customization in your main theme because after updating all customize data will be lost. So child theme will good way to customize for you. Here is those code-

    
    function dokan_product_seller_link( $val ) {
        global $product;
        $author     = get_user_by( 'id', $product->post->post_author );
        ?>
        <li class="seller-name">
            <span>
                <?php _e( 'Seller:', 'dokan' ); ?>
            </span>
    
            <span class="details">
                <?php printf( '<a href="%s">%s</a>', dokan_get_store_url( $author->ID ), $author->display_name ); ?>
            </span>
        </li>
    <?php
    do_action( 'woocommerce_single_product_summary', 'dokan_product_seller_link', 8 );
    

    Thank you ๐Ÿ™‚

    #32779

    Boris GAB
    Member
    Post count: 48

    When i add this function to my child theme functions page, i have this text diplay on my home page

    function dokan_product_seller_link( $val ) { global $product; $author = get_user_by( ‘id', $product->post->post_author ); ?>
    Seller:

    #32786

    Nayem
    Moderator
    Post count: 6480

    Hello Boris GAB,

    You have to insert that code inside php tag.

    <?php 
    insert your code 
    ?>

    Please check in this way and let me know. Thank you ๐Ÿ™‚

    #32799

    Boris GAB
    Member
    Post count: 48

    My functions.php content
    I have a blank page with this one

    <?php
    function dokan_product_seller_link( $val ) {
        global $product;
        $author     = get_user_by( 'id', $product->post->post_author );
        ?>
        <li class="seller-name">
            <span>
                <?php _e( 'Seller:', 'dokan' ); ?>
            </span>
    
            <span class="details">
                <?php printf( '<a href="%s">%s</a>', dokan_get_store_url( $author->ID ), $author->display_name ); ?>
            </span>
        </li>
    <?php
    do_action( 'woocommerce_single_product_summary', 'dokan_product_seller_link', 8 );
    
    ?>
    #32858

    Nayem
    Moderator
    Post count: 6480

    Hello Boris ,

    I have little bit of correction in the code. Here is the final code for that –

    
    function dokan_product_seller_link() {
        global $product;
        $author     = get_user_by( 'id', $product->post->post_author );
        ?>
        <span>
            <?php _e( 'Seller:', 'dokan' ); ?>
        </span>
    
        <span class="details">
            <?php printf( '<a href="%s">%s</a>', dokan_get_store_url( $author->ID ), $author->display_name ); ?>
        </span>
    <?php
    }
    add_action( 'woocommerce_single_product_summary', 'dokan_product_seller_link', 8 );
    
    #32909

    Boris GAB
    Member
    Post count: 48

    ok, i have test it. the code is working but display ” Seller: Seller name”.

    I need to diplay ” Store Name: seller name ” and have link to seller name which redirect to the seller store.

    Thanks you.

    #32910

    Nayem
    Moderator
    Post count: 6480

    Hello Boris,

    Here is your final code with the change.Now it will display as “Store Name: seller name” and you can redirect to the seller store by clicking on the name.

    
    function dokan_product_seller_link() {
        global $product;
        $author     = get_user_by( 'id', $product->post->post_author );
        ?>
        <span>
            <?php _e( 'Store Name:', 'dokan' ); ?>
        </span>
    
        <span class="details">
            <?php printf( '<a href="%s">%s</a>', dokan_get_store_url( $author->ID ), $author->display_name ); ?>
        </span>
    <?php
    }
    add_action( 'woocommerce_single_product_summary', 'dokan_product_seller_link', 8 );
    
    #32918

    Boris GAB
    Member
    Post count: 48

    Hello Nayem,

    Excuse me, i want to display

    ” Store Name: store_name ”

    And link to the store on the store_name

    Thanks for your assistance.

    #32921

    Nayem
    Moderator
    Post count: 6480

    Hello Boris,

    function dokan_product_seller_link() {
        global $product;
        $author     = get_user_by( 'id', $product->post->post_author );
        $store_info = dokan_get_store_info( $author->ID );
        ?>
        <span>
            <?php _e( 'Store:', 'dokan' ); ?>
        </span>
    
        <span class="details">
            <?php printf( '<a href="%s">%s</a>', dokan_get_store_url( $author->ID ), $store_info['store_name'] ); ?>
        </span>
    <?php
    }
    add_action( 'woocommerce_single_product_summary', 'dokan_product_seller_link', 8 );

    Please check and let me know.

    #32929

    Boris GAB
    Member
    Post count: 48

    Hi,

    OK, Thanks, Good.

    #32930

    Nayem
    Moderator
    Post count: 6480

    Hello Boris,

    Make sure that you have inserted those code in the function.php file of your child theme. Actually i tested that code in my side. It was working fine here. Please check and let me know.

    Thank you ๐Ÿ™‚

    #32932

    Boris GAB
    Member
    Post count: 48

    Working fine. Thanks you

    #32933

    Nayem
    Moderator
    Post count: 6480

    Hello Boris,

    Please mark this topic as resolved, if you have no more question.

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

The topic ‘Seller Link under Product title’ is closed to new replies.