
Company Directory module - display content of custom fields
Re: Company Directory module - display content of custom fields
You can join to this project too
.

-
- Forum Members
- Posts: 126
- Joined: Sun Feb 26, 2006 7:10 pm
Re: Company Directory module - display content of custom fields
Can anyone tel me how to display The Category in the Summary Template? I'm trying to use
{$entry->categorytext}
But I'm just getting blanks. Thanks for your help!
{$entry->categorytext}
But I'm just getting blanks. Thanks for your help!
Re: Company Directory module - display content of custom fields
The code doesn't seem to support it. I'm making some other changes that I hope to post soon. I'll see about adding this in while I'm at it.
Tim
Tim
-
- Forum Members
- Posts: 126
- Joined: Sun Feb 26, 2006 7:10 pm
Re: Company Directory module - display content of custom fields
Great, I appreciate your help!
Re: Company Directory module - display content of custom fields
Attached is an attempt at some additional functionality for this module. It needs testing before any serious release.
@climberusa I have not added in the ability to output the category name as you requested. The necessary SQL query was eluding me so I have to play with it some more.
If it works, I'll work on getting this into the project properly.
Tim
[gelöscht durch Administrator]
- Output categories as either select (drop-down) list or within a DIV
- Choose to output, supress, or exclusively display the categories with DIV categories output--e.g. by choosing to disply just the categories, you can end up with one page that shows just your categories and no companies; clicking on one shows all the companies within that category. This doesn't work with the select list style output of categories.
- If you use the two-page thing just described, you can also add a "breadcrumb" link back to your categories page
- I've updated and added various style selectors to give you more flexibility with adding CSS styles to the various elements. All the selectors begin with CompanyDirectory so that you can easily recognize and format the elements.
- I've added documentation on using the module and its options
@climberusa I have not added in the ability to output the category name as you requested. The necessary SQL query was eluding me so I have to play with it some more.
If it works, I'll work on getting this into the project properly.
Tim
[gelöscht durch Administrator]
-
- Forum Members
- Posts: 126
- Joined: Sun Feb 26, 2006 7:10 pm
Re: Company Directory module - display content of custom fields
@skypanther: any luck yet on this?
Re: Company Directory module - display content of custom fields
Sorry, I haven't had a chance to work on it. Here's what I'm starting from:
If a category isn't specified, the query selects all fields from the companies table. Otherwise, it does an inner join on the categories table and selects only the companies in the given category. Here's the table structure


Here's what the data in the company_categories table looks like:

So, I need to do a double join to pull in the category name. And if a category is specified in the input, I need to pull out just the companies in that category. Apparently, my SQL skills aren't what they should be because complex many-to-many joins like this always give me the fits.
Anyone have some suggestions?
Thanks,
Tim
Code: Select all
$query = "SELECT * FROM ".cms_db_prefix()."module_compdir_companies c";
if ($inputcat != '')
{
$query .= " INNER JOIN ".cms_db_prefix()."module_compdir_company_categories cc ON cc.company_id = c.id WHERE cc.category_id = ?";
$paramarray[] = $inputcat;
}
$query .= " ORDER BY company_name";


Here's what the data in the company_categories table looks like:

So, I need to do a double join to pull in the category name. And if a category is specified in the input, I need to pull out just the companies in that category. Apparently, my SQL skills aren't what they should be because complex many-to-many joins like this always give me the fits.
Anyone have some suggestions?
Thanks,
Tim
Re: Company Directory module - display content of custom fields
Hmm, I just came across the GetCategoriesForCompany($id) method in the CompanyDirectory class. Could I use it to create the list of categories a company belongs to? I think it would be less efficient than doing it right through the SQL. But, it might get the job done.
Tim
Tim
-
- Forum Members
- Posts: 126
- Joined: Sun Feb 26, 2006 7:10 pm
Re: Company Directory module - display content of custom fields
I wish I could help but m sql skills are infantile at best. I appreciate your effort though!
Jeff
Jeff