Forum Replies Created

Viewing 13 replies - 1 through 13 (of 13 total)
  • Thread Starter marcu5p

    (@marcu5p)

    Hi Michael

    Wow, lightning fast reply, thank you.

    That works a treat, and of course makes perfect sense to modify the ci_comment_rating_save_comment_rating() instead.

    Both elements now working, only thing left to say is… you’re a star!

    Thanks as always
    Marcus

    Thread Starter marcu5p

    (@marcu5p)

    Hi Michael

    Thanks for your swift reply as always.

    You’re right I am wanting to index the comment count, and your function works a dream so thanks for that.

    I have also implemented a simple star star rating for comments (a version of this https://www.cssigniter.com/add-rating-wordpress-comment-system/) and called the ci_comment_rating_get_average_ratings function in an attempt to also index the average rating at the same time. It nearly works but indexes the ratings previous value which I guess is down to not reaching reaching the catch block.

    Any ideas on solving this bit would be much appreciated.

    Thanks
    Marcus

    Thread Starter marcu5p

    (@marcu5p)

    Yes, got it working, thanks so much.

    Thread Starter marcu5p

    (@marcu5p)

    Yes for sure I’d need to use the Push Settings button to trigger it.

    But I can’t get the function constructed correctly, that’s really where I need your knowledge.

    using:

    function facet_display_index_settings( array $settings ) {
    	$settings['renderingContent'] = ['solution_name' =>
    	['Stress Testing', 'API Access'],
    ];
    	return $settings;
    }
    add_filter( 'algolia_searchable_posts_index_settings', 'facet_display_index_settings' );
    add_filter( 'algolia_posts_index_settings', 'facet_display_index_settings' );

    And then “Push Settings” gives me this error:

    An error occurred: Error in renderingContent parsing: Unexpected value type: invalid key 'solution_name'. Expected: facetOrdering, redirect (near 1:51)

    Thanks.

    Thread Starter marcu5p

    (@marcu5p)

    Hi Michael

    Thanks for the reply. I want to push settings to Alogia Facet Display configuration.

    So, I have a list of Products (attribute is solution_name) which form one of my facets. I can sort these easily asc or desc by name or count (with js), but I need them in a custom order. I can achieve this via the Alogia dashboard using Configuration -> Facet Display (renderingContent) and pin the items it the order required. Once they are in the correct order they won’t change.

    I need to push this order from WordPress rather than having to go to the dashboard, in a similar way we are pushing which attributes to use for faceting using attributesForFaceting.

    For example I have tried this but it doesn’t work:

    function custom_posts_index_settings( array $settings ) {
    	$settings['renderingContent'] = ['solution_name => ['Solution One', Solution Five', 'Solution Three', 'Solution two', 'Solution Four'],
    ];
    	return $settings;
    }
    add_filter( 'algolia_searchable_posts_index_settings', 'custom_posts_index_settings' );
    add_filter( 'algolia_posts_index_settings', 'custom_posts_index_settings' );

    Thanks as always

    Thread Starter marcu5p

    (@marcu5p)

    This works:

    function custom_posts_index_settings( array $settings ) {
    	$settings['attributesForFaceting'] = ['resource_type', 'solution_category', 'wpml.display_name', 'post_type'];
    	return $settings;
    }
    add_filter( 'algolia_searchable_posts_index_settings', 'custom_posts_index_settings' );
    add_filter( 'algolia_posts_index_settings', 'custom_posts_index_settings' );
    Thread Starter marcu5p

    (@marcu5p)

    Hi Michael

    Thanks for your reply.

    No I’m afraid that doesn’t work either.

    Thread Starter marcu5p

    (@marcu5p)

    Hi Michael

    Thanks for you swift reply as always.

    At the moment I have decided to use a single index and use a filter to return only the records (just my custom post types) I need for my separate search page. Seems to work ok, but I will investigate the information you given as ideally 2 indexes would be good.

    Thanks again

    Thread Starter marcu5p

    (@marcu5p)

    Thank you.

    Thread Starter marcu5p

    (@marcu5p)

    Thanks for the steer really appreciate it. The below seems to do exactly what I wanted, but I need to do more testing to check.

    function ss_algolia_resource_attributes( array $attributes, WP_Post $post ) {
    
    $taxonomy = 'global_tag'; //Taxonomy Name
    $terms = get_the_terms( $post->ID, $taxonomy );
    
    $resource_type_children = '';
    
    foreach ( $terms as $term ) :
    if( $term->parent == 62 ) { //Parent Term ID
    $resource_type_children .= $term->name;
    } 
    endforeach;
    
    $attributes['resource_type'] = $resource_type_children;
    
    	return $attributes;
    }
    add_filter( 'algolia_post_shared_attributes', 'ss_algolia_resource_attributes', 10, 2 );
    add_filter( 'algolia_searchable_post_shared_attributes', 'ss_algolia_resource_attributes', 10, 2 );
    Thread Starter marcu5p

    (@marcu5p)

    Ok, thanks for the pointer, I’ll investigate further.

    Thread Starter marcu5p

    (@marcu5p)

    Hi Michael

    Thanks for the quick response.

    Yes, and then be able to create another object where it just shows children of Employees
    so level 1 is just “Harry Bunce”.

    Thanks
    Marcus

    Thread Starter marcu5p

    (@marcu5p)

    Thanks for the reply, I look forward to seeing this functionality.

Viewing 13 replies - 1 through 13 (of 13 total)