Lawn Care Business Forum Lawn Care Business Book Lawn Care Business Blog Lawn Care Software
Home Forum Contract & Flyer Templates Blog Software Videos Podcast Calculators / Estimators Store Mower Review Design It Yourself Lawn Business School

Go Back   GopherHaul Landscaping & Lawn Care Business Marketing Forum

". mysql_error()); } // Select the database $db_select = mysql_select_db($db_database); if (!$db_select){ die ("Could not select the database:
". mysql_error( )); } // for vbulletin echo "";
» Lawn Care Business Product Results
"; // *************************************************************** // BEGIN Display EBAY SEARCH RESULTS POST // *************************************************************** if (isset($_POST['submit'])) { $ModelNumber = mysqlclean($_POST,"ModelNumber",100,$connection); $ManufacturerName = mysqlclean($_POST,"ManufacturerName",100,$connection); $CategoryID = mysqlclean($_POST,"CategoryID",100,$connection); $Query = mysqlclean($_POST,"Query",100,$connection); $safeQuery = urlencode($_POST['Query']); $siteID = $_POST['SiteID']; $priceRangeMin = 0.0; $priceRangeMax = $_POST['MaxPrice']; $itemsPerRange = $_POST['ItemsPerRange']; $debug = (boolean) $_POST['Debug']; // This is used to enter the first mid range search item into a db. $SearchDataEnteredFlag = No; echo" "; echo ""; $results = ''; $endpoint = 'http://open.api.ebay.com/shopping'; // URL to call $responseEncoding = 'XML'; // Format of the response $rangeArr = array('Low-Range', 'Mid-Range', 'High-Range'); $priceRange = ($priceRangeMax - $priceRangeMin) / 3; // find price ranges for three tables $priceRangeMin = sprintf("%01.2f", 0.00); $priceRangeMax = $priceRangeMin; // needed for initial setup foreach ($rangeArr as $range) { $priceRangeMax = sprintf("%01.2f", ($priceRangeMin + $priceRange)); $results .= "

$range : $priceRangeMin ~ $priceRangeMax

\n"; // Construct the FindItems call $apicall = "$endpoint?callname=FindItemsAdvanced" . "&version=537" . "&siteid=$siteID" . "&appid=SteveLow-df98-45b5-a264-77c172a7fa77" . "&QueryKeywords=$safeQuery" . "&MaxEntries=$itemsPerRange" . "&ItemSort=BestMatchCategoryGroup" //BestMatch, BestMatchCategoryGroup, BestMatchPlusPrice . "&GroupsMax=3" . "&GroupMaxEntries=10" . "&ItemType=AllItemTypes" // FixedPricedItem, AllItemTypes, AllItems . "&PriceMin.Value=$priceRangeMin" . "&PriceMax.Value=$priceRangeMax" . "&IncludeSelector=SearchDetails" //CategoryHistogram, SearchDetails // . "&CategoryHistogramMaxParents=3" //Max: 10. Default: 3. . "&DescriptionSearch=True" // true, false // . "&HideDuplicateItems=True" // true, false // . "&IncludeSelector=CategoryHistogram" // Details, CategoryHistogram . "&trackingpartnercode=9" // fill in your information in next 3 lines . "&trackingid=5336238492" . "&affiliateuserid=456" // . "&PageNumber=1" . "&responseencoding=$responseEncoding"; if ($debug) { print "GET call = $apicall
"; // see GET request generated } // Load the call and capture the document returned by the Shopping API $resp = simplexml_load_file($apicall); // Check to see if the response was loaded, else print an error // Probably best to split into two different tests, but have as one for brevity if ($resp && $resp->TotalItems > 0) { // this is to enter the first mid range product response into a db if ((($range == 'Low-Range') or ($range == 'Mid-Range'))and ($SearchDataEnteredFlag == No)) { $results .= "
"; } $results .= 'Total items : ' . $resp->TotalItems . "
\n"; $results .= '' . "\n"; // $results .= "\n"; // If the response was loaded, parse it and build links foreach($resp->SearchResult->ItemArray->Item as $item) { if ($item->GalleryURL) { $picURL = $item->GalleryURL; } else { $picURL = "http://pics.ebaystatic.com/aw/pics/express/icons/iconPlaceholder_96x96.gif"; } $link = $item->ViewItemURLForNaturalSearch; $title = $item->Title; $price = sprintf("%01.2f", $item->ConvertedCurrentPrice); $ship = sprintf("%01.2f", $item->ShippingCostSummary->ShippingServiceCost); $total = sprintf("%01.2f", ((float)$item->ConvertedCurrentPrice + (float)$item->ShippingCostSummary->ShippingServiceCost)); // Determine currency to display - so far only seen cases where priceCurr = shipCurr, but may be others $priceCurr = (string) $item->ConvertedCurrentPrice['currencyID']; $shipCurr = (string) $item->ShippingCostSummary->ShippingServiceCost['currencyID']; if ($priceCurr == $shipCurr) { $curr = $priceCurr; } else { $curr = "$priceCurr / $shipCurr"; // potential case where price/ship currencies differ } $timeLeft = getPrettyTimeFromEbayTime($item->TimeLeft); $endTime = strtotime($item->EndTime); // returns Epoch seconds $endTime = $item->EndTime; // $results .= "" // . //""; $results .= ""; // this is to enter the first mid range product response into a db if (($range == 'Mid-Range') and ($SearchDataEnteredFlag == No)) { // insert the first mid-range product search return into db // $dbquery = "Insert INTO ProductSearches (Query, ImageURL, ProductName, Link, SearchTime, SearchDate, IP) VALUES ('$Query','$picURL', '$title', '$link', '$CurrentTime', '$CurrentDate', '$ip')"; $dbquery = "Insert INTO ProductSearches (SearchQuery, ImageURL, ProductName, Link, SearchTime, SearchDate, IP, CategoryID) VALUES ('$Query','$picURL', '$title', '$link', '$CurrentTime', '$CurrentDate', '$ip', '$CategoryID')"; if (!(@mysql_query($dbquery,$connection))) showerror; $SearchDataEnteredFlag = Yes; } } $results .= "
TitlePrice     Shipping     Total     Time LeftEnd Time
$title$price$ship$total$curr$timeLeft$endTime
$title  ".money_format('%n', $price)."
"; } // If there was no response, print an error else { $results = "

