New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Category manager - banner item count #6934

Closed
wants to merge 7 commits into
from

Conversation

Projects
None yet
8 participants
@pe7er
Contributor

pe7er commented May 13, 2015

This patch creates in "Category Manager: Banners" 4 new columns with the number of banners per category. It contains a helper file for com_banners that is used in com_categories to calculate the number of banner items (published, unpublished, archived, and trashed) in each category.

Test instructions:

The Category Manager: Banners (Components > Banners > Categories) does not display the number of banners in each category.

screen shot 2015-05-13 at 14 24 31

Create some new banners that are unpublished, trashed & archived (tip: name the unpublished banner "Unpublished Banner" to test if the calculations are correct).

screen shot 2015-05-13 at 14 24 31

Note This patch works only in combination with #6916. Install both #6916 and this patch (the order of installation does not matter, you just need both).
After installing the patch, The Category Manager: Banners (Components > Banners > Categories) should displays 4 new columns.

screen shot 2015-05-13 at 14 24 31

Please also check the other administrator template Hathor

In Extensions > Template Manager > Select Hathor
Before the patch:

screen shot 2015-05-13 at 14 24 31
After the patch:
screen shot 2015-05-13 at 14 24 31

Show outdated Hide outdated administrator/components/com_banners/helpers/countitems.php
<?php
/**
* @package Joomla.Administrator
* @subpackage com_content

This comment has been minimized.

@peterlose

peterlose May 13, 2015

Contributor

Should be com_banners

@peterlose

peterlose May 13, 2015

Contributor

Should be com_banners

Show outdated Hide outdated administrator/components/com_banners/helpers/countitems.php
*/
class ContentitemsHelper extends JHelperContent
{
public static $extension = 'com_content';

This comment has been minimized.

@peterlose

peterlose May 13, 2015

Contributor

Should this be com_banners?

@peterlose

peterlose May 13, 2015

Contributor

Should this be com_banners?

@pe7er

This comment has been minimized.

Show comment
Hide comment
@pe7er

pe7er May 13, 2015

Contributor

Thanks @losedk !
I've corrected it and uploaded a new patch.

Contributor

pe7er commented May 13, 2015

Thanks @losedk !
I've corrected it and uploaded a new patch.

@hans2103

This comment has been minimized.

Show comment
Hide comment
@hans2103

hans2103 May 14, 2015

Contributor

@test succes

Tested both desktop and mobile.

Contributor

hans2103 commented May 14, 2015

@test succes

Tested both desktop and mobile.

@zero-24 zero-24 added the New Feature label May 15, 2015

@woluweb

This comment has been minimized.

Show comment
Hide comment
@woluweb

woluweb May 19, 2015

on issue #6934 (count for BANNERS), I noticed that clicking on "zeros" would still show all banners of the category, no matter their "status".
But apparently, this little bug only occurs for com_banners (works fine for the current com_content, for com_contact and com_newsfeed)


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6934.

woluweb commented May 19, 2015

on issue #6934 (count for BANNERS), I noticed that clicking on "zeros" would still show all banners of the category, no matter their "status".
But apparently, this little bug only occurs for com_banners (works fine for the current com_content, for com_contact and com_newsfeed)


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6934.
@pe7er

This comment has been minimized.

Show comment
Hide comment
@pe7er

pe7er May 19, 2015

Contributor

Thank you both for testing. I've analysed & reproduced the problem: The status filter of the com_banners component works differently from other components.

The category manager com_categories creates number counters with hyperlinks with status filter &filter[published]=. All components listen for the "Select Status" filter to &filter[published]= (and expect a statuscode of 0,1,2 and -2).

However the banner component listens to &filter[state]=.
What's the best way to "catch" the variable filter[published] and set the filter[state]?

Contributor

pe7er commented May 19, 2015

Thank you both for testing. I've analysed & reproduced the problem: The status filter of the com_banners component works differently from other components.

The category manager com_categories creates number counters with hyperlinks with status filter &filter[published]=. All components listen for the "Select Status" filter to &filter[published]= (and expect a statuscode of 0,1,2 and -2).

However the banner component listens to &filter[state]=.
What's the best way to "catch" the variable filter[published] and set the filter[state]?

@woluweb

This comment has been minimized.

Show comment
Hide comment
@woluweb

woluweb May 19, 2015

Hi Peter,
Your question is a bit too technical for me.
Good sense would say : if the Banner Component is the only one to use [state] instead of [published], maybe we should fix the Banner Component instead of changing "state" by "published" on the fly ?
But maybe this is a stupid suggestion, I am not a developer :-)

woluweb commented May 19, 2015

Hi Peter,
Your question is a bit too technical for me.
Good sense would say : if the Banner Component is the only one to use [state] instead of [published], maybe we should fix the Banner Component instead of changing "state" by "published" on the fly ?
But maybe this is a stupid suggestion, I am not a developer :-)

@pe7er

This comment has been minimized.

Show comment
Hide comment
@pe7er

pe7er May 20, 2015

Contributor

I've changed the 'state' field to 'published' in the filter administrator/components/com_banners/models/forms/filter_banners.xml and in the banners model.

Now this PR (in combination with PR #6916) displays a working "banner item counts" in the Category Manager: Banners that are hyperlinked correctly to * Banner Manager: Banners* with filtered items on published & category filter.

Contributor

pe7er commented May 20, 2015

I've changed the 'state' field to 'published' in the filter administrator/components/com_banners/models/forms/filter_banners.xml and in the banners model.

Now this PR (in combination with PR #6916) displays a working "banner item counts" in the Category Manager: Banners that are hyperlinked correctly to * Banner Manager: Banners* with filtered items on published & category filter.

@woluweb

This comment has been minimized.

Show comment
Hide comment
@woluweb

woluweb May 20, 2015

Hi Peter,
I have just tested.
I confirm : the filters do now work perfectly also for Banner Component
Txs


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6934.

woluweb commented May 20, 2015

Hi Peter,
I have just tested.
I confirm : the filters do now work perfectly also for Banner Component
Txs


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6934.

@zero-24 zero-24 added the RTC label May 20, 2015

@Kubik-Rubik Kubik-Rubik added this to the Joomla! 3.5.0 milestone May 21, 2015

Bakual added a commit that referenced this pull request Jun 3, 2015

@Bakual

This comment has been minimized.

Show comment
Hide comment
@Bakual

Bakual Jun 3, 2015

Contributor

Merged with 28574c5 into 3.5-dev.

Thanks!

Contributor

Bakual commented Jun 3, 2015

Merged with 28574c5 into 3.5-dev.

Thanks!

@Bakual Bakual closed this Jun 3, 2015

roland-d added a commit that referenced this pull request Aug 6, 2015

@zero-24 zero-24 removed the RTC label Oct 14, 2015

@pe7er pe7er deleted the pe7er:category-manager-banner-count branch Nov 5, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment