/** * Saves an item and redirects based on task * @return void */ function save() { $app = JFactory::getApplication(); if (!($row = parent::save())) { return $row; } $model = $this->getModel($this->get('suffix')); $error = false; $row->manufacturer_description = $app->input->getString('manufacturer_name'); $row->manufacturer_description = $app->input->getString('manufacturer_description'); $fieldname = 'manufacturer_image_new'; $userfile = $app->input->files->get($fieldname, '', 'files', 'array'); //$userfile = JRequest::getVar( $fieldname, '', 'files', 'array' ); if (!empty($userfile['size'])) { if ($upload = $this->addfile($fieldname)) { $row->manufacturer_image = $upload->getPhysicalName(); } else { $error = true; } } if ($row->save()) { $model->setId($row->id); $this->messagetype = 'message'; $this->message = JText::_('COM_CITRUSCART_SAVED'); if ($error) { $this->messagetype = 'notice'; $this->message .= " :: " . $this->getError(); } JFactory::getApplication()->triggerEvent('onAfterSave' . $this->get('suffix'), array($row)); } else { $this->messagetype = 'notice'; $this->message = JText::_('COM_CITRUSCART_SAVE_FAILED') . " - " . $row->getError(); } }