?
Referenced as Pull Request for: # 9315 # 9580
avatar corejoomla
corejoomla
21 Feb 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

avatar corejoomla corejoomla - open - 21 Feb 2016
avatar corejoomla
corejoomla - comment - 21 Feb 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.

avatar brianteeman brianteeman - change - 24 Feb 2016
Labels Added: ?
avatar corejoomla corejoomla - reference | 5a2967e - 6 Mar 16
avatar brianteeman brianteeman - change - 7 Mar 2016
Status New Closed
Closed_Date 0000-00-00 00:00:00 2016-03-07 21:57:21
Closed_By brianteeman
avatar brianteeman brianteeman - close - 7 Mar 2016
avatar brianteeman brianteeman - close - 7 Mar 2016
avatar brianteeman
brianteeman - comment - 7 Mar 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.

Add a Comment

Login with GitHub to post a comment