Results 1 to 8 of 8

Thread: Desperately need help

  1. #1
    Join Date
    Aug 2009
    Posts
    53

    Default Desperately need help

    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?

    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;
    }
    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.

    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:

    Last edited by millera; 07-28-2010 at 12:46 PM. Reason: Added pictures so you can see.

  2. #2
    the_sandking's Avatar
    the_sandking is offline hadron remnant - Moderation Fachmann
    Join Date
    Apr 2003
    Location
    Nullspace
    Posts
    5,289

    Default Re: Desperately need help

    You need to show us the

    XXXX_run_action_user_template()

    function. Your template tag isn't being parsed, so the problem is "further up" than your showofficename_display() function.
    "Much of what looks like rudeness in hacker circles is not intended to give offense. Rather, it's the product of the direct, cut-through-the-BS communications style that is natural to people who are more concerned about solving problems than making others feel warm and fuzzy."

    "We gotta' go to the crappy town where I'm a hero!"
    -Hoban 'Wash' Washburne 2485-2519


    "When you’re born you get a ticket to the freak show. When you’re born in America, you get a front-row seat.."
    -George Carlin 1937-2008

    New to Open-Realty® and need help? Check the:
    -OR DOCUMENTATION -

    Important: Read this at least once in your lifetime
    How To Ask Questions The Smart Way

  3. #3
    Join Date
    Aug 2009
    Posts
    53

    Default Re: Desperately need help

    Believe it or not I have nothing in that. The reason for this is because I was using another addon as a template for how to create my own. I looked over the documentation and it really doesn't state what this section is for. Should I be using a GET to request the listing ID or something?

    By the way, thanks so much for your quick reply.

  4. #4
    the_sandking's Avatar
    the_sandking is offline hadron remnant - Moderation Fachmann
    Join Date
    Apr 2003
    Location
    Nullspace
    Posts
    5,289

    Default Re: Desperately need help

    Quote Originally Posted by millera View Post
    Believe it or not I have nothing in that. The reason for this is because I was using another addon as a template for how to create my own. I looked over the documentation and it really doesn't state what this section is for. Should I be using a GET to request the listing ID or something?

    By the way, thanks so much for your quick reply.
    Sorry, I meant the XXX_run_template_user_fields() function.

    This is what initially parses your custom template tag.

    Something like this should exist at least:

    Code:
    function XXX_run_template_user_fields($tag = '') {
            switch ($tag) {
                case 'addon_showofficename_display':
                $data = showofficename_display();
                break;
                default:
                $data = '';
                break;
            } // End switch 
            return $data;
        }
    Replace XXX with the name of your add-on.
    "Much of what looks like rudeness in hacker circles is not intended to give offense. Rather, it's the product of the direct, cut-through-the-BS communications style that is natural to people who are more concerned about solving problems than making others feel warm and fuzzy."

    "We gotta' go to the crappy town where I'm a hero!"
    -Hoban 'Wash' Washburne 2485-2519


    "When you’re born you get a ticket to the freak show. When you’re born in America, you get a front-row seat.."
    -George Carlin 1937-2008

    New to Open-Realty® and need help? Check the:
    -OR DOCUMENTATION -

    Important: Read this at least once in your lifetime
    How To Ask Questions The Smart Way

  5. #5
    Join Date
    Aug 2009
    Posts
    53

    Default Re: Desperately need help

    Here's what mine says:

    Code:
    function showofficename_run_template_user_fields($tag = '') {
    	switch ($tag) {
    		case 'addon_showofficename_display':
    			$data = showofficename_display("display"); // TAG: {addon_showofficename_display}
    			break;
    		default:
    			$data = '';
    			break;
    		}
    	return $data;
    }

  6. #6
    the_sandking's Avatar
    the_sandking is offline hadron remnant - Moderation Fachmann
    Join Date
    Apr 2003
    Location
    Nullspace
    Posts
    5,289

    Default Re: Desperately need help

    Your function

    Code:
    function showofficename_display()
    Does not accept input, yet in your run_template_user_fields function, you are passing it "display"
    Code:
    $data = showofficename_display("display");
    Your server error logs are probably full of stuff telling you what is wrong, and you have error_reporting turned off if you are not seeing php errors in your browser.

    Turn your error reporting up all the way and start examining your server error logs.
    "Much of what looks like rudeness in hacker circles is not intended to give offense. Rather, it's the product of the direct, cut-through-the-BS communications style that is natural to people who are more concerned about solving problems than making others feel warm and fuzzy."

    "We gotta' go to the crappy town where I'm a hero!"
    -Hoban 'Wash' Washburne 2485-2519


    "When you’re born you get a ticket to the freak show. When you’re born in America, you get a front-row seat.."
    -George Carlin 1937-2008

    New to Open-Realty® and need help? Check the:
    -OR DOCUMENTATION -

    Important: Read this at least once in your lifetime
    How To Ask Questions The Smart Way

  7. #7
    Join Date
    Aug 2009
    Posts
    53

    Default Re: Desperately need help

    Hey King,

    Even removing "display" from being a variable of the function it doesn't fix both issues. :( I'm just so confused and why it's not parsing it correctly or how it even duplicates itself for each one?

  8. #8
    the_sandking's Avatar
    the_sandking is offline hadron remnant - Moderation Fachmann
    Join Date
    Apr 2003
    Location
    Nullspace
    Posts
    5,289

    Default Re: Desperately need help

    What do your server error logs show? You should always be looking at these when you are developing/debugging code.
    "Much of what looks like rudeness in hacker circles is not intended to give offense. Rather, it's the product of the direct, cut-through-the-BS communications style that is natural to people who are more concerned about solving problems than making others feel warm and fuzzy."

    "We gotta' go to the crappy town where I'm a hero!"
    -Hoban 'Wash' Washburne 2485-2519


    "When you’re born you get a ticket to the freak show. When you’re born in America, you get a front-row seat.."
    -George Carlin 1937-2008

    New to Open-Realty® and need help? Check the:
    -OR DOCUMENTATION -

    Important: Read this at least once in your lifetime
    How To Ask Questions The Smart Way

Similar Threads

  1. Desperately seeking help
    By southnow in forum Installation/Configuration Help (CLOSED)
    Replies: 9
    Last Post: 11-02-2006, 05:09 PM
  2. Help with errors: Desperately need help!!!
    By BREwebmaster in forum HELP (CLOSED)
    Replies: 1
    Last Post: 06-05-2003, 01:53 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •