function getProperty($limitstart = 0, $limit = 9999, $debug = null) { switch ($this->get('type')) { case 'properties': $this->_db->setQuery(ipropertyHelperQuery::buildPropertiesQuery($this->_where, $limitstart, $limit, $debug)); break; case 'property': $this->_db->setQuery(ipropertyHelperQuery::buildPropertiesQuery($this->_where, 0, 1, $debug)); break; case 'advsearch': $this->_db->setQuery(ipropertyHelperQuery::buildAdvPropertiesQuery($this->_where, $limitstart, $limit, $debug)); break; default: $this->_db->setQuery(ipropertyHelperQuery::buildPropertiesQuery($this->_where, $limitstart, $limit, $debug)); break; } $properties = $this->_db->loadObjectList(); $settings = ipropertyAdmin::config(); $config =& JFactory::getConfig(); $tzoffset = $config->getValue('config.offset'); $hide_round = 3; $i = 0; $property = array(); if (count($properties)) { switch ($this->get('type')) { case 'advsearch': foreach ($properties as $p) { $property[$i]->street_address = ipropertyHTML::getStreetAddress($settings, $p->title, $p->street_num, $p->street, $p->street2, $p->apt, $p->hide_address); $property[$i]->id = $p->id; $property[$i]->mls_id = $p->mls_id; $property[$i]->short_description = $p->short_description ? $p->short_description : $p->description; $property[$i]->city = $p->city; $property[$i]->price = $p->price; $property[$i]->stype_freq = $p->stype_freq; $property[$i]->beds = $p->beds; $property[$i]->baths = !$settings->baths_fraction ? round($p->baths) : $p->baths; //round to integer if admin setting to show no fractions $property[$i]->sqft = $p->sqft; $property[$i]->lat_pos = $p->hide_address ? round($p->latitude, $hide_round) : $p->latitude; $property[$i]->long_pos = $p->hide_address ? round($p->longitude, $hide_round) : $p->longitude; $property[$i]->price2 = $p->price2; # Get the thumbnail $property[$i]->thumb = ipropertyHTML::getThumbnail($p->id, '', '', $settings->thumbwidth); # Format Price and SQft output $property[$i]->formattedprice = ipropertyHTML::getFormattedPrice($p->price, $p->stype_freq, false, $p->call_for_price); $property[$i]->formattedsqft = number_format($p->sqft); # Get banner display $new = ipropertyHTML::isNew($p->created, $settings->new_days); $updated = ipropertyHTML::isNew($p->modified, $settings->updated_days); $property[$i]->banner = ipropertyHTML::displayBanners($p->stype, $new, JURI::root(true), $settings, $updated); //get sef url for use in js $available_cats = ipropertyHTML::getAvailableCats($p->id); $cat_id = $available_cats[0]; $property[$i]->proplink = JRoute::_(ipropertyHelperRoute::getPropertyRoute($p->id, $cat_id)); $cat_id = ''; $i++; } break; case 'properties': case 'property': default: foreach ($properties as $p) { $property[$i]->street_address = ipropertyHTML::getStreetAddress($settings, $p->title, $p->street_num, $p->street, $p->street2, $p->apt, $p->hide_address); $property[$i]->street_num = $p->street_num; $property[$i]->street = $p->street; $property[$i]->locstate = $p->locstate; $property[$i]->hide_address = $p->hide_address; $property[$i]->id = $p->id; $property[$i]->mls_id = $p->mls_id; $property[$i]->short_description = $p->short_description; $property[$i]->description = $p->description; $property[$i]->terms = $p->terms; $property[$i]->stype = $p->stype; $property[$i]->stype_freq = $p->stype_freq; $property[$i]->listing_office = $p->listing_office; $property[$i]->city = $p->city; $property[$i]->locstate = $p->locstate; $property[$i]->province = $p->province; $property[$i]->zip = $p->postcode; $property[$i]->region = $p->region; $property[$i]->county = $p->county; $property[$i]->country = $p->country; $property[$i]->gbase_address = $p->gbase_address; $property[$i]->concat_address = $p->concat_address; $property[$i]->price = $p->price; $property[$i]->beds = $p->beds; $property[$i]->baths = !$settings->baths_fraction ? round($p->baths) : $p->baths; //round to integer if admin setting to show no fractions $property[$i]->sqft = $p->sqft; $property[$i]->lat_pos = $p->hide_address ? round($p->latitude, $hide_round) : $p->latitude; $property[$i]->long_pos = $p->hide_address ? round($p->longitude, $hide_round) : $p->longitude; $property[$i]->lotsize = $p->lotsize; $property[$i]->lot_acres = $p->lot_acres; $property[$i]->yearbuilt = $p->yearbuilt; $property[$i]->heat = $p->heat; $property[$i]->cool = $p->cool; $property[$i]->fuel = $p->fuel; $property[$i]->garage_type = $p->garage_type; $property[$i]->garage_size = $p->garage_size; $property[$i]->zoning = $p->zoning; $property[$i]->frontage = $p->frontage; $property[$i]->siding = $p->siding; $property[$i]->roof = $p->roof; $property[$i]->propview = $p->propview; $property[$i]->school_district = $p->school_district; $property[$i]->lot_type = $p->lot_type; $property[$i]->style = $p->style; $property[$i]->hoa = $p->hoa; $property[$i]->reo = $p->reo; $property[$i]->hits = $p->hits; $property[$i]->featured = $p->featured; $property[$i]->metadesc = $p->metadesc; $property[$i]->metakey = $p->metakey; $property[$i]->created = $p->created; $property[$i]->modified = $p->modified; $property[$i]->fcreated = $p->fcreated; $property[$i]->listing_info = $p->listing_info; $property[$i]->reception = $p->reception; $property[$i]->tax = $p->tax; $property[$i]->income = $p->income; $property[$i]->vtour = $p->vtour; $property[$i]->video = $p->video; $property[$i]->price2 = $p->price2; # Get the thumbnail $property[$i]->thumb = ipropertyHTML::getThumbnail($p->id, '', '', $settings->thumbwidth); # Format Price and SQft output //$property[$i]->formattedprice = ipropertyHTML::getFormattedPrice($p->price, $p->stype_freq, false, $p->call_for_price); $property[$i]->formattedprice = ipropertyHTML::getFormattedPrice($p->price, $p->stype_freq, false, $p->call_for_price, $p->price2); $property[$i]->formattedsqft = number_format($p->sqft); # Get last modified date if available //$property[$i]->last_updated = ($p->modified != '0000-00-00 00:00:00') ? JFactory::getDate($p->modified)->format(JText::_('COM_IPROPERTY_DATE_FORMAT_MODIFIED'), $tzoffset) : ''; $property[$i]->last_updated = $p->modified != '0000-00-00 00:00:00' ? JHTML::_('date', htmlspecialchars($p->modified), JText::_('DATE_FORMAT_LC2'), $tzoffset) : ''; //get sef url for use in js $available_cats = ipropertyHTML::getAvailableCats($p->id); $cat_id = $available_cats[0]; $property[$i]->proplink = JRoute::_(ipropertyHelperRoute::getPropertyRoute($p->id, $cat_id)); $cat_id = ''; $i++; } break; } } return $property; }
/** * get the list of jshopping items * * @param JParameter $params; * @return Array */ public function __getList($params) { $mainframe =& JFactory::getApplication(); $noimage = "noimage.gif"; $order_complate_id = 7; $titleMaxChars = $params->get('title_max_chars', '100'); $openTarget = $params->get('open_target', 'parent'); $descriptionMaxChars = $params->get('description_max_chars', 100); $ordering = $params->get('ip_sort_product', 'hits__desc'); $limit = $params->get('limit_items', 5); $orders = $this->getOrdering($ordering); $dir = $orders["dir"]; $ordering = $orders["ordering"]; $my =& JFactory::getUser(); $aid = $my->get('aid', 0); $thumbWidth = (int) $params->get('ip_preview_width', 200); $thumbHeight = (int) $params->get('ip_preview_height', 210); $imageHeight = (int) $params->get('main_height', 300); $imageWidth = (int) $params->get('main_width', 660); $show_preview = $params->get('ip_show_preview', 1); $isThumb = $params->get('auto_renderthumb', 1); $ip_show_office = $params->get('ip_show_office', 1); $image_quanlity = $params->get('image_quanlity', 100); $isStripedTags = $params->get('auto_strip_tags', 0); $ip_show_stype = $params->get('ip_show_saletype', 1); $show_country = $params->get('ip_show_country', 1); $extraURL = $params->get('open_target') != 'modalbox' ? '' : '&tmpl=component'; $db =& JFactory::getDBO(); $date =& JFactory::getDate(); $now = $date->toMySQL(); $query_join = ""; $query_filed = ""; $sort = ""; $where = array(); $source = trim($params->get('ip_source_from', 'ip_cat_ids')); $filter_type = $params->get('ip_filtering_type', '1'); if ($source == "ip_cat_ids") { $catids = $params->get('ip_cat_ids'); $catids = !is_array($catids) ? $catids : implode(",", $catids); if (!empty($catids)) { if ($filter_type) { $where[] = 'pm.cat_id IN (' . $catids . ')'; } else { $where[] = 'pm.cat_id NOT IN (' . $catids . ')'; } } } elseif ($source == "ip_agents") { $agents = $params->get("ip_agents"); $agents = !is_array($agents) ? $agents : implode(",", $agents); if (!empty($agents)) { if ($filter_type) { $where[] = 'am.agent_id IN (' . $agents . ')'; } else { $where[] = 'am.agent_id NOT IN (' . $agents . ')'; } } } elseif ($source == "ip_companies") { $companies = $params->get("ip_companies"); $companies = !is_array($companies) ? $companies : implode(",", $companies); if (!empty($companies)) { $agents = $this->_getAgentsOfCompanies($companies); if (!empty($agents)) { if ($filter_type) { $where[] = 'am.agent_id IN (' . $agents . ')'; } else { $where[] = 'am.agent_id NOT IN (' . $agents . ')'; } } /* if( $filter_type ){ $where[] = 'p.listing_office IN ('.$companies.')'; } else{ $where[] = 'p.listing_office NOT IN ('.$companies.')'; } */ } } /*Use this code for check ordering*/ switch ($ordering) { case 'random': $ordering = " RAND()"; $dir = ""; break; default: break; } /*End*/ /* echo nl2br(str_replace('#__', 'jos_', $query)); die(); */ $rows = IceGroupAccordionIp::getPropertiesList($where, 0, $limit, $ordering, $dir); if (empty($rows)) { return array(); } $check = array(); $products = array(); $lists = array(); $i = 0; if ($rows) { foreach ($rows as $row) { $available_cats = ipropertyHTML::getAvailableCats($row->id); $available_agents = ipropertyHTML::getAvailableAgents($row->id); if (!empty($available_agents)) { $agent_names = array(); foreach ($available_agents as $agent) { $agent_names[] = $agent->agent_name; } $lists[$i]->agent_name = implode(",", $agent_names); } $first_cat = $available_cats[0]; $lists[$i]->category = ipropertyHTML::getCatName($first_cat); $lists[$i]->title = $row->street_address; $lists[$i]->link = JRoute::_(ipropertyHelperRoute::getPropertyRoute($row->id, $first_cat)); $lists[$i]->link = str_replace("/component/", "/", $lists[$i]->link); $lists[$i]->mainImage = ipropertyHTML::getThumbnail($row->id, $lists[$i]->link, $row->street_address, $imageWidth, ' class="ip_popular_img"', '', false, false); $lists[$i]->street_address = htmlspecialchars($row->street_address); $lists[$i]->gbase_address = $row->gbase_address; $lists[$i]->street_num = $row->street_num; $lists[$i]->street = $row->street; $lists[$i]->postalcode = $row->zip; $lists[$i]->country = $row->country; if ($show_country) { $lists[$i]->country = ipropertyHTML::getCountryName($row->country); } $lists[$i]->city = htmlspecialchars($row->city); $lists[$i]->state = htmlspecialchars(ipropertyHTML::getStateName($row->locstate)); $lists[$i]->province = htmlspecialchars($row->province); $lists[$i]->created = $row->created; $lists[$i]->modified = $row->modified; $lists[$i]->stype = $row->stype; $lists[$i]->thumbnail = $lists[$i]->mainImage; $lists[$i]->sqft = $row->sqft; $lists[$i]->baths = $row->baths; $lists[$i]->beds = $row->beds; $lists[$i]->lot_type = $row->lot_type; $lists[$i]->stype_freq = $row->stype_freq; $lists[$i]->stype = $row->stype; $lists[$i]->category = ""; if ($ip_show_office) { $lists[$i]->listing_office = ipropertyHTML::getCompanyName($row->listing_office); } if ($ip_show_stype) { $stype = ipropertyHTML::get_stype($row->stype); $lists[$i]->stype_2 = $stype; } $prepared_text = $row->short_description ? IceGroupAccordionIp::prepareContent($row->short_description, $descriptionMaxChars) : IceGroupAccordionIp::prepareContent($row->description, $descriptionMaxChars); $lists[$i]->price = $row->price; $lists[$i]->price2 = isset($row->price2) ? $row->price2 : $row->price; $lists[$i]->introtext = $prepared_text; $lists[$i]->introtext .= ' <a href="' . $lists[$i]->link . '">' . JTEXT::_('MOD_IP_POPULAR_READ_MORE') . '</a>'; $lists[$i]->description = $prepared_text; $lists[$i]->formattedprice = $row->formattedprice; $lists[$i]->price2 = ipropertyHTML::getFormattedPrice($lists[$i]->price2, $row->stype_freq, '', '', "", true); $lists[$i]->price = ipropertyHTML::getFormattedPrice($lists[$i]->price, $row->stype_freq, '', '', "", true); if ($lists[$i]->mainImage && ($image = $this->renderThumb($lists[$i]->mainImage, $imageWidth, $imageHeight, $lists[$i]->title, $isThumb, $image_quanlity))) { $lists[$i]->mainImage = $image; } if ($show_preview) { if ($lists[$i]->thumbnail && ($image = $this->renderThumb($lists[$i]->thumbnail, $thumbWidth, $thumbHeight, $lists[$i]->title, $isThumb, $image_quanlity, true))) { $lists[$i]->thumbnail = $image; } } $i++; $prepared_text = ''; } } return $lists; }