Seller Link under Product title

This topic contains 13 reply and 2 voices, and was last updated by Nayem 9 years, 11 months ago
Viewing 13 Posts - 1 through 13 (of 13 total)
Author Posts
December 21, 2014 at 5:52 am 32710
Nayem 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,
December 21, 2014 at 12:59 pm 32721
Nayem Nayem

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 🙂

December 22, 2014 at 5:21 am 32779
Boris GAB Boris GAB

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:

December 22, 2014 at 9:52 am 32786
Nayem Nayem

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 🙂

December 22, 2014 at 1:01 pm 32799
Boris GAB Boris GAB

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 );

?>
December 23, 2014 at 12:54 pm 32858
Nayem Nayem

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 );
December 24, 2014 at 4:51 am 32909
Boris GAB Boris GAB

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.

December 24, 2014 at 11:23 am 32910
Nayem Nayem

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 );
December 24, 2014 at 2:16 pm 32918
Boris GAB Boris GAB

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.

December 24, 2014 at 2:41 pm 32921
Nayem Nayem

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.

December 24, 2014 at 5:03 pm 32929
Boris GAB Boris GAB

Hi,

OK, Thanks, Good.

December 24, 2014 at 5:06 pm 32930
Nayem Nayem

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 🙂

December 24, 2014 at 5:07 pm 32932
Boris GAB Boris GAB

Working fine. Thanks you

December 24, 2014 at 5:09 pm 32933
Nayem Nayem

Hello Boris,

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

Viewing 13 Posts - 1 through 13 (of 13 total)