I am trying to price an object based on ranking. My problem is that if the object has no ranking it is going to the next tier. Here is a sample of my code:
switch ($amazonResult['SalesRank']) {
case ($amazonResult['SalesRank'] < 1 || trim($amazonResult['SalesRank'])===''|| !isset($amazonResult['SalesRank']) || $amazonResult['SalesRank']=== null):
$Price=((float) $lowestAmazonPrice) *<some percent to pay>;
$payPrice = round($Price, 0); //to round the price up or down to the nearest $
break;
case ($amazonResult['SalesRank'] > 0 && $amazonResult['SalesRank'] <= 15000):
$Price=((float) $lowestAmazonPrice) * <some percent to pay>;
$payPrice = round($Price, 0); //to round the price up or down to the nearest $
break;
default:
$Price=((float) $lowestAmazonPrice) * <some percent to pay>;
$payPrice = round($Price, 0); //to round the price up or down to the nearest $
break;
}
How do I get it to find the ranking if the ranking is either empty, null, or 0?
$amazonResult['SalesRank'] could be empty, and is the value that needs to be compared in each case. This variable is pulled from a query and is run every time an item is to be priced