Location: PHPKode > scripts > Free Affiliates Tracking Script > v1.4/sort_functions.php
<?php
//=================================================================\\
// sort_functions.php v1.00                                                                                                          \\
//----------------------------------------------------------------------------------------------------------------------\\
// This file is part of Accessories Me PHP Affiliate Script.                                                                 \\
//----------------------------------------------------------------------------------------------------------------------\\
// File purpose: To sort products by price, title, publication date, review, relevance etc.               \\
//-----------------------------------------------------------------------------------------------------------------------\\
// COPYRIGHT: (C) 2004, 2005 Len Johnson                                                                                     \\
// Website: http://www.accessories.me.uk                                                                                      \\
// Email: hide@address.com                                                                                                       \\
// Mail: GB WEBS, 4 Leominster Walk, West Midlands, B45 9SW, UK                                                \\
// SUPPORT: http://www.accessories.me.uk/forum-2.htm                                                                 \\
//------------------------------------------------------------------------------------------------------------------------\\
// DONATIONS: If you have found this script useful you can make a donation to support                \\
// it's continued development at http://www.accessories.me.uk/about12.htm                                 \\
//------------------------------------------------------------------------------------------------------------------------\\
// COPYING/LICENSE: Accessories Me PHP Affiliate Script is free software;                                      \\
// you can redistribute it and/or modify it under the terms of the GNU General Public License        \\
// as published by the Free Software Foundation; either version 2                                                 \\
// of the License, or (at your option) any later version. See LICENSE.TXT                                        \\
//------------------------------------------------------------------------------------------------------------------------\\
// Accessories Me PHP Affiliate Script is distributed in the hope that it will be useful,                      \\
// but WITHOUT ANY WARRANTY;                                                                                                     \\
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. \\    
// See the GNU General Public License for more details.                                                                   \\
//-------------------------------------------------------------------------------------------------------------------------\\
// You should have received a copy of the GNU General Public License along with this program;      \\
// if not, write to:                                                                                                                               \\
// Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.        \\
// http://www.opensource.org/licenses/gpl-license.html                                                                   \\
//-------------------------------------------------------------------------------------------------------------------------\\
//=================================================================\\

require_once('lang_eng.php');

function Apparel() {
global $lang;
      echo '<option value="relevancerank">' . $lang['Featured'] . '</option>';
      echo '<option value="salesrank">' . $lang['Bestselling'] . '</option>';
      echo '<option value="pricerank">' . $lang['PriceHiToLo'] . '</option>';
      echo '<option value="-launch-date">' . $lang['Newest'] . '</option>';
      echo '<option value="sale-flag">' . $lang['SaleItems'] . '</option>';
   }
function Baby() {
global $lang;
      echo '<option value="psrank">' . $lang['Featured'] . '</option>';
      echo '<option value="salesrank">' . $lang['Bestselling'] . '</option>';
      echo '<option value="price">' . $lang['PriceLowToHi'] . '</option>';
      echo '<option value="-price">' . $lang['PriceHiToLo'] . '</option>';
      echo '<option value="titlerank">' . $lang['AtoZ'] . '</option>';
   }
function Beauty() {
global $lang;
      echo '<option value="pmrank">' . $lang['Featured'] . '</option>';
      echo '<option value="salesrank">' . $lang['Bestselling'] . '</option>';
      echo '<option value="price">' . $lang['PriceLowToHi'] . '</option>';
      echo '<option value="-price">' . $lang['PriceHiToLo'] . '</option>';
      echo '<option value="-launch-date">' . $lang['Newest'] . '</option>';
      echo '<option value="sale-flag">' . $lang['SaleItems'] . '</option>';
   }
function Books() {
global $lang;
      echo '<option value="relevancerank">' . $lang['Featured'] . '</option>';
      echo '<option value="salesrank">' . $lang['Bestselling'] . '</option>';
      echo '<option value="reviewrank">' . $lang['AvCustReview'] . '</option>';
      echo '<option value="pricerank">' . $lang['PriceLowToHi'] . '</option>';
      echo '<option value="inverse-pricerank">' . $lang['PriceHiToLo'] . '</option>';
      echo '<option value="daterank">' . $lang['PublishDate'] . '</option>';
      echo '<option value="titlerank">' . $lang['AtoZ'] . '</option>';
      echo '<option value="-titlerank">' . $lang['ZtoA'] . '</option>';
   }
function Classical() {
global $lang;
      echo '<option value="psrank">' . $lang['Featured'] . '</option>';
      echo '<option value="salesrank">' . $lang['Bestselling'] . '</option>';
      echo '<option value="reviewrank">' . $lang['AvCustReview'] . '</option>';
      echo '<option value="price">' . $lang['PriceLowToHi'] . '</option>';
      echo '<option value="-price">' . $lang['PriceHiToLo'] . '</option>';
      echo '<option value="daterank">' . $lang['PublishDate'] . '</option>';
      echo '<option value="titlerank">' . $lang['AtoZ'] . '</option>';
      echo '<option value="-titlerank">' . $lang['ZtoA'] . '</option>';
      echo '<option value="orig-rel-date">' . $lang['ReleaseDate'] . '</option>';
   }
function DigitalMusic() {
global $lang;
      echo '<option value="songtitlerank">' . $lang['MostPopular'] . '</option>';
      echo '<option value="uploaddaterank">' . $lang['DateAdded'] . '</option>';
   }
function DVD() {
global $lang;
      echo '<option value="relevancerank">' . $lang['Featured'] . '</option>';
      echo '<option value="salesrank">' . $lang['Bestselling'] . '</option>';
      echo '<option value="price">' . $lang['PriceLowToHi'] . '</option>';
      echo '<option value="titlerank">' . $lang['AtoZ'] . '</option>';
      echo '<option value="-video-release-date">' . $lang['ZtoA'] . '</option>';
      echo '<option value="orig-rel-date">' . $lang['ReleaseDate'] . '</option>';
   }
function electronics() {
global $lang;
      echo '<option value="pmrank">' . $lang['Featured'] . '</option>';
      echo '<option value="salesrank">' . $lang['Bestselling'] . '</option>';
      echo '<option value="reviewrank">' . $lang['AvCustReview'] . '</option>';
      echo '<option value="price">' . $lang['PriceLowToHi'] . '</option>';
      echo '<option value="-price">' . $lang['PriceHiToLo'] . '</option>';
      echo '<option value="titlerank">' . $lang['AtoZ'] . '</option>';
   }
function GourmetFood() {
global $lang;
      echo '<option value="relevancerank">' . $lang['Featured'] . '</option>';
      echo '<option value="salesrank">' . $lang['Bestselling'] . '</option>';
      echo '<option value="pricerank">' . $lang['PriceLowToHi'] . '</option>';
      echo '<option value="inverseprice">' . $lang['PriceHiToLo'] . '</option>';
      echo '<option value="launch-date">' . $lang['Newest'] . '</option>';
      echo '<option value="sale-flag">' . $lang['SaleItems'] . '</option>';
   }
function HealthPersonalCare() {
global $lang;
      echo '<option value="pmrank">' . $lang['Featured'] . '</option>';
      echo '<option value="salesrank">' . $lang['Bestselling'] . '</option>';
      echo '<option value="pricerank">' . $lang['PriceLowToHi'] . '</option>';
      echo '<option value="inverseprice">' . $lang['PriceHiToLo'] . '</option>';
      echo '<option value="launch-date">' . $lang['Newest'] . '</option>';
      echo '<option value="sale-flag">' . $lang['SaleItems'] . '</option>';
   }
function Jewelry() {
global $lang;
      echo '<option value="pmrank">' . $lang['Featured'] . '</option>';
      echo '<option value="salesrank">' . $lang['Bestselling'] . '</option>';
      echo '<option value="pricerank">' . $lang['PriceLowToHi'] . '</option>';
      echo '<option value="inverseprice">' . $lang['PriceHiToLo'] . '</option>';
      echo '<option value="launch-date">' . $lang['Newest'] . '</option>';
   }
function Kitchen() {
global $lang;
      echo '<option value="pmrank">' . $lang['Featured'] . '</option>';
      echo '<option value="salesrank">' . $lang['Bestselling'] . '</option>';
      echo '<option value="price">' . $lang['PriceLowToHi'] . '</option>';
      echo '<option value="-price">' . $lang['PriceHiToLo'] . '</option>';
      echo '<option value="daterank">' . $lang['PublishDate'] . '</option>';
      echo '<option value="titlerank">' . $lang['AtoZ'] . '</option>';
      echo '<option value="-titlerank">' . $lang['ZtoA'] . '</option>';
   }
function Magazines() {
global $lang;
      echo '<option value="subslot-salesrank">' . $lang['Bestselling'] . '</option>';
      echo '<option value="reviewrank">' . $lang['AvCustReview'] . '</option>';
      echo '<option value="price">' . $lang['PriceLowToHi'] . '</option>';
      echo '<option value="-price">' . $lang['PriceHiToLo'] . '</option>';
      echo '<option value="daterank">' . $lang['PublishDate'] . '</option>';
      echo '<option value="titlerank">' . $lang['AtoZ'] . '</option>';
      echo '<option value="-titlerank">' . $lang['ZtoA'] . '</option>';
   }
function Merchants() {
global $lang;
      echo '<option value="relevancerank">' . $lang['Featured'] . '</option>';
      echo '<option value="salesrank">' . $lang['Bestselling'] . '</option>';
      echo '<option value="pricerank">' . $lang['PriceLowToHi'] . '</option>';
      echo '<option value="inverseprice">' . $lang['PriceHiToLo'] . '</option>';
      echo '<option value="-launch-date">' . $lang['Newest'] . '</option>';
      echo '<option value="sale-flag">' . $lang['SaleItems'] . '</option>';
   }
function Miscellaneous() {
global $lang;
      echo '<option value="pmrank">' . $lang['Featured'] . '</option>';
      echo '<option value="salesrank">' . $lang['Bestselling'] . '</option>';
      echo '<option value="price">' . $lang['PriceLowToHi'] . '</option>';
      echo '<option value="-price">' . $lang['PriceHiToLo'] . '</option>';
      echo '<option value="titlerank">' . $lang['AtoZ'] . '</option>';
      echo '<option value="-titlerank">' . $lang['ZtoA'] . '</option>';
   }
function Music() {
global $lang;
      echo '<option value="psrank">' . $lang['Featured'] . '</option>';
      echo '<option value="salesrank">' . $lang['Bestselling'] . '</option>';
      echo '<option value="price">' . $lang['PriceLowToHi'] . '</option>';
      echo '<option value="-price">' . $lang['PriceHiToLo'] . '</option>';
      echo '<option value="titlerank">' . $lang['AtoZ'] . '</option>';
      echo '<option value="-titlerank">' . $lang['ZtoA'] . '</option>';
      echo '<option value="artistrank">' . $lang['ArtistRank'] . '</option>';
      echo '<option value="orig-rel-date">' . $lang['ReleaseDate'] . '</option>';
   }
function MusicalInstruments() {
global $lang;
      echo '<option value="pmrank">' . $lang['Featured'] . '</option>';
      echo '<option value="salesrank">' . $lang['Bestselling'] . '</option>';
      echo '<option value="price">' . $lang['PriceLowToHi'] . '</option>';
      echo '<option value="-price">' . $lang['PriceHiToLo'] . '</option>';
      echo '<option value="-launch-date">' . $lang['Newest'] . '</option>';
      echo '<option value="sale-flag">' . $lang['SaleItems'] . '</option>';
   }
function MusicTracks() {
global $lang;
      echo '<option value="titlerank">' . $lang['AtoZ'] . '</option>';
      echo '<option value="-titlerank">' . $lang['ZtoA'] . '</option>';
   }
function OfficeProducts() {
global $lang;
      echo '<option value="pmrank">' . $lang['Featured'] . '</option>';
      echo '<option value="salesrank">' . $lang['Bestselling'] . '</option>';
      echo '<option value="reviewrank">' . $lang['AvCustReview'] . '</option>';
      echo '<option value="price">' . $lang['PriceLowToHi'] . '</option>';
      echo '<option value="-price">' . $lang['PriceHiToLo'] . '</option>';
      echo '<option value="titlerank">' . $lang['AtoZ'] . '</option>';
   }
function OutdoorLiving() {
global $lang;
      echo '<option value="psrank">' . $lang['Featured'] . '</option>';
      echo '<option value="salesrank">' . $lang['Bestselling'] . '</option>';
      echo '<option value="price">' . $lang['PriceLowToHi'] . '</option>';
      echo '<option value="-price">' . $lang['PriceHiToLo'] . '</option>';
      echo '<option value="titlerank">' . $lang['AtoZ'] . '</option>';
      echo '<option value="-titlerank">' . $lang['ZtoA'] . '</option>';
   }
function PCHardware() {
global $lang;
      echo '<option value="psrank">' . $lang['Featured'] . '</option>';
      echo '<option value="salesrank">' . $lang['Bestselling'] . '</option>';
      echo '<option value="price">' . $lang['PriceLowToHi'] . '</option>';
      echo '<option value="-price">' . $lang['PriceHiToLo'] . '</option>';
      echo '<option value="titlerank">' . $lang['AtoZ'] . '</option>';
   }
function Photo() {
global $lang;
      echo '<option value="pmrank">' . $lang['Featured'] . '</option>';
      echo '<option value="salesrank">' . $lang['Bestselling'] . '</option>';
      echo '<option value="price">' . $lang['PriceLowToHi'] . '</option>';
      echo '<option value="-price">' . $lang['PriceHiToLo'] . '</option>';
      echo '<option value="titlerank">' . $lang['AtoZ'] . '</option>';
      echo '<option value="-titlerank">' . $lang['ZtoA'] . '</option>';
   }
function Restaurants() {
global $lang;
      echo '<option value="relevance">' . $lang['Featured'] . '</option>';
      echo '<option value="titlerank">' . $lang['AtoZ'] . '</option>';
   }
function Software() {
global $lang;
      echo '<option value="pmrank">' . $lang['Featured'] . '</option>';
      echo '<option value="salesrank">' . $lang['Bestselling'] . '</option>';
      echo '<option value="price">' . $lang['PriceLowToHi'] . '</option>';
      echo '<option value="-price">' . $lang['PriceHiToLo'] . '</option>';
      echo '<option value="titlerank">' . $lang['AtoZ'] . '</option>';
   }
function SportingGoods() {
global $lang;
      echo '<option value="relevancerank">' . $lang['Featured'] . '</option>';
      echo '<option value="salesrank">' . $lang['Bestselling'] . '</option>';
      echo '<option value="pricerank">' . $lang['PriceLowToHi'] . '</option>';
      echo '<option value="inverseprice">' . $lang['PriceHiToLo'] . '</option>';
      echo '<option value="launch-date">' . $lang['Newest'] . '</option>';
      echo '<option value="sale-flag">' . $lang['SaleItems'] . '</option>';
   }
function Tools() {
global $lang;
      echo '<option value="pmrank">' . $lang['Featured'] . '</option>';
      echo '<option value="salesrank">' . $lang['Bestselling'] . '</option>';
      echo '<option value="price">' . $lang['PriceLowToHi'] . '</option>';
      echo '<option value="-price">' . $lang['PriceHiToLo'] . '</option>';
      echo '<option value="titlerank">' . $lang['AtoZ'] . '</option>';
      echo '<option value="-titlerank">' . $lang['ZtoA'] . '</option>';
   }
function Toys() {
global $lang;
      echo '<option value="pmrank">' . $lang['Featured'] . '</option>';
      echo '<option value="salesrank">' . $lang['Bestselling'] . '</option>';
      echo '<option value="price">' . $lang['PriceLowToHi'] . '</option>';
      echo '<option value="-price">' . $lang['PriceHiToLo'] . '</option>';
      echo '<option value="titlerank">' . $lang['AtoZ'] . '</option>';
      echo '<option value="-age-min">' . $lang['AgeHiToLo'] . '</option>';
   }
function VHS() {
global $lang;
      echo '<option value="relevancerank">' . $lang['Featured'] . '</option>';
      echo '<option value="salesrank">' . $lang['Bestselling'] . '</option>';
      echo '<option value="price">' . $lang['PriceLowToHi'] . '</option>';
      echo '<option value="-price">' . $lang['PriceHiToLo'] . '</option>';
      echo '<option value="titlerank">' . $lang['AtoZ'] . '</option>';
      echo '<option value="-video-release-date">' . $lang['ReleaseDate'] .  '</option>';
   }
function Video() {
global $lang;
      echo '<option value="relevancerank">' . $lang['Featured'] . '</option>';
      echo '<option value="salesrank">' . $lang['Bestselling'] . '</option>';
      echo '<option value="price">' . $lang['PriceLowToHi'] . '</option>';
      echo '<option value="-price">' . $lang['PriceHiToLo'] . '</option>';
      echo '<option value="titlerank">' . $lang['AtoZ'] . '</option>';
      echo '<option value="-video-release-date">' . $lang['ReleaseDate'] . '</option>';
   }
function VideoGames() {
global $lang;
      echo '<option value="pmrank">' . $lang['Featured'] . '</option>';
      echo '<option value="salesrank">' . $lang['Bestselling'] . '</option>';
      echo '<option value="price">' . $lang['PriceLowToHi'] . '</option>';
      echo '<option value="-price">' . $lang['PriceHiToLo'] . '</option>';
      echo '<option value="titlerank">' . $lang['AtoZ'] . '</option>';
   }
function Wireless() {
global $lang;
      echo '<option value="psrank">' . $lang['Featured'] . '</option>';
      echo '<option value="salesrank">' . $lang['Bestselling'] . '</option>';
      echo '<option value="titlerank">' . $lang['AtoZ'] . '</option>';
      echo '<option value="-titlerank">' . $lang['ZtoA'] . '</option>';
   }
function WirelessAccessories() {
global $lang;
      echo '<option value="psrank">' . $lang['Featured'] . '</option>';
      echo '<option value="salesrank">' . $lang['Bestselling'] . '</option>';
      echo '<option value="titlerank">' . $lang['AtoZ'] . '</option>';
      echo '<option value="-titlerank">' . $lang['ZtoA'] . '</option>';
   }

// Display stars to show consumer ratings

function avRating()
{

$rating = $txItem->xReviewsRating;
  $result = '';  

  $count = $rating;
  $count = $rating *2;
  round($count);
  $count = $count/2;
  
  $rating = number_format($rating, 1);
  
  while($count>0)
  {
    if($count>=1)
    {
      $result .= "<img src='picts/star.gif' alt = '$rating Stars'>";
    }
    else if($count>0.4)
    {
      $result .= "<img src='picts/halfstar.gif' alt  = '$rating Stars'>";
    }
    $count--;
  }
  return $result;
}
?>
Return current item: Free Affiliates Tracking Script