WordPress.org

Ready to get started?Download WordPress

Forums

Relevanssi - A Better Search
WP e-Commerce support in Relevanssi (6 posts)

  1. Alexander Gieg
    Member
    Posted 2 years ago #

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

    To:

    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:

    add_filter('relevanssi_excerpt_content','wpscproductexcerpt',10,3);
    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;
    }

    http://wordpress.org/extend/plugins/relevanssi/

  2. Mikko Saari
    Member
    Plugin Author

    Posted 2 years ago #

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

  3. sixfootjames
    Member
    Posted 1 year ago #

    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.

  4. Alexander Gieg
    Member
    Posted 1 year ago #

    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

  5. 3dproducer
    Member
    Posted 1 year ago #

    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!

  6. Mikko Saari
    Member
    Plugin Author

    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic