Results 1 to 2 of 2

Thread: Looking for quote

  1. #1
    Join Date
    Aug 2009

    Default Looking for quote

    Hello everyone,

    I had an issue that I tried resolving via the forum but I can't wrap my head around making this addon. Please see this link to know what I'm asking for. I need to display the office's name on my search results and pages that use the ShowResults addon.

  2. #2
    Join Date
    Nov 2009
    South England

    Default Re: Looking for quote

    I think I've found where you may be going wrong, at least where it shows the same value all the time. showofficename_display() retrieves the Listing ID from the $_GET variable, but I'm not convinced that this is a reliable way to get the listing ID on the search pages. It would work if you use it on the listing detail pages, but search results I'm not so sure.

    I would check for the presence of $_GET['listing_id']...
    if( $_GET['listing_id'] == '' ){ //Not found }

    This way you can pull the id from the listing_id field if it's present (e.g. if the tag is on the listing_detail page).
    If not, we need to add a global value to our tag which will count how many times the tag has appeared. Something like this:

    // Define counter and increment
    global $counter;

    Then, we do this to get an array of listing IDs for this search page:
    $matched_listing_ids = search_page::search_results('perpage');

    Now your listing id should be:
    $listing_id = $matched_listing_ids[ $counter ];

    Give that a go.

    Search results run a little differently from a normal template. The {search_results_dataset} tag which defines each row in the results is run and parsed on each listing. So your addon's code will be triggered once for each listing.

    HOWEVER, on a standard page, OR is more efficient. It runs you addon's code just the once, and then uses a regular expression to match every occurance of that tag to the string that resulted.

    So making an addon that counted how many times it showed up would look like this on search results:
    But on any other page it would show:

    It's often a good idea, if you get errors you can't explain, to open up the core file for the feature or page you're trying to use and see how it works under the hood. You'll find there are a lot of cool classes and functions that you can include in your addons and cut out some of the work.
    - Chris Denyer
    Denyer Admin Ltd
    Tambem falo Portuguęs!

Similar Threads

  1. Request for Quote
    By BillKellaway in forum Work
    Replies: 0
    Last Post: 05-14-2007, 09:55 AM
  2. Quote & Can it be done?
    By xlr8web in forum Work
    Replies: 7
    Last Post: 04-01-2005, 05:03 AM
  3. need a quote
    By sunfilly in forum Work
    Replies: 1
    Last Post: 03-04-2005, 01:15 PM
  4. Quote/Help
    By rogerthat in forum Work
    Replies: 2
    Last Post: 05-01-2004, 11:12 PM
  5. I need a quote
    By vasya in forum Work
    Replies: 1
    Last Post: 04-19-2004, 04:51 PM


Posting Permissions

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