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

Unable to add countItems method for an extension where the category system is used in two instances #9186

Closed
corejoomla opened this Issue Feb 21, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@corejoomla

corejoomla commented Feb 21, 2016

Steps to reproduce the issue

  1. Setup a component with two instances of the category. For example:

    a. component com_mycomponent has two types of items type1 and type2
    b. type1 uses Joomla category system with extension name as com_mycomponent
    c. type2 uses Joomla category system with extension name as com_mycomponent.type2

Now, I can add first type countItems method in administrator/components/com_mycomponent/helpers/mycomponent.php with class name as MycomponentHelper

However in second case, I cannot create another class for second type because of the below code in components/com_categories/models/categories.php line 307
$classname = ucfirst(substr($extension, 4)) . 'Helper';

this results the name as Mycomponent.type2Helper. So I cannot create the class name because of the dot in between the name.

Expected result

It should show category counts by checking the countItems function class name Mycomponenttype2Helper (without dot)

Actual result

Does not work

System information (as much as possible)

Joomla 3.5 beta 2

@corejoomla

This comment has been minimized.

Show comment
Hide comment
@corejoomla

corejoomla Feb 21, 2016

The fix is simple.

$classname = ucfirst(substr($extension, 4)) . 'Helper';

should be changed to
$classname = ucfirst(str_replace('.', '', substr($extension, 4))) . 'Helper';

If this is okay, I will send the pull request.

corejoomla commented Feb 21, 2016

The fix is simple.

$classname = ucfirst(substr($extension, 4)) . 'Helper';

should be changed to
$classname = ucfirst(str_replace('.', '', substr($extension, 4))) . 'Helper';

If this is okay, I will send the pull request.

@brianteeman

This comment has been minimized.

Show comment
Hide comment
@brianteeman

brianteeman Mar 7, 2016

Contributor

Closed as we have a PR for testing - see #9315


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

Contributor

brianteeman commented Mar 7, 2016

Closed as we have a PR for testing - see #9315


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

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