No additional items found

"; } $priceRangeMin = $priceRangeMax; // set up for next iteration } // foreach echo ""; echo "

$Query

Categories:
    "; // get the list of equipment types. $query="SELECT * FROM EquipmentType Order By TypeName"; $result=mysql_query($query); $num=mysql_numrows($result); $i=0; while ($i < $num) { $TypeName=mysql_result($result,$i,"TypeName"); $UniqueID=mysql_result($result,$i,"UniqueID"); // echo "
  • $TypeName
  • "; //if it equals books or software, go back to the store page to display it so it doesnt search it on ebay if (($TypeName == Books) OR ($TypeName == Software)) { echo "
  • $TypeName
  • "; } // don't display the category 'other' elseif ($TypeName <> Other) { echo "
  • $TypeName
  • "; } $i++; } echo "
"; echo "
"; echo " Search again?
"; echo '
'; echo " Max Price $ Items Per Range

"; echo "$results"; echo "
"; } // *************************************************************** // END Display EBAY SEARCH RESULTS POST // *************************************************************** // *************************************************************** // BEGIN Display EBAY SEARCH RESULTS GET // *************************************************************** elseif (isset($_GET['Submit'])) { $ModelNumber = mysqlclean($_GET,"ModelNumber",100,$connection); $ManufacturerName = mysqlclean($_GET,"ManufacturerName",100,$connection); $CategoryID = mysqlclean($_GET,"CategoryID",100,$connection); $CategoryName = mysqlclean($_GET,"CategoryName",100,$connection); //$Query = mysqlclean($_GET,"Query",100,$connection); $Query = $CategoryName; // $safeQuery = urlencode($_GET['Query']); $safeQuery = urlencode($Query); // $siteID = $_GET['SiteID']; $siteID = 0; // 0 is the U.S. $priceRangeMin = 0.0; // $priceRangeMax = $_POST['MaxPrice']; $priceRangeMax = 1000; // $itemsPerRange = $_POST['ItemsPerRange']; $itemsPerRange = 10; // $debug = (boolean) $_POST['Debug']; $debug = False; // This is used to enter the first mid range search item into a db. $SearchDataEnteredFlag = No; echo" "; echo ""; $results = ''; $endpoint = 'http://open.api.ebay.com/shopping'; // URL to call $responseEncoding = 'XML'; // Format of the response $rangeArr = array('Low-Range', 'Mid-Range', 'High-Range'); $priceRange = ($priceRangeMax - $priceRangeMin) / 3; // find price ranges for three tables $priceRangeMin = sprintf("%01.2f", 0.00); $priceRangeMax = $priceRangeMin; // needed for initial setup foreach ($rangeArr as $range) { $priceRangeMax = sprintf("%01.2f", ($priceRangeMin + $priceRange)); $results .= "

$range : $priceRangeMin ~ $priceRangeMax

\n"; // Construct the FindItems call $apicall = "$endpoint?callname=FindItemsAdvanced" . "&version=537" . "&siteid=$siteID" . "&appid=SteveLow-df98-45b5-a264-77c172a7fa77" . "&QueryKeywords=$safeQuery" . "&MaxEntries=$itemsPerRange" . "&ItemSort=BestMatchCategoryGroup" //BestMatch, BestMatchCategoryGroup, BestMatchPlusPrice . "&GroupsMax=3" . "&GroupMaxEntries=10" . "&ItemType=AllItemTypes" // FixedPricedItem, AllItemTypes, AllItems . "&PriceMin.Value=$priceRangeMin" . "&PriceMax.Value=$priceRangeMax" . "&IncludeSelector=SearchDetails" //CategoryHistogram, SearchDetails // . "&CategoryHistogramMaxParents=3" //Max: 10. Default: 3. . "&DescriptionSearch=True" // true, false // . "&HideDuplicateItems=True" // true, false // . "&IncludeSelector=CategoryHistogram" // Details, CategoryHistogram . "&trackingpartnercode=9" // fill in your information in next 3 lines . "&trackingid=5336238492" . "&affiliateuserid=456" // . "&PageNumber=1" . "&responseencoding=$responseEncoding"; if ($debug) { print "GET call = $apicall
"; // see GET request generated } // Load the call and capture the document returned by the Shopping API $resp = simplexml_load_file($apicall); // Check to see if the response was loaded, else print an error // Probably best to split into two different tests, but have as one for brevity if ($resp && $resp->TotalItems > 0) { // this is to enter the first mid range product response into a db if ((($range == 'Low-Range') or ($range == 'Mid-Range'))and ($SearchDataEnteredFlag == No)) { $results .= "
"; } $results .= 'Total items : ' . $resp->TotalItems . "
\n"; $results .= '' . "\n"; // $results .= "\n"; // If the response was loaded, parse it and build links foreach($resp->SearchResult->ItemArray->Item as $item) { if ($item->GalleryURL) { $picURL = $item->GalleryURL; } else { $picURL = "http://pics.ebaystatic.com/aw/pics/express/icons/iconPlaceholder_96x96.gif"; } $link = $item->ViewItemURLForNaturalSearch; $title = $item->Title; $price = sprintf("%01.2f", $item->ConvertedCurrentPrice); $ship = sprintf("%01.2f", $item->ShippingCostSummary->ShippingServiceCost); $total = sprintf("%01.2f", ((float)$item->ConvertedCurrentPrice + (float)$item->ShippingCostSummary->ShippingServiceCost)); // Determine currency to display - so far only seen cases where priceCurr = shipCurr, but may be others $priceCurr = (string) $item->ConvertedCurrentPrice['currencyID']; $shipCurr = (string) $item->ShippingCostSummary->ShippingServiceCost['currencyID']; if ($priceCurr == $shipCurr) { $curr = $priceCurr; } else { $curr = "$priceCurr / $shipCurr"; // potential case where price/ship currencies differ } $timeLeft = getPrettyTimeFromEbayTime($item->TimeLeft); $endTime = strtotime($item->EndTime); // returns Epoch seconds $endTime = $item->EndTime; // $results .= "" // . //""; $results .= ""; // this is to enter the first mid range product response into a db if (($range == 'Mid-Range') and ($SearchDataEnteredFlag == No)) { // insert the first mid-range product search return into db // $dbquery = "Insert INTO ProductSearches (Query, ImageURL, ProductName, Link, SearchTime, SearchDate, IP) VALUES ('$Query','$picURL', '$title', '$link', '$CurrentTime', '$CurrentDate', '$ip')"; $dbquery = "Insert INTO ProductSearches (SearchQuery, ImageURL, ProductName, Link, SearchTime, SearchDate, IP, CategoryID) VALUES ('$Query','$picURL', '$title', '$link', '$CurrentTime', '$CurrentDate', '$ip', '$CategoryID')"; if (!(@mysql_query($dbquery,$connection))) showerror; $SearchDataEnteredFlag = Yes; } } $results .= "
TitlePrice     Shipping     Total     Time LeftEnd Time
$title$price$ship$total$curr$timeLeft$endTime
$title  ".money_format('%n', $price)."
"; } // If there was no response, print an error else { $results = "

No additional items found

"; } $priceRangeMin = $priceRangeMax; // set up for next iteration } // foreach echo ""; echo ""; echo "

$Query

Categories:
    "; // get the list of equipment types. $query="SELECT * FROM EquipmentType Order By TypeName"; $result=mysql_query($query); $num=mysql_numrows($result); $i=0; while ($i < $num) { $TypeName=mysql_result($result,$i,"TypeName"); $UniqueID=mysql_result($result,$i,"UniqueID"); // echo "
  • $TypeName
  • "; //if it equals books or software, go back to the store page to display it so it doesnt search it on ebay if (($TypeName == Books) OR ($TypeName == Software)) { echo "
  • $TypeName
  • "; } // don't display the category 'other' elseif ($TypeName <> Other) { echo "
  • $TypeName
  • "; } $i++; } echo "
"; echo "
"; echo "
"; echo '
'; echo "Search again?
Max Price $ Items Per Range
"; echo "
$results
"; } // *************************************************************** // END Display EBAY SEARCH RESULTS GET // *************************************************************** // for vbulletin echo "
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 09:36 PM.


(C) 2011 Riggs Publications - Terms of use & Privacy Policy

All times are GMT -5. The time now is 09:36 PM.

(C) 2011 Riggs Publications - Terms of use & Privacy Policy