Digital experiences for all disciplines
New Landing › How can we help? › Atelier › SKU in Search results
New Landing › How can we help? › Atelier › SKU in Search results
- This topic has 10 replies, 4 voices, and was last updated 8 years by David Martin – Support.
-
Posted in: Atelier
-
July 14, 2015 at 3:04 pm #194522
Hi Guys,
I was just wondering if it is possible to show the SKU within the search results page?
Many thanks,
July 14, 2015 at 3:56 pm #194537Hi,
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
locatedswift-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.July 14, 2015 at 9:38 pm #194626Thanks David
July 15, 2015 at 9:39 am #194719Thanks David
July 15, 2015 at 10:26 am #194754No problem, cheers guys.
July 21, 2015 at 10:45 am #196376This reply has been marked as private.July 21, 2015 at 11:03 am #196380Hi 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.July 21, 2015 at 11:24 am #196388This reply has been marked as private.July 21, 2015 at 11:25 am #196389Hi Barry,
No problem!
– David.
July 21, 2015 at 4:12 pm #196469Hi 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 previewsee images below for a better explanation.
Many thanks,
PeteAttachments:
You must be logged in to view attached files.July 22, 2015 at 10:13 am #196593Hi,
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.
-
Posted in: Atelier
You must be logged in and have valid license to reply to this topic.