Hello all,
Let me give you a brief synopsis of what happened and why I had to create my own addon. Our local MLS does RETS, however, they put all the agents/office's contact data in a different database separate from all the MLS/property data. So, when having to display a listing page, I had to create my own addon to pull the office name.
So, about two months ago I made my own addon and it works perfectly. If you go to a listing page on www.thebeachsales.com you will see that it shows the Office's name somewhere in the middle of the page. Now, I do use the ShowResults addon where I can put a list of results on another page other than the main search page. I just found out we need to post the office' name there as well. Well, whenever I put in my addon I created in the template, on a regular search it pulls the first office's name and then uses this on all the rest of the listings on that page as well. Additionally, whenever you go to one of the pages where I used the ShowResults plugin, it only displays the tag of my addon "{addon_showofficename_display}" instead of an office name at all.
I wanted to show you my code and see if maybe I'm doing something wrong?
I am using OR v. 2.8 -- yes, I know I should upgrade, but I'm not ready to move to 3.0 just yet. I would have to be able to spend a lot of time in case of errors/bugs etc.Code:function showofficename_display() { global $config, $conn, $jscript; require_once($config['basepath'].'/include/misc.inc.php'); require_once($config['basepath'] . '/addons/showofficename/language/en/lang.inc.php'); $misc = new misc(); $display = ''; $listingID = $_GET['listingID']; $sql = "SELECT listingsdbelements_field_value FROM " . $config[table_prefix] . "listingsdbelements WHERE listingsdbelements_field_name='LO_CODE' AND listingsdb_id = $listingID"; $recordSet = $conn->Execute($sql); if ($recordSet === false) { $misc->log_error($sql); } $officeID = $misc->make_db_unsafe ($recordSet->fields['listingsdbelements_field_value']); $mysqli = new mysqli('localhost','*****','*****','*****'); $results = $mysqli->query("SELECT * FROM offices_bcar WHERE officeid='$officeID'"); if (!$results) $display = "Error fetching Listing Office name."; else { $row = $results->fetch_object(); $display = ucwords(strtolower($row->officename)); if (empty($display)) $display = "Couldn't find listing office name."; } $mysqli->close(); return $display; }
Your help would be highly appreciated.
UPDATE: Here is what it looks like on just a regular search (it takes the first company name then puts that company name on all listings):
Here is what the search results look like on pages other than the main search page where I use the ShowResults addon:
![]()



Reply With Quote

Bookmarks