Example #1
0
 protected function _getSuggestions($term, array $options, CM_Frontend_Render $render)
 {
     $ip = CM_Http_Request_Abstract::getInstance()->getIp();
     $locations = new CM_Paging_Location_Suggestions($term, $options['levelMin'], $options['levelMax'], CM_Model_Location::findByIp($ip), $options['scopeLocation']);
     $locations->setPage(1, 15);
     $out = array();
     foreach ($locations as $location) {
         $out[] = $this->getSuggestion($location, $render);
     }
     return $out;
 }
Example #2
0
 public function testSearchDistance()
 {
     $location = new CM_Model_Location(CM_Model_Location::LEVEL_CITY, self::$_cityId);
     $source = new CM_Paging_Location_Suggestions('el', CM_Model_Location::LEVEL_CITY, CM_Model_Location::LEVEL_CITY, $location);
     $locationList = $source->getItems();
     $locationNext = new CM_Model_Location(CM_Model_Location::LEVEL_CITY, self::$_cityIdNext);
     $this->assertEquals($locationNext, reset($locationList));
 }