Join Free
+ Reply to Thread
Results 1 to 5 of 5
  1. #1

    Howto: Display query suggestions

    Misspellings happen often. Here is a quick guide to show you how to make use of the built in Prosperent query suggest tool. It shows suggestions based on common misspellings.

    First, enable query suggestions in your api call:

    PHP Code:
    'enableQuerySuggestion' => true
    Should look like the following:

    PHP Code:
    $prosperentApi = new Prosperent_Api(array(
        
    'api_key'                      => $apiKey,
        
    'query'                         => $trimmed,
        
    'limit'                           => $facetLimit,
        
    'enableQuerySuggestion' => true,
        
    'enableFacets'               => true
    )); 
    Next, under:

    PHP Code:
    $prosperentApi->fetch(); 
    Add the following:

    PHP Code:
    if (null != ($querySuggestion $prosperentApi->getQuerySuggestion())) 
        { 
            echo 
    $querySuggestion
        } 
    If the $querySuggestion variable is no null, it will display on your page. You can of course remove the if condition and assign the response to a variable that you can use somewhere else in your code:

    in that case, replace:

    PHP Code:
    if (null != ($querySuggestion $prosperentApi->getQuerySuggestion())) 
        { 
            echo 
    $querySuggestion
        } 
    with:

    PHP Code:
    $querySuggest $prosperentApi->getQuerySuggestion(); 
    Then wherever you want to display the query suggestion, just use something like:

    PHP Code:
    <?
    if (null != $querySuggest
        {
    ?> 
            <h2>Did you mean: <a href="search.php?q=<?=$querySuggest?>"><?=$querySuggest?></a></h2>
    <?         
        
    }
    ?>

  2. #2
    Hi Brian
    Thanks for your guide about using query suggestion.
    However, I had a little doubt about using redirect URL with text query.
    I saw on prosperent api documentation, a redirect URL Example about Burton Snowboard keyword

    prosperent.com/api/phraselinker/redirect?apiKey=b85f3b3c89a1299467cdb404747da915&s id=12345&phrase=Burton%20Snowboards


    My question is:
    1. Is it allowed for me to generate a query from title post then insert it into a href tags?

    My opinion example:
    Code:
    $titlepost='cheap notebook';
    $query=urlencode($titlepost);
    $afflink='http://prosperent.com/api/phraselinker/redirect?apiKey=b85f3b3c89a1299467cdb404747da915&sid=12345&phrase='.$query;
    
    echo '<a href=" '.$afflink.'" target="_blank">Click here to find related '.$titlepost.' products </a>';

    2. If visitor click on this link and purchase a product, will I earn commission?

  3. #3
    bump
    So quiet in here..

  4. #4
    Yes, doing this is fine, and it generates a commission.

    Sorry, most of our support questions come through the dashboard help icon these days, so the forum is definitely slower.

  5. #5
    Quote Originally Posted by prosperent brian View Post
    Yes, doing this is fine, and it generates a commission.

    Sorry, most of our support questions come through the dashboard help icon these days, so the forum is definitely slower.
    Ok. Many thanks for your kind support

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
coupons | coupons and deals