Done that, still nothing. Do you mind if I PM you a login so you can have a quick peak?
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
July 16, 2007 12:28pm
Subscribe [3]#16 / Sep 27, 2007 11:44am
Done that, still nothing. Do you mind if I PM you a login so you can have a quick peak?
#17 / Sep 27, 2007 11:46am
@Mikee Bee - Sure thing!
#18 / Sep 27, 2007 11:53am
Then the one thing that is missing is, that to make colums with even height, we do not only need the total number of categories, like on that page you linked, but also the total number of entries in each category ...
#19 / Sep 27, 2007 12:03pm
@Mikee Bee - Alright, I took a peak at your query and I was wrong to call `exp_weblog_categories` it should be `exp_categories`. That seemed to fix it. The only other thing you may need is to limit your categories by group: so add in c.cat_group=X like so:
{exp:query sql="SELECT c.* FROM exp_weblog_categories c, exp_category_posts cp, exp_weblog_data d WHERE d.field_id_XX='Yes' AND c.group_id=X AND d.entry_id=cp.entry_id AND c.cat_id=cp.cat_id GROUP BY c.cat_id ORDER BY c.cat_name ASC"}
-- category has entry with field_id_XX set to 'yes': {cat_name}
{/exp:query}#20 / Sep 27, 2007 12:04pm
@Mikee Bee - Whoops, it’s amateur night here. It should be `c.group_id` not `c.cat_group`. Sorry.
#21 / Sep 27, 2007 12:28pm
Well thats got the categories! It seems to be outputting a full <ul> for each category though? I’d ideally (unless you can think of a way to get the even number of categories per column thing working Silenz) like say 10 categories per column. Is the php able to do that?
#22 / Sep 27, 2007 12:46pm
Even number of categories is no problem.
Taking your code and turning it into:
<style>.catcol { float:left;}</style>
{exp:cat_offset:auto delimiter="<span />" columns="4" class="catcol"}
{exp:query sql="SELECT distinct(cp.cat_id) AS category_id, c.cat_name AS category_name
FROM exp_category_posts AS cp
LEFT JOIN exp_categories AS c ON c.cat_id = cp.cat_id
LEFT JOIN exp_weblog_titles AS wt ON wt.entry_id = cp.entry_id
LEFT JOIN exp_weblog_data AS wd ON wd.entry_id = cp.entry_id
WHERE wd.weblog_id = '3' AND wt.status = 'open' AND wd.field_id_4 = 'Yes'
ORDER BY category_name ASC"}
<li><a href="http://{path=">{category_name}</a></li>
{embed="includes/paint-weblog" paint="Yes" cat="{category_id}"}
<span >
{/exp:query}
{/exp:cat_offset:auto}————
Things that need to be changed in the query:
WHERE wd.weblog_id = '3' AND wt.status = 'open' AND wd.field_id_4 = 'Yes'wd.weblog_id = ‘3’ ID of your stockists_uk weblog
wt.status = ‘open’ if you need a particular status…
wd.field_id_4 = ‘Yes’ ID of the field that must be ‘Yes’
—————
Note the <span > before the {/exp:query}-tag that serves as a delimiter.
—————
That gives you even numbers of categories per column. But since the number of stockists per category may vary, it doesn’t mean they are equally high.
#23 / Sep 27, 2007 12:56pm
I’m getting an empty page when I use that Silenz : ( shall I whip you a login to have a sneaky peak?
#24 / Sep 27, 2007 6:07pm
You could do that. But I don’t know when I’m online tomorrow.
#25 / Sep 27, 2007 7:10pm
If figured stockists_uk is weblog_id = ‘4’ and stockists-paint is field_id_43.
I adjusted the query accordingly.
The query seems to pull the correct categories but the embedded weblog:entries-tag seems somewhat off… the Custom Fields in EE Tags extension is disabled. That’s why.
Other than that 155px per column isn’t wide enough and there seem to be some more CSS issues to resolve.
#26 / Sep 27, 2007 7:52pm
I have no idea why the custom fields extension was turned off! When I enable it the page (and any pages on the site for that matter) went totally blank! But I’ve just re-installed it and all is well.
I’m pretty certain that
{embed="includes/paint-weblog" paint="Yes" cat="{category_id}"}Doesn’t need to be on the template. That was from when I was trying to somehow get the custom field info into my categories loop using standard tags. I’ve taken that out now and its only displaying the categories which is great.
I don’t want to speak too soon but I think you’ve cracked it… I may wee my pants a little.
I can’t thank you and Mark enough for helping me with this issue. its been a problem for months now and you’ve really been great sorting this so perfectly. This section has only been possible thanks to a combination of both of your amazing plugins and your staggering knowledge.
Sorry to ass kiss but I’m overjoyed!
Mike