I had a full working module that was parsing some values from a dropdownlist at backend and it was editing those values at frontend.

Yesterday a co-worker changed something and today it doesnt work. After a bit of debugging, I found out that the list returns the results, but when I try to parse them from the program through $params->get, I take an array[8] (I selected 8 things ) full of NULLS;

defined('JPATH_PLATFORM') or die;
class JFormFieldManulist extends JFormFieldList
    protected $type = 'Manulist';
    protected function getOptions()

     $db= JFactory::getDbo();
     $query = $db->getQuery(true);
     $items = $db->loadObjectList();
         $options = array();
         if ($items)
          foreach($items as $item)
            $options[] = JHtml::_('select.option', $item->virtuemart_manufacturer_id , $item->mf_name,$item->slug);
          $options = array_merge(parent::getOptions(), $options);
         var_dump($options); --> returns expected result         
         return $options;



defined('_JEXEC') or die('Restricted access');
$doc                                = JFactory::getDocument();
$moduleclass_sfx                    = $params->get('moduleclass_sfx');
$layout                             = $params->get('layout', 'default');
$moduleName                         = basename(dirname(__FILE__));
$fmanuf                             = $params->get('foreignmanuf');
var_dump($fmanuf); ---> return NULLS


<fieldset name="brand_params" addfieldpath="/modules/mod_manufacturers/fields" >            
<field name="foreignmanuf" type="Manulist"   label="Foreign Brands" multiple="true"  description="Foreign Brands" />

What could be the problem that, even if the function returns the desired results , the controller cant get em ?

  • I assume the code at the bottom belongs in a separate file yes?
    – Lodder
    Dec 17 '14 at 9:25
  • yeap its in the mod_modulename.php file
    – IseNgaRt
    Dec 17 '14 at 9:28
  • Does your co-worker remember what he/she changed? Do you have a backup of the site with this code which was working before?
    – Lodder
    Dec 17 '14 at 9:28
  • he was trying to study the code to mimic the methodology for a different module. He said he dont remember changing something. I had a backup but i accidentaly overwrited before 1 week .
    – IseNgaRt
    Dec 17 '14 at 9:34
  • I can't personally see anything wrong with your code, however it's still the morning so my eyes will most likely be playing tricks on me. What I would suggest doing is using var_dump() after every variable starting with your database query results. When you get to a point where it shows null, report that code snippet back here. I would also suggest you tell your co-worker never to start messing around with code on a production website for testing purposes and always to take a backup. Why he started fiddling with the live code I have no idea, stupid mistake
    – Lodder
    Dec 17 '14 at 9:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.