Search Link in Field

8 posts by 2 authors in: Forums > CMS Builder
Last Post: July 9, 2010   (RSS)

By fleff - July 8, 2010

This question is about a real estate website where a user sees a property listing, likes it, and goes to the page of the agent who listed that property. On the agent's page I want a link labeled "View all my listings", but only if the agent want's it there (some don't have enough listings). In my "Agents" section I have put a wysiwyg field where I can enter "View all my listings" and link it to a search for all the active listings of that agent. I have set up the JavaScript to show this field only if there is something in it.

<?php if($agentsRecord['view_my_listings']): ?>
<span class="wysiwyg_content"><?php echo $agentsRecord['view_my_listings'] ?></span><br/>
<?php else: ?>
<?php endif ?>

That works fine but I can't figure out how to script the link in the wysiwyg field to show the agent's active listings. I've tried: "/houses.php/status_keyword=For+Sale&agent_name_keyword=Peter" (without quotes) where "houses.php" is the listings viewer. "For Sale" is in the Status field of a section editor called House Listings and "Peter" is in a field called Agent Name in a section editor called Agents. When I click on the link I get "No input file specified. " What should I be doing? Is there a better way to accomplish what I'm trying to do? Your help would be much appreciated.

Farnham

Re: [fleff] Search Link in Field

By Jason - July 8, 2010

Hi Farnham,

One things you can try is, instead of using the agent's name, you could use the agent's user number. In the example you gave, if you have two agents for example: Peter Smith, Peter Jones, This query would return the records for both of them.

If each listing has an agent number attached to it, you could try something like this:
"/houses.php/status_keyword=For+Sale&agent=4"

Where agent is the name of the agent field in the listings table.

Give this a try. If you're still having trouble, could you please provide a link to the listings page where you're having the problem and attach houses.php so I can take a closer look.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [fleff] Search Link in Field

By Jason - July 8, 2010

Hi Farnham,

Could you attach the agent_details.php and the houses.php files so that I can take a look at the code being used?

thanks
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Search Link in Field

By fleff - July 8, 2010

Sorry, Jason, I thought I had attached them. I forgot to click the Upload Attachment button after choosing them.

Farnham
Attachments:

agents_details.php 17K

houses.php 15K

Re: [fleff] Search Link in Field

By Jason - July 9, 2010

Hi Farnham,

I'm going to need to be able to see how your scripts are actually running. If you could email your CMS Builder login and FTP information to jason@interactivetools.com I can take a closer look.

Please only email this information, don't post it to the forum.

Thanks.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [fleff] Search Link in Field

By Jason - July 9, 2010

Hi Farnham,

I think I found the problem. The automatic search functionality of CMS Builder only words when URL variables use the same names as the field names in the database. In this case, the field in the listings table that holds the name(s) of the people listing the property is called "listed_by".

So if you wanted to get all of the properties with a status of "For Sale" that are listed by an agent with Peter in their name, you could use:
/houses.php/status_keyword=For+Sale&listed_by_keyword=Peter


Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Search Link in Field

By fleff - July 9, 2010

That's it, Jason! I should have thought of that. I'll know better next time (maybe). Thanks a million.

Farnham