Update search sql for the banners
authorSteve Sutton <steve@gaslightmedia.com>
Wed, 18 Mar 2015 20:10:51 +0000 (16:10 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Wed, 18 Mar 2015 20:10:51 +0000 (16:10 -0400)
Update sql for the county to be pulled in from
city table if the city is given in the search.

Toolkit/Banners/BannersIterator.php

index 80ab1f8..555c190 100644 (file)
@@ -361,6 +361,12 @@ class Toolkit_Banners_BannersIterator implements IteratorAggregate
                      WHERE county = {$countyId}";
                 } else {
                 }
+            } else if ($city = filter_var($_REQUEST['cityId'], FILTER_VALIDATE_INT)) {
+                $selectBannersAssignedToCounties = "
+                 UNION
+                SELECT banner
+                  FROM banners2counties
+                 WHERE county = (SELECT county_id FROM city WHERE city_id = {$city})";
             }
 
             $memberCatsOnPage = $this->_getMemberCatsAvailableOnPage(