GWcode Categories Support

Page 3 of 6.  < 1 2 3 4 5 >  Last ›

Avatar for Karl Bowers

#1 By Karl Bowers @ June 25th, 2011 00:46 (82 months ago)

Hi Leon,

Just to let you know I've implemented GW Code Categories perfectly into my clients site. I still need to upgrade to v.1.8.0 though! Not got round to it yet! :-)

One question though: Will upgrading to v.1.8.0 break the way the syntax is running at the moment? (ie. {if "{cat_image}"} ).

Many thanks in advance :-)

Avatar for Leon Dijk

Author

#2 By Leon Dijk @ June 25th, 2011 11:19 (82 months ago)

Hey Karl,

Good stuff! I was waiting for your question :)

No, code such as this:

{if "{cat_image}"}{cat_image}{/if}

will still work, although you will also be able to use this with v1.8.0, making it a bit simpler:

{if cat_image}{cat_image}{/if}

I did rename a couple of variables to make them easier to understand and/or make their naming more consistent in v1.8.0, which you may want to look at if you're using any of them in your template code.

For example, if you were using:

{if "{new_group}" == "yes"}..{/if}

..the new code for v1.8.0 will be:

{if group_start}..{/if}

As you can see, the code for v1.8.0 will be a bit simpler. But, previous versions are also compatible with EE2.2 as far as I know..so there is no need to upgrade if you don't want to.

You can see what changed in the Release Notes:
http://gwcode.com/add-ons/gwcode-categories/release-notes

If you're stuck with anything, let me know!

Cheers,
Leon

Avatar for Karl Bowers

#3 By Karl Bowers @ June 30th, 2011 12:23 (82 months ago)

Hi Leon,

I've just upgrading to v1.8.0 on my clients site and all is working well :-)

I've also re-adjusted the Syntax in the site templates to the
latest (ie. {if cat_image}{cat_image}{/if} etc).

I should have this site live in the next few weeks (hopefully) - its been a long time coming!

Regards

Karl

Avatar for John McLeod

#4 By John McLeod @ July 07th, 2011 14:00 (82 months ago)

Hi,
I'm having trouble with the entry_count variable returning the wrong number of results.  In several of my categories, it is returning a number higher than the number of entries in that category.

Here is my code.  Any thoughts?


{exp:gwcode_categories channel="tips" group_id="6" entry_count="yes" show_empty="no" status="open" count_future_entries="no" count_expired_entries="no"}
 {cat_name} ({entry_count}) 
{/exp:gwcode_categories}
Avatar for Leon Dijk

Author

#5 By Leon Dijk @ July 07th, 2011 20:33 (82 months ago)

Hi John,

I can't seem to replicate this. I have created a channel "tips", assigned it a category group with 2 categories and used the exact same code you showed here.

Then, to both categories I added 4 entries:
1 open.
1 closed.
1 with a date in the future.
1 which has expired.

Both categories showed 1 entry as the total count, which is exactly what it should return with your code example.

The only reason I can think of that could be your problem is that you may have a version installed older than 1.3.0 (which is when the count_future_entries and count_expired_entries parameters were introduced).

Is that the case perhaps?

Avatar for John McLeod

#6 By John McLeod @ July 07th, 2011 20:39 (82 months ago)

I had ver. 1.2.0 when I started working on this, but I updated yesterday to the latest version when I was having this issue.

Avatar for Leon Dijk

Author

#7 By Leon Dijk @ July 07th, 2011 20:46 (82 months ago)

Hi John,

Could you verify the upgrade has been successful by going to Add-Ons > Plugins to see if it shows version 1.8.0?

If it does show version 1.8.0, would it be possible for you to send me a database dump file so that I can work with the same data to see if there's a problem? That would be really helpful.

Avatar for Kathrine

#8 By Kathrine @ July 08th, 2011 19:43 (82 months ago)

Hi Leon,
I'm using your plugin on several sites now, it'w working really well.

My question: Can I dynamically turn a {cat_name} into a link only when it has entries but leave it as a title when it's empty?

