2

I've create a module which uses the standard contact component to show content but it will not work anymore after upgrade from j3.4.1 to 3.4.3. Maybe there is someone from the coding team who could have a look at the attached zipped module and explain how to fix the issue..

The following errors are shown once I set error reporting to maximum:

Strict Standards: Non-static method modVorstandHelper::getList() should not be called statically in .. /modules/mod_vorstand/mod_vorstand.php on line 21
Notice: Array to string conversion in .. /administrator/components/com_contact/models/contacts.php on line 134

and for each entry in auto generated table:

Notice: Trying to get property of non-object in ... /modules/mod_vorstand/tmpl/default.php on line 29  
Notice: Trying to get property of non-object in ... /modules/mod_vorstand/tmpl/default.php on line 30

which is probably a result of the above mentioned site problems. In J3.4.1 all is working fine but with the same 2 site problems above.

J3.4.1 is running here: http://www.trudeo.de/st.antonius/vorstand

J3.4.3 is running here: http://www.trudeo.de/st.antonius1/vorstand

There is no possibility to add the module in this forum but can be downloaded here www.trudeo.de/mod_vorstand.zip

Thanks

3
  • You should share your code here. At least the relevant parts of mod_vorstand.php and the template (tmpl/default.php)
    – fruppel
    Aug 13, 2015 at 10:08
  • Strict errors and notices are not a massive issue and can be turned off. There are loads of answers on Google for this. I'm afraid unless you share your code on here, people are very unlikely to help
    – Lodder
    Aug 13, 2015 at 10:16
  • Hi fruppel and Lodder, the complete code can be downloaded here www.trudeo.de/mod_vorstand.zip . You can compare the vorstand module on both joomla versions (links in initial posting). The strict errors and notices on both versions but obviousely the J-Versions doesn't handle the module on the same way. 3.4.3 is a clone of 3.4.1 made with akeeba and just Joomla updated. Thanks
    – LupoNRW
    Aug 13, 2015 at 10:32

2 Answers 2

2

The problem is that you try to get items from the contacts model but the result is probably empty.

Notices

helper.php line 54

// Category filter
$model->setState('filter.category_id', $params->get('catid', array()));

try to change that line to this:

// Category filter
$model->setState('filter.category_id', $params->get('catid', ''));

The problem is the default value of your catid parameter. If you do not set the catid in the module options, it will default to an empty array. The contacts model will not find anything if you filter with an empty category ID array.


Strict error

Change

function getList($params)

in helper.php line 25 to

public static function getList($params)

to get rid of the strict error

16
  • @LupoNRW - Also note that there has been a Pull Request on Github for something like this. It might be worth applying the patch and testing too
    – Lodder
    Aug 13, 2015 at 11:08
  • Thanks fruppel so far for fast support. About the proposed changes in helper.php line 54: the module is configured via backend to use only category called vorstand. Removing the array doesn't help here. The Strict error is gone now after i've added the public static to the function.
    – LupoNRW
    Aug 13, 2015 at 11:08
  • Removed the category filter line 54 now completely and the notices (Array to string conversion) are gone but the difference is still there. 3.4.1 shows content, 3.4.3 not with error: Notice: Trying to get property of non-object in ...
    – LupoNRW
    Aug 13, 2015 at 11:36
  • Can you try to remove everything between line 31 and 64 in your helper.php? So that you just have $model = JModelLegacy... and $items = ...? Try that and see if you get any results. And if you get results then add the removed lines one by one to see which one causes the problem.
    – fruppel
    Aug 13, 2015 at 11:46
  • Now the module uses the complete contact list without selection of the category and shows the names but not the pictures and the function they have in our organisation. Result is shown on the J3.4.3 link.
    – LupoNRW
    Aug 13, 2015 at 11:54
0

Working on a similar problem, I found that previously successful $param->get() requests are working 3.4.0 code must be changed to $this->param->get() to work in 3.4.3+.

Also, a couple of properties - access-view and access-edit - appear to no longer be used. I found Krumo to be handy for tracking this down.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.