Support » Plugins and Hacks » Relevanssi - A Better Search » [Plugin: Relevanssi – A Better Search] WP e-Commerce support in Relevanssi

[Plugin: Relevanssi – A Better Search] WP e-Commerce support in Relevanssi

  • I’ve figured how to make Relevanssi play well with WP e-Commerce. Changing line 1607 in relevanssi.php from:

    $content = apply_filters('the_content', $post->post_content);


    if ( 'wpsc-product' == relevanssi_get_post_type($post->ID) ) {
    	$content = $post->post_content . ( !empty($post->post_excerpt) ? " $post->post_excerpt" : '' );
    } else {
    	$content = apply_filters('the_content', $post->post_content);

    Causes Relevanssi’s excerpts to take into account WP e-Commerce’s use of the post_excerpt field as a place for additional textual product information.

    Alternatively, it can be made to work as a function placed somewhere else. Here I made it thus:

    function wpscproductexcerpt($content, $post, $query) {
    	if ( 'wpsc-product' == relevanssi_get_post_type($post->ID) ) {
    		$content = $post->post_content . ( !empty($post->post_excerpt) ? " $post->post_excerpt" : '' );
    		if ( 'on' == get_option('relevanssi_expand_shortcodes') ) {
    			$content = do_shortcode($content);
    		} else {
    			$content = strip_shortcodes($content);
    		// The line below fixes a minor bug in Relevanssi 2.9.14 custom excerpt generating code:
    		$content = preg_replace("/\t/", ' ', $content);
    	return $content;


Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Mikko Saari


    Thanks, posted this code on the Relevanssi.com knowledge base.



    Hi Alexander.

    After much searching and coming to the horrifying discovery that WP-eCommerce’s search is terrible, I finally stumbled upon this post after installing Relevanssi.

    I have started using Visser Lab’s WP e-Commerce – Custom Fields plugin by and would appreciate some help querying the Attributes (Custom Meta) this plugin churns out.

    Here is the link to the Custom Fields plugin

    Let me know what I can do to help.

    Hi! Sorry for the delay in replying. I don’t have much time for looking into this, but I’ll see what I can do. Can you please e-mail me? It’s more convenient for me than via the forum: alexgieg@gmail.com



    hi is it possible to do compound category searches? i.e.
    media type: CD and
    Artist: Beatles and
    Genre: Rock and
    Price: $10-$30
    and have dropdowns for each separate category, choose option from each then search?

    Would love to see code that would accomplish this 🙂
    Thanks much!

    Plugin Author Mikko Saari


    It’s possible, but takes some programming. I’ve been selling these kinds of search solutions for $100-$200, so for now I haven’t really had the motivation to publish the code anywhere =) Anyway, it takes quite a bit of customization, there’s no general solution to it in any case, so if you’re not PHP literate, you’d have to buy someone to customize it for you.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Relevanssi – A Better Search] WP e-Commerce support in Relevanssi’ is closed to new replies.
Skip to toolbar