The need to do this is from this page http://ekspeditionen2011.dk/ekspeditionen/sejlplan

It's the schedule for an expedition about to start. You see a list of categories+descriptions that I'd like to link to the blog entries belonging to this category as soon as it's not empty anymore. Suppose it will be something about entry count… but how?

Thanks a lot!
-Kath

Avatar for Leon Dijk

#9 By Leon Dijk @ July 08th, 2011 23:29 (82 months ago)

Hi Kath,

Nice to hear you've been using the plugin!

You were right about using entry_count. Have you tried this?

{if entry_count == 0}{cat_name}{if:else}<a href="{cat_url_title}">{cat_name}</a>{/if}

I hope that helps!

Leon

Avatar for Kath

#10 By Kath @ July 09th, 2011 03:38 (82 months ago)

Thanks, Leon.
I just can't get this to work
A) the count in a specific blog (although specified)
B) the group_id (it displays all category groups used in the channel).

Running 1.8.0. Here's my code (have tried to put it inside {exp:channel:entries…, no luck)

{exp:gwcode_categories channel="blog" group_id="4" style="linear" entry_count="yes"}
<h2>{if entry_count == 0}{cat_name}{if:else}{cat_name}{/if}</h2>
{cat_description}
{/exp:gwcode_categories}

What am I doing wrong?
-Kath

Avatar for Kath

#11 By Kath @ July 09th, 2011 03:41 (82 months ago)

Sorry - forgot to make HTML postable…

{exp:gwcode_categories channel="blog" group_id="4" style="linear" entry_count="yes"}
<h2>{if entry_count == 0}{cat_name}{if:else}<a href="{path='blog/view/{cat_url_title}'}">{cat_name}</a>{/if}</h2>
<p>{cat_description}</p>
{/exp:gwcode_categories}

-Kath

Avatar for Leon Dijk

Author

#12 By Leon Dijk @ July 10th, 2011 11:57 (82 months ago)

Hi Kath,

Sorry for the late reply, I haven't been able to get behind the pc yesterday.

First, let me explain B):

If you provide both the channel parameter and group_id parameter, it will create a list of categories that it can find for BOTH the channel(s) and group_id(s).

So, let's say that you assigned two category groups (ID 1 and 2) to the channel "blog" and also use group_id="3", it will create a list of categories belonging to category groups 1, 2 and 3.

So, the channel parameter doesn't act as a "filter". If you just want to output categories for a certain category group, you don't have to add the channel parameter, so you'd only use group_id="4". I hope that makes sense.

Now, regarding A):

Could you try adding the {entry_count} variable in your template, in the h2 tag for example? That way, you can see what value the entry_count variable contains so it will be easier to see why {if..} conditionals don't work the way you expect them to.

Avatar for Leon Dijk

Author

#13 By Leon Dijk @ July 10th, 2011 22:18 (82 months ago)

John,

Version 1.8.1 now has what you're looking for. Just make sure you're only using the channel parameter and not the group_id parameter. That way, it will fetch all categories for that channel and only count entries for the channel you provide with the channel parameter.

I hope that works!

Avatar for Kath

#14 By Kath @ July 11th, 2011 19:38 (82 months ago)

Hello again,
I added {entry_count} to the h2 tag and I can see it counts ALL entries in the categories (I deleted channel="blog" and stayed with group_id="4). Also upgraded to 1.8.1.

However, I do need a filter somehow, since I'm only interested in counting the Blog entries in one category group (that is shared by several channels) - and furthermore omit one specific category in that group…

It might be a lot to ask… But would it be possible eventually?

Thanks again for a great plugin!
-Kath

Avatar for Leon Dijk

Author

#15 By Leon Dijk @ July 11th, 2011 19:48 (82 months ago)

Hi again Kath,

Ah, that clears things up a bit.
So has your Blog channel been assigned to several category groups? Or just the category group with ID 4?

If it has only be assigned to category group 4, the fix will be very easy, just use this (as of version 1.8.1):


{exp:gwcode_categories channel="blog" style="linear" entry_count="yes"}
<h2>{if entry_count == 0}{cat_name}{if:else}<a href="{path='blog/view/{cat_url_title}'}">{cat_name}</a>{/if}</h2>
<p>{cat_description}</p>
{/exp:gwcode_categories}

And you can then also add the "excl_cat_id" parameter to omit that one specific category.

If your Blog channel has been assigned to several category groups, let me know. I will have to see if there's something I can do to make that work.

Avatar for Kath

#16 By Kath @ July 11th, 2011 22:23 (82 months ago)

You're a star :) Thanks for the excl_cat_id tip, I hadn't yet found that one myself…

Yes, the Blog channel has three category groups not only one, so this is the tricky part…

Looking forward to hearing from you!

Avatar for Leon Dijk

Author

#17 By Leon Dijk @ July 12th, 2011 19:46 (82 months ago)

Thanks kath :)

