• Resolved Jethro Burnett Thorburn

    (@happyhealthyhonesthuman)


    Good Day AWS Support,

    Sending you good energy!

    I am currently using a plugin called Woocommerce Marketplace, which transforms my Woocommerce shop into a multi-vendor marketplace. I have many different vendors (sellers) on the website, and each product has a vendor assigned to it. Please see the screenshots below to give you a better idea of what I am talking about:

    AWS and Woocommerce Marketplace

    Now, the only problem I am experiencing, is that if I search for a vendor’s name in the AWS search bar, it does not show the products that are sold by that vendor. This functionality would be very useful and powerful, and I am wondering whether there is not a way for us to create this sort of functionality.

    It seems like the plugin already adds a vendor attribute to the Product details (as seen in the above screenshot of the Product settings page).

    Is there a way to customize the AWS code so that it also picks up the Vendor Parameter/Attribute in its search?

    Please let me know if I need to communicate with the developer/support team at Woocommerce marketplace in order to obtain any information you might need. They have a very helpful support team.

    Thank you very much for your time and energy.

    Kind regards and best wishes,
    Jethro

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author ILLID

    (@mihail-barinov)

    Hello,

    So, as I understand, you want to display vendor name in search results for each product. Is that true?

    In this case please use following code

    add_filter( 'aws_excerpt_search_result', 'aws_excerpt_search_result', 10, 2 );
    function aws_excerpt_search_result( $excerpt, $post_id ) {
    
        if ( function_exists( 'get_wcmp_product_vendors' ) ) {
    
            $vendor = get_wcmp_product_vendors( $post_id );
    
            if ( $vendor && $vendor->user_data->display_name ) {
                $excerpt = $excerpt . '<br>' . 'Vendor: ' . $vendor->user_data->display_name;
            }
    
        }
    
        return $excerpt;
    }

    Also after you add it please go to plugin settings page and click ‘Clear cache’ button.

    Regards

    Thread Starter Jethro Burnett Thorburn

    (@happyhealthyhonesthuman)

    Hello hello,

    Thank you kindly for the assistance. It is very very much appreciated!

    So yes, having the name show up in the search result is awesome, and I have added the code above to my child theme’s functions.php file and it is working. Thank you kindly for that sir.

    However, there is one point I would like to ask:
    Is it possible to use the variable “Store Name” from the plugin Woocommerce Marketplace (WC marketplace / wcmp) instead of the Display Name as it currently is in the code. The reason I ask, is because the Display Name cannot be edited, so it would be impossible for me to add in the Vendor’s Location to their name. Whereas the Store Name is editable.

    My website helps people to find Local products, so what I want to do, is to put the vendor Location next to their name. Something like this:

    “John Smith (London)” or “Fabio Sesia (Madrid)”

    And then let’s imagine John Smith makes a Product, let’s call it, “Fresh Bread”.

    Now if a user searches, “Fresh Bread London” I would like his product to show up in the search bar. Additionally, if the user just searches “London” or “Fresh Bread” I would also like the result to show up.

    Another thing, is that the customer could also search for the vendor’s name: e.g. “John Smith”. One thing that is missing in the code, is that I would like to be able to Search for the Store Name (belonging to the vendor as well). At the moment it displays the vendor’s name under the product, if one searches for the product, but if somebody searches just for the vendor, no products show up.

    So I would like to display the vendor name (Store Name from wcmp), but also be able to Search for it as well.

    Is this possible? I would sincerely sincerely appreciate the help on this. It would greatly increase the functionality of the website and it perhaps something that you could even market to other multi-vendor marketplace plugins.

    Thank you for your time and energy Mihail. I will wait patiently for your response.

    Kind regards and best wishes,
    Jethro

    Thread Starter Jethro Burnett Thorburn

    (@happyhealthyhonesthuman)

    Hello again Mihail,

    My sincere apologies for this additional message.

    I have realised now that I can edit the Display Name of the vendor. So there is no need to use Store Name instead of Display Name.

    Everything is fine.

    All I need now is to be able to Search for a vendor’s Display Name and for it to show the product below. Obviously, since I will include the vendor’s location in the Display Name, then if they search for example “London” then products will appear for all vendors that have “London” in their display name.

    The reason why this is useful, is because if a vendor moves to a different city, they can simply change their display name, and then this will be effective for all the products that they possess.

    At the moment it shows the display name for the vendor if I search for a product, but if I search for the display name it doesn’t show the product.

    I hope this makes sense. Please let me know if I can help in any way!

    Kind and sincere regards,
    Jethro

    Plugin Author ILLID

    (@mihail-barinov)

    Ok, I understand. To make vendor name searchable please use code below

    add_filter( 'aws_indexed_title', 'aws_indexed_title', 10, 2 );
    function aws_excerpt_search_result( $title, $post_id ) {
    
        if ( function_exists( 'get_wcmp_product_vendors' ) ) {
    
            $vendor = get_wcmp_product_vendors( $post_id );
    
            if ( $vendor && $vendor->user_data->display_name ) {
                $title = $title . ' ' . $vendor->user_data->display_name;
            }
    
        }
    
        return $title;
    }

    Also after this you need to go to plugin settings page and click ‘Reindex table’ button.

    Thread Starter Jethro Burnett Thorburn

    (@happyhealthyhonesthuman)

    Hello,

    Thank you very much for taking the time. I sincerely appreciate it. Please let me know at any time if I can help further with testing.

    When I insert the code into my child theme’s functions.php file, the entire site gets an error:
    “The site is experiencing technical difficulties. Please check your site admin email inbox for instructions.”

    And then when I go to my email I see the following:

    “Hi there!

    Since WordPress 5.2 there is a built-in feature that detects when a plugin or theme causes a fatal error on your site, and notifies you with this automated email.

    In this case, WordPress caught an error with your theme, OceanWP Child.

    First, visit your website (https://molomarket.com/) and check for any visible issues. Next, visit the page where the error was caught (https://molomarket.com/wp-admin/admin-ajax.php?_fs_blog_admin=true) and check for any visible issues.

    Please contact your host for assistance with investigating this issue further.

    If your site appears broken and you can’t access your dashboard normally, WordPress now has a special “recovery mode”. This lets you safely login to your dashboard and investigate further.

    https://molomarket.com/wp-login.php?action=enter_recovery_mode&rm_token=55PWI8iSXp4oWyDsL5ZyBL&rm_key=YDh3QpFo8ijMWtIbb7lUSJ

    To keep your site safe, this link will expire in 1 day. Don’t worry about that, though: a new link will be emailed to you if the error occurs again after it expires.

    Error Details
    =============
    An error of type E_COMPILE_ERROR was caused in line 234 of the file /home/molomark/public_html/wp-content/themes/oceanwp-child-theme-master/functions.php. Error message: Cannot redeclare aws_excerpt_search_result() (previously declared in /home/molomark/public_html/wp-content/themes/oceanwp-child-theme-master/functions.php:193)”

    —————————————–

    So as you can see there is an error.

    Now I wonder whether the error is occurring because we already have another AWS method in the functions.php file? Or will they not interfere with one another? These both have the same function:

    function aws_excerpt_search_result

    When I put a random number or letter after that function name, then the site’s error message goes away and I can proceed to use the website. So for example in Method One (below), I change the function title to:

    function aws_excerpt_search_result1

    I put that “1” there as a random character so that it did not have the same function as Method Two. Then the error message on the site went away.

    However, I still cannot search for a vendor. If I type in a vendor’s name such as Ashley, no products pop up.

    Please see the methods below (I have left them as I received them from you):

    //METHOD ONE

    add_filter( ‘aws_indexed_title’, ‘aws_indexed_title’, 10, 2 );
    function aws_excerpt_search_result( $title, $post_id ) {

    if ( function_exists( ‘get_wcmp_product_vendors’ ) ) {

    $vendor = get_wcmp_product_vendors( $post_id );

    if ( $vendor && $vendor->user_data->display_name ) {
    $title = $title . ‘ ‘ . $vendor->user_data->display_name;
    }

    }

    return $title;
    }

    //METHOD TWO

    add_filter( ‘aws_excerpt_search_result’, ‘aws_excerpt_search_result’, 10, 2 );
    function aws_excerpt_search_result( $excerpt, $post_id ) {

    if ( function_exists( ‘get_wcmp_product_vendors’ ) ) {

    $vendor = get_wcmp_product_vendors( $post_id );

    if ( $vendor && $vendor->user_data->display_name ) {
    $excerpt = $excerpt . ‘<br>’ . ‘Vendor: ‘ . $vendor->user_data->display_name;
    }

    }

    return $excerpt;
    }

    Plugin Author ILLID

    (@mihail-barinov)

    Sorry, my fault. Please use this

    add_filter( 'aws_indexed_title', 'aws_indexed_title', 10, 2 );
    function aws_indexed_title( $title, $post_id ) {
    
        if ( function_exists( 'get_wcmp_product_vendors' ) ) {
    
            $vendor = get_wcmp_product_vendors( $post_id );
    
            if ( $vendor && $vendor->user_data->display_name ) {
                $title = $title . ' ' . $vendor->user_data->display_name;
            }
    
        }
    
        return $title;
    }
    Thread Starter Jethro Burnett Thorburn

    (@happyhealthyhonesthuman)

    Thanks brother. You are a genius. It works perfectly now!

    Thank you very much! I really really appreciate it. I will support this plugin into the future.

    Plugin Author ILLID

    (@mihail-barinov)

    Glad to help.

    Thread Starter Jethro Burnett Thorburn

    (@happyhealthyhonesthuman)

    Keep up the awesome work.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Integration with WC Marketplace’ is closed to new replies.