[SalesForce] Creating custom related list that displays Contacts from Child

I'm trying to make a new section in Related List under Accounts, like how the default contact section displays in Accounts, except I need it to display Contacts from the branches. We currently have Company->Location->Contacts for structure. Where each Location has their own contacts and the Company groups those locations together for each customer's branches.

So far I've only been able to use classes and visualforce to create a small section with all the contacts for that company, but it would be better if it could look something like the Related List Contacts. I have tried using custom objects, but I can't seem to find a way to make it just "grab" data from other objects. Is this possible in salesforce?

Thanks,

Best Answer

If you add a lookup from Contact to Account called "Company" and use triggers (on Contact for inserts and updates and on Account for updates and deletes) to keep that set to the root Company Account, then you should be able to show all the Contacts via that association in a normal Account layout. (Assuming you aren't using a record type to differentiate between Company and Location the list would appear for both but would be empty for the latter.)