Just to let you know, I'm adding a new parameter called "excl_group_id", so your code would look like this:

{exp:gwcode_categories channel="blog" style="linear" entry_count="yes" excl_group_id="2|3"}
<h2>{if entry_count == 0}{cat_name}{if:else}<a href="{path='blog/view/{cat_url_title}'}">{cat_name}</a>{/if}</h2>
<p>{cat_description}</p>
{/exp:gwcode_categories}

That way, it will only count entries for your channel called "blog" and remove category groups with ID 2 and 3. Then, you can also add the excl_cat_id parameter to get what you want!

I've already tested the new parameter. Now need to add it to the EE1 version and then zip it up and add it to the site for download. Should be available for download later today!

Avatar for Leon Dijk

Author

#18 By Leon Dijk @ July 12th, 2011 20:17 (82 months ago)

Hi again Kath,

Version 1.8.2 has been uploaded. Download, upload, try the code and let me know if it works! By the way, if you only want to count entries based on a certain status, use the status parameter (status="open"). And, you can also add the count_future_entries and count_expired_entries parameters if you need to.

Have a good day!

Avatar for Jim

#19 By Jim @ July 12th, 2011 21:46 (82 months ago)

I'm trying to use GWcode Categories to show children, and everything seems to be working as expected except for "show_empty". Show_empty="no" only works if there are no entries at all in that category, but if there are closed entries (or entries with a different status), it will still display the category, even though there are no results.

Here is the opening tag I'm using:
{exp:gwcode_categories channel="products" cat_id="{embed:parent}" style="linear" incl_self="no" show_empty="no" status="open"}

Any ideas?

Thank you!

EE 2.1.4
GWcode Categories 1.8.2

Avatar for Leon Dijk

Author

#20 By Leon Dijk @ July 12th, 2011 22:14 (82 months ago)

Hi Jim,

I can't seem to replicate this. My categories are not showing when I have closed entries in them and use the code you posted.

The only thing that could cause entries to still be counted (and thus the categories to be shown) is when you'd have expired entries, or entries with an entry date in the future.

Could you try adding count_future_entries="no" count_expired_entries="no" to your opening tag to see if that changes anything?

Is there something I should know about the way you have set up your categories? For example, are the category group(s) assigned to your products channel also assigned to other channels?

Cheers,
Leon

Avatar for Jim

#21 By Jim @ July 12th, 2011 22:21 (82 months ago)

Thank you for the quick response!

Adding count_future_entries="no" count_expired_entries="no" did not have an impact. Yes, we do have the category group assigned to multiple channels.

Avatar for Leon Dijk

Author

#22 By Leon Dijk @ July 12th, 2011 22:33 (82 months ago)

No problem. Strange, while testing before I posted my previous comment here, I created 2 new channels, assigned both to the same category group and created 3 categories, 1 root category and 2 subcategories. Then, I added a couple of entries to the first subcategory with status "open" and a couple of entries to the second subcategory with status "closed". The entries were added to both channels. The second subcategory didn't show in the results, which is the desired output.

It's late here so I'm going to sign off in a bit, but I'll probably take the afternoon off tomorrow. I'll take it for another test drive then. In the meantime, if you think of something that might be useful for me to know, please let me know!

Avatar for Jim

#23 By Jim @ July 12th, 2011 22:42 (82 months ago)

Sounds good—I'll let you know if I think of anything. Thanks so much!

Avatar for Jim

#24 By Jim @ July 12th, 2011 23:06 (82 months ago)

I think I narrowed it down. It starts breaking when I add the cat_id parameter.

My test code:

{exp:gwcode_categories channel="products" show_empty="no" status="open" cat_id="112"}
  {cat_name}
{/exp:gwcode_categories}

<hr />

{exp:gwcode_categories channel="products" show_empty="no" status="open"}
  {cat_name}
{/exp:gwcode_categories}

<hr />

{exp:channel:categories channel="products" show_empty="no" status="open"}
  {category_name}
{/exp:channel:categories}

Avatar for Kath

#25 By Kath @ July 13th, 2011 01:10 (82 months ago)

Leon, it's working like a charm. Thank you so much for your dedication! You've made it possible for me to have exactly the functionality that I wanted (post #108).

... how would I be able to ‘buy you a beer'? Don't see any donation button…

All the best!
Kath

Avatar for Leon Dijk

Author

#26 By Leon Dijk @ July 13th, 2011 12:56 (82 months ago)

@ Kath: Woo, nice! I haven't had the chance to add a donation button to the site yet. I'm probably going to one day though! :)

@Jim: I've just used your test code and all 3 produce the same results for me. Would it be possible for you to send me a mysql dump so I can take a closer look?

Avatar for Leon Dijk

Author

#27 By Leon Dijk @ July 13th, 2011 14:09 (82 months ago)

Jim,

No need to send me the mysqldump. It looks like I have been able to replicate this. I'll keep you posted.

Avatar for Leon Dijk

Author

#28 By Leon Dijk @ July 13th, 2011 14:38 (82 months ago)

Jim,

Can you send me a quick email through the contact form on this site so that I can privately send you a new version which should fix the problem you're having, before I release it publicly? Thanks!

Avatar for Jim

#29 By Jim @ July 13th, 2011 15:23 (82 months ago)

That appears to fix it! I will keep an eye on it while I continue using it the next couple days and let you know if anything else happens.

Thanks again!

Avatar for Jason Siffring

#30 By Jason Siffring @ July 14th, 2011 18:04 (82 months ago)

Hi Leon,

It appears that setting the channel parameter causes your plugin to ignore the group_id parameter. Is this a bug or expected?

This correctly outputs all of the categories for this group_id.

{exp:gwcode_categories style="nested" group_id="5"}
  {cat_group_name}: {cat_group_id} : {cat_name}
{/exp:gwcode_categories}

However, when I add the channel parameter, it shows categories in every group, not just group 5.


{exp:gwcode_categories channel="mychannel" style="nested" group_id="5"}
  {cat_group_name}: {cat_group_id} : {cat_name}
{/exp:gwcode_categories}

I'm trying to get channel and category group to work together because ultimately, I only want to see categories from a specific group that has entries in a certain channel.

We're on the latest 1.8.3 version. Thanks for any help you can provide.

Avatar for Leon Dijk

Author

#31 By Leon Dijk @ July 14th, 2011 18:12 (82 months ago)

Hi Jason,

That is expected behaviour, because it combines the channel and group_id values you provide and then lists all the categories for them (which would be useful if you just want to show all categories for one or more channels and then also add one or more category groups that aren't assigned to those channels).

Could you try this and let me know if that solves your problem?


{exp:gwcode_categories channel="mychannel" style="nested" excl_group_id="6|7"}
  {cat_group_name}: {cat_group_id} : {cat_name} 
{/exp:gwcode_categories}

..where 6|7 would be the category groups you wouldn't want to show?

Avatar for Jason Siffring

#32 By Jason Siffring @ July 14th, 2011 18:17 (82 months ago)

@Leon,

Thanks that makes sense and works for me. Appreciate the quick turn around too!

Avatar for Leon Dijk

Author

#33 By Leon Dijk @ July 14th, 2011 18:18 (82 months ago)

No problem Jason, glad that solves it!

Avatar for Danny

#34 By Danny @ July 22nd, 2011 21:29 (81 months ago)

Is it possible to create this kind of structure with GWCode Categories? If so, how would I achieve it?


<category name="Parent Category 1">
    <subcategory name="Child Category 1">    
        <project name="Project 1" />
        <project name="Project 2" />
        <project name="Project 3" />
    </subcategory>
</category>

<category name="Parent Category 2">
    <subcategory name="Child Category 1">    
        <project name="Project 1" />
    </subcategory>
    <subcategory name="Child Category 2">    
        <project name="Project 1" />
        <project name="Project 2" />
    </subcategory>
    <subcategory name="Child Category 3">    
        <project name="Project 1" />
        <project name="Project 2" />
        <project name="Project 3" />
    </subcategory>
</category>  

Thanks for any help.

Avatar for Jason Siffring

#35 By Jason Siffring @ July 23rd, 2011 03:56 (81 months ago)

OK, sorry but I have another question.

I'm trying to show a list of categories in a specific group that do not have entries in a specific channel.

Here's what I've got:


{exp:gwcode_categories channel="mychannel" excl_group_id="1|2|3" show_empty="no" }

  <br>{cat_name} ({entry_count})

{/exp:gwcode_categories} 

This is showing categories from the correct group id (4). But, it is including categories that don't have entries in channel "mychannel", apparently because that category has entries in another channel.

Is there a way to say, "only show me categories from a specific group that have entries in a specific channel?"

Appreciate any tips.

Avatar for Jason Siffring

#36 By Jason Siffring @ July 23rd, 2011 04:54 (81 months ago)

Also, I tried another approach.

{exp:gwcode_categories channel="mychannel" show_empty="no" }
  {if cat_group_id == "4"}
 
{cat_name} ({entry_count})
  {/if}
{/exp:gwcode_categories}

But I get the same result as above… it shows me categories that don't have entries from the mychannel channel.

Avatar for Leon Dijk

Author

#37 By Leon Dijk @ July 23rd, 2011 11:36 (81 months ago)

Hi Jason,

That's strange, both code examples should do what you need.

There could be another reason why it's showing those categories.

You're using the show_empty="no" parameter because you only want to show categories with entries in them. But, by default, the show_empty parameter doesn't look at the status. So let's say you have 2 entries in a category and both of them are set to "closed", then the plugin will still return that category when you only provide the show_empty="no" parameter.

So, could you add the status="open" parameter and tell me if that changes anything?

Avatar for Jason Siffring

#38 By Jason Siffring @ July 23rd, 2011 13:17 (81 months ago)

Adding status fixed it. In attempt to simplify I stripped it down to the bare minimum, but should have left status in there.

Thanks for your prompt reply.

Avatar for Leon Dijk

Author

#39 By Leon Dijk @ July 23rd, 2011 18:32 (81 months ago)

Hi Jason,

Pfew, I thought this was going to be a difficult one! I'm glad that adding the status parameter fixed it. Good luck with the project!

Avatar for Peter

#40 By Peter @ July 26th, 2011 20:06 (81 months ago)

Thanks for the great plugin! Unfortunately, I'm a little dense so I'm having trouble wrapping my head around a seemingly simple concept: bread crumbs.

Your example shows bread crumbs for a specific entry but I'm looking to create bread crumbs for a title of a category list page where the top is a category group and the last is the currently viewed category. Basically like the category header tag but showing a category group name at the top.

I just can't figure out the code so I'd appreciate ANY help with this. Thanks.

Avatar for Leon Dijk

Author

#41 By Leon Dijk @ July 26th, 2011 23:11 (81 months ago)

Thanks Peter!

What you're looking for looks like example 9 (bottom of the page):
http://gwcode.com/add-ons/gwcode-categories/examples/example9

The only difference is that you want to add the category group name at the very beginning, which can be done like this:


{exp:gwcode_categories cat_id="8" show_trail="yes" style="linear" backspace="7"}
 {if group_start}{cat_group_name} &raquo;{/if}
 {cat_name} &raquo;
{/exp:gwcode_categories}

.. where "8" is the category ID for the currently viewed category. You could also swap the cat_id parameter with the cat_url_title parameter if that's easier.

PS .While I was coming up with the answer for your question, I discovered a bug with the backspace parameter. I'm going to add a new release when I've finished posting this, so please make sure you download the latest version (1.8.4).

Avatar for Leon Dijk

Author

#42 By Leon Dijk @ July 26th, 2011 23:17 (81 months ago)

@Danny (post 134): Hmm, somehow I didn't get the email that I'm supposed to get when a new comment has been submitted, probably because your comment was marked as spam in EE. Sorry about that!

Have you found the solution yet? If not, could you let me know what those project tags are? Are they sub-subcategories? Also, "Parent Category 1" etc, are those root categories?

Avatar for Jorix

#43 By Jorix @ August 05th, 2011 09:29 (81 months ago)

Leon, is it possible to list nested categories for one channel AND limit the listing to one category group?

Something like this:

{exp:gwcode_categories channel="catalogus_verkoop" entry_count="{show_entry_count}" style="nested" show_empty="no" group_id="3" parent_only="no"}

Doesn't seem to work, the group_id="..." is ignored.

Avatar for Jae

#44 By Jae @ August 09th, 2011 05:51 (81 months ago)

Hey Leon,

Again, I can't thank you enough for this awesome add-on. I do have a question, in using GWcode Category with the ImgSizer.

The following line is not returning any images:

{exp:gwcode_categories channel="tig" cat_id="" depth="2" style="linear"}
{exp:imgsizer:size src="{cat_image}" width="215" height="140"}{sized}{/exp:imgsizer:size}
{/exp:gwcode_categories}

Anything you see that's not correct? Thanks!

Avatar for Jorix

#45 By Jorix @ August 09th, 2011 07:58 (81 months ago)

(post #36)

A bit late but I did read your post (this morning) and just wanted to say thank you for implementing the feature request. I will definitely give it a try.

Avatar for Angie

#46 By Angie @ August 17th, 2011 19:16 (80 months ago)

Hi! This add-on is great! Similar to @Jae above, it seems like it won't parse any other tags other than conditionals.

In my situation I'm using the Multi Language Module (http://d.pr/cEHF). Here's a stripped down version of my code:

{exp:gwcode_categories cat_url_title="{segment_2}" max_depth="2" excl_cat_id="{segment_2_category_id}" style="linear"}
    {exp:multi_language:phrase index="{cat_url_title}
{/exp:gwcode_categories}

Nothing shows up. I also tried an embed which didn't work. Seems like a parsing order issue, but being a front-end developer I'm not entirely sure. Any ideas for a fix or workaround?

Avatar for Leon Dijk

Author

#47 By Leon Dijk @ August 17th, 2011 19:22 (80 months ago)

Hi Angie,

Jae's question was resolved through twitter, I should have posted the solution here as well.

Try adding parse="inward" in the {exp:gwcode_categories} tag like this:

{exp:gwcode_categories cat_url_title="{segment_2}" max_depth="2" excl_cat_id="{segment_2_category_id}" style="linear" parse="inward"}
..
{/exp:gwcode_categories}

Hope that helps!

Avatar for Angie

#48 By Angie @ August 17th, 2011 19:46 (80 months ago)

Why I didn't think to try that is beyond me. :)  Big thanks for the lightning fast response! Worked perfectly.

Avatar for Leon Dijk

Author

#49 By Leon Dijk @ August 17th, 2011 19:52 (80 months ago)

No problem Angie, you're definitely not the first to forget about that one :)
Glad you find the plugin useful!

Avatar for Dragan Simonovic

#50 By Dragan Simonovic @ August 29th, 2011 12:15 (80 months ago)

Is it possible to sort categories by fixed order based on their cat_id? Ex. orderby="fixed" sort="32|45|88"..

Submit your comment

Sorry, comments are closed for this page.