New Landing How can we help? Atelier SKU in Search results

Viewing 11 posts - 1 through 11 (of 11 total)
  • Posted in: Atelier
  • #194522
    Klarity
    Member
    Post count: 183

    Hi Guys,

    I was just wondering if it is possible to show the SKU within the search results page?

    Many thanks,

    #194537
    David Martin – Support
    Moderator
    Post count: 20834

    Hi,

    This is a fairly large modification and would require you to have knowledge of PHP.

    Step 1

    At the basic level you will need to find this file sf-post-formats.php located swift-framework/content/sf-post-formats.php

    Step 2

    Inside this file, copy the whole function sf_get_post_item() into your child theme.

    Step 3

    Locate this comment // DETAILS SETUP and above that copy in the below code:

    if ( $post_type == 'product' && is_search() ) {
    	global $product;
    	$sku_out = $product->sku;
    }

    Step 4

    Depending on what blog layout you are using you can then echo the variable $sku_out into the one of the various layouts within that function. An example:

    $post_item .= '<div class="search-sku"><p>'.$sku_out.'</p></div>';

    Whilst we cannot do the modification for you, this should get you 99% of the way.

    Thanks,
    David.

    #194626
    Klarity
    Member
    Post count: 183

    Thanks David

    #194719
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Thanks David

    #194754
    David Martin – Support
    Moderator
    Post count: 20834

    No problem, cheers guys.

    #196376
    mccaul
    Member
    Post count: 28
    This reply has been marked as private.
    #196380
    David Martin – Support
    Moderator
    Post count: 20834

    Hi Barry, this will output the SKU for each product within the search results.

    It will not search by SKU.

    The Relevanssi search plugin will allow you to include the SKU in the search index. https://wordpress.org/plugins/relevanssi/.

    This plugin will require you to configure the search options:

    1) “Indexing options” include “Product”.

    2) “Custom fields to index:” please add _sku,sku.

    3) Save the options and build the index.

    I have tried this on my dev version and can confirm it works.

    Attachments:
    You must be logged in to view attached files.
    #196388
    mccaul
    Member
    Post count: 28
    This reply has been marked as private.
    #196389
    David Martin – Support
    Moderator
    Post count: 20834

    Hi Barry,

    No problem!

    – David.

    #196469
    Klarity
    Member
    Post count: 183

    Hi Guys,

    I’ve just set this up and noticed that there are a few things not quite working – wondering if you can help?

    – When the product comes through the page title shows 0 results in the title
    – When you type the sku into the search box it doesn’t show the preview

    see images below for a better explanation.

    Many thanks,
    Pete

    Attachments:
    You must be logged in to view attached files.
    #196593
    David Martin – Support
    Moderator
    Post count: 20834

    Hi,

    As this is an advanced customisation you would need to seek the help of a WP Developer to fully integrate this third party plugin.

    Whilst I can offer you tips and small code samples as above to point you in the right direction I cannot provide custom full integrations.

    1) To intergrate the search results counter with the Relevannsi plugin, please follow their documentation on this topic: http://www.relevanssi.com/knowledge-base/found-posts/

    2) A WP Developer would need to assist you to modify the AJAX search.

    WP Developers are available from one of the below resources:

    https://codeable.io
    http://werkpress.com
    http://www.microlancer.com

    – David.

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

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register