Hi - I am required to display the realty office name next to the individual listings.

I contact our mls office after trying to use the LO_CODE - ListingOfficeID to get the realty office name, but that is simply a code that looks like this: K1165, and they said this:

In the listing details, there is a field called LO_CODE (this is the office ID) you would then get the name of the office from the table Office, field LO_NAME where LO_LO_CODE is the same as the LO_CODE in the listing.

How might I go about getting the name to display as required by the association of realtors, into a drealty listing?

Thanks very much!

Comments

webavant’s picture

You might have some luck using Entity Reference, or some similar solution: http://drupal.org/node/1426836

j9’s picture

Thanks webavant,

I have enabled entityreference, created a new entity reference field in my residential drealty listing, but I do not see anywhere that it allows me to dig down into a LO_CODE field to retreive the LO_NAME to display w/ the listing.

It asks me to map to the existing set of rets fields I had option to already, w/out offering any link to LO_NAME.

Am I close on this configuration? Thank you kindly again!

j9’s picture

Also, I am looking in the RES rets area for this LO_NAME.

Am I correct that I do not need to enable the OFF (Office) resource type to get at this LO_NAME? Thanks!

webavant’s picture

I think you're going to have to have a rule, or a presave function or something that populates the entity reference based on the value of that field. I've never done it, but I'll post back here eventually when I get around to it.

j9’s picture

I am trying to use Rules as you suggest.

I have created a rule with

Event:
Before saving a drealty listing

Condition:
Entity has field
Parameter: Entity: [drealty-listing], Field: field_listing_office
(This is my rets LO_CODE)

Action:
Text Variable
(Specifies the type of the variable that should be added.)

but I have no idea how to go further.

Again, I am trying to create a field I can use w/ the data from what my rets provider says:

In the listing details, there is a field called LO_CODE (this is the office ID) you would then get the name of the office from the table Office, field LO_NAME where LO_LO_CODE is the same as the LO_CODE in the listing.

Thanks for help with this!

webavant’s picture

I hadn't considered this until now, but until Drealty 3.x, there was always office, agent and open house imports, in addition to just listings. Currently, all we have is listings. You will have to push the devs to add offices back, or maybe write the code and submit the patch on your own. It's either that, or a more simple solution would be to query the RETS server on your own. I would suggest searching this issue queue for 'presave', and write your own simple module that does just that:

  • Query the RETS server for the office where "LO_LO_CODE" = the value of LO_CODE
  • Save that value to the listing before saving (presave)
webavant’s picture

Luckily for most of us, our MLS' listings tables already contain the office name, and not just a key value, as yours does. You might want to ask your MLS, or your board to consider that, since your board requires you to include the office's name, that they petition the MLS to include that value directly in the listings table.

j9’s picture

Thanks webavant!

I will look through the issues for presave and try to figure out how to query the rets server.

Much appreciated! :0)

kevinquillen’s picture

Yes, we too are required to display Firm Name.

In the interim, I made a small function in a custom module directly implementing phRETS to retrieve offices from the Office class and store the id/name in a helper table to populate listings with hook_entity_presave().

This would be so much better if the name was added to the listing when it was created in RETS- all our brokers agree lol. Anyhow, we're working on the other resources on the roadmap.

camidoo’s picture

Status: Active » Needs review

please see #1426836: Entity Reference Support for a possible solution, this is now implemented in the latest -dev release, you may have to pull from git.

kevinquillen’s picture

Status: Needs review » Closed (duplicate)

Closing in favor of #1426836: Entity Reference Support and a future release that supports Office and Agent resources.