$search_where = (!empty($search_where) ? implode(' AND ', $search_where) : '') . (!empty($search_having) ? " HAVING " . implode(' OR ', $search_having) : ''); // Count Search Query if (empty(Settings::getInstance()->MODULES['REW_IDX_MAPPING']) || empty($polygons)) { $search_count_query = "SELECT SQL_CACHE COUNT(`t1`.`" . $idx->field('ListingMLS') . "`) AS `total` FROM `" . $idx->getTable() . "` `t1`" . (!empty($search_where) ? ' WHERE ' . $search_where : ''); } else { if ($idx->getLink() == 'cms') { $search_count_query = "SELECT SQL_CACHE COUNT(`t1`.`" . $idx->field('ListingMLS') . "`) AS `total` FROM `" . $idx->getTable() . "` `t1`" . (!empty($search_where) ? ' WHERE ' . $search_where : ''); } else { $search_count_query = "SELECT SQL_CACHE COUNT(`total`) AS total" . " FROM (SELECT `t1`.`" . $idx->field('ListingMLS') . "` AS `total`, `t2`.`Point`" . " FROM `" . $idx->getTable() . "` `t1`" . " JOIN `" . REWIDX_TABLE_GEOPOINTS . "` `t2`" . " ON `t1`.`" . $idx->field('ListingMLS') . "` = `t2`.`ListingMLS`" . " AND `t1`.`" . $idx->field('ListingType') . "` = `t2`.`ListingType`" . (!empty($search_where) ? ' WHERE ' . $search_where : '') . ") as listings"; } } global $search_results_count; // Execute Count Query $search_results_count = $db_idx->fetchQuery($search_count_query); // REWMOD: Andrew S - March 19/15 - Implemented Eric B's Two Buttons in IDX Snippets if (!empty($_REQUEST['snippet']) && strpos(Http_Uri::getUri(), '/blog/') !== 0 && (!empty($_REQUEST['button_save_search']) || !empty($_REQUEST['button_refine_search']))) { // REWMOD: Andrew S - March 30/15 - Bug fix: Remove false entries from criteria -- stops searches without any specified entry from breaking. $criteria = $_REQUEST; foreach ($criteria as $key => $val) { if ($val == false) { unset($criteria[$key]); } } $page->container('idx_buttons')->addModule('idx-buttons', array('save_search' => $_REQUEST['button_save_search'], 'refine_search' => $_REQUEST['button_refine_search'], 'criteria' => $criteria, 'total_listings' => $search_results_count['total']))->display(); } // END REWMOD // MLS Compliance, Search Result Limit if (isset($_COMPLIANCE['limit']) && $search_results_count['total'] >= $_COMPLIANCE['limit']) { $results_limit = $_COMPLIANCE['limit']; } else { $results_limit = $search_results_count['total'];
/** * Load Extra Sources * @return void */ protected function extraSources() { // Include Scheme's Styles $this->addStylesheet('schemes/' . $this->getScheme() . '/scheme.less'); // Exclude Popup if (!isset($_GET['popup'])) { // Add Mobile bookmark $this->page->container('ajax')->module('mobile-bookmark'); } if (Http_Uri::getUri() === '/' && Settings::getInstance()->SETTINGS['agent'] === 1) { $this->addJavascript('js/jquery.nouislider.min.js'); } // Run parent parent::extraSources(); }