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

    Display top products from our trends api

    I put together a simple script that shows you how to pull back the top 20 products for any query and display them on your page. A lot of people miss the true power of Prosperent. We give you access to all of our sales data network wide, so you can add a simple php script like this one to your existing web site or blog:

    PHP Code:
    <?php
    //Trends Limit for top sellers
    $trendLimit '20'

    //Todays Date ymd used for trends query
    $today date("Ymd"); 

    //API Key
    $apiKey 'YOUR_API_KEY_HERE';

    //Setup Query Parameters
    require_once('Prosperent_Api_new.php'); 
    $prosperentApi = new Prosperent_Api(array( 
            
    'filterKeyword'      =>  '*shoes*',
            
    'commissionDateRange' => '20140601,' $today,
            
    'enableFacets' => 'merchant'
        
    )); 


        
    //fetch the result 
        
    $prosperentApi->fetchTrends(); 
    foreach (
    $prosperentApi->getFacets('merchant') as $merchant
        { 
        
    $merchantArray[] = $merchant['value'];
        }
        require_once(
    'Prosperent_Api_new.php');
        
    $prosperentApi = new Prosperent_Api(array(
          
    'api_key'         => $apiKey,
          
    'filterMerchant'  => $merchantArray,
          
    'visitor_ip'      => $_SERVER['REMOTE_ADDR'],
          
    'channel_id'      => 0,
          
    'page'            => 1,
          
    'imageSize'       => '125x125',
          
    'limit'           => $trendLimit  
      
    )); 
      
    //Loop Through Results and Output to Page 
    $results $prosperentApi->fetch();
    foreach (
    $prosperentApi->getData() as $record
        { 
    ?>
        <li id="serp2" class="result "  >
          <div class="result-body">
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="125px"><div style="width: 125px; height: 125px; overflow: hidden;"><a class="UrlTitleLine ui-widget-content "  
    href="<?=$record['affiliate_url']?>" dest="<?=$record['affiliate_url']?>" orig="<?=$record['affiliate_url']?>" pos="1"
    title="<?=$record['merchant']?>" ><img
     src="<?=$record['image_url']?>"  alt="<?=$record['keyword']?>" title="<?=$record['keyword']?>" width=125 height=125></a></div></td>
              </tr>
            </table>
            <div class="url-line"> <span class="resultUrl ">
              <?=$record['merchant']?>
              </span> <span class="non-url"> &nbsp;&nbsp;&ndash;&nbsp; $
              <?=$record['price']?>
              &nbsp;
              <?=$record['brand']?>
              </span>
              <div id="tools1" class="pop-shadow-small round5 tools-pop"></div>
            </div>
          </div>
        </li>
        <?php
    }  
    ?>
    Be sure to replace:
    PHP Code:
    $apiKey 'YOUR_API_KEY_HERE'
    With an actual api key. You can change the query, change the date range searched, and also change the number of results returned.

  2. #2
    What is the maximum number of products we can retrieve?

    If i want a global list of each trend products for each day, i should query day by day then store the results in a txt for example?

    I know i can set a month range, But i want more than the limit each query can retrieve.

    So if the maximum is 100 products for each query i will get 3000 products for 30 days. ( i know ill get duplicates)

    AM i thinking well or will it be simple doing some other approach to get what i want?
    Last edited by blogmaster2003; 08-22-2014 at 05:14 PM.

  3. #3
    Yes, you can get all of them, but you will have to do more queries, for example for every day fetch all trending merchants and then for every trending merchant fetch trending products. Some merchants can have more than 100 products so you will have to break them also by category or brand to get all of them.

  4. #4
    I Want Download File Prosperent_Api_new.php

    Thank You.

  5. #5

  6. #6
    You can change filterKeyword in the above example to filterMerchant to get back top sellers for a specific merchant like this:

    PHP Code:
    //Setup Query Parameters
    require_once('Prosperent_Api_new.php'); 
    $prosperentApi = new Prosperent_Api(array( 
            
    'filterMerchant'      =>  '*6pm*',
            
    'commissionDateRange' => '20130601,' $today,
            
    'enableFacets' => 'merchant'
        
    )); 

  7. #7
    Quote Originally Posted by prosperent brian View Post
    You can change filterKeyword in the above example to filterMerchant to get back top sellers for a specific merchant like this:

    PHP Code:
    //Setup Query Parameters
    require_once('Prosperent_Api_new.php'); 
    $prosperentApi = new Prosperent_Api(array( 
            
    'filterMerchant'      =>  '*6pm*',
            
    'commissionDateRange' => '20130601,' $today,
            
    'enableFacets' => 'merchant'
        
    )); 
    is filterMerchantId not implemented? Because then we can use the merchantId and not worry about the name or putting wildcards in to look for any

  8. #8
    Not yet. We have to roll out the new commission system first.

  9. #9
    can I put this code in wordpress? I want to show the product in search results.

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