Joomla 3.3 My component Fatal error getValue()

This forum is for general questions about extensions for Joomla! 3.x.

Moderators: pe7er, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Locked
bkkart
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Tue Feb 15, 2011 6:16 am

Joomla 3.3 My component Fatal error getValue()

Post by bkkart » Tue May 13, 2014 4:12 pm

Fatal error: Call to undefined method Joomla\Registry\Registry::getValue() in /home3/palace/public_html/-------.com/administrator/components/com_smartfootballgame/models/item.php on line 93

$config = JFactory::getConfig();
$tzoffset = SMARTFOOTBALLGAME_JVERSION == '30' ? $config->get('offset') : $config->getValue('config.offset');

I do not know how to solve this problem.

 
User avatar
muzaru
Joomla! Explorer
Joomla! Explorer
Posts: 279
Joined: Wed Mar 31, 2010 9:34 am
Location: Amersfoort

Re: Joomla 3.3 My component Fatal error getValue()

Post by muzaru » Tue May 13, 2014 4:27 pm

Well, i'm not familiar with this specific piece of code, but the function getValue() isn't available. You can try change it to

Code: Select all

$config = JFactory::getConfig();
$tzoffset = SMARTFOOTBALLGAME_JVERSION == '30' ? $config->get('offset') : $config->get('config.offset');
but i'm not sure if that would solve your issue

bkkart
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Tue Feb 15, 2011 6:16 am

Re: Joomla 3.3 My component Fatal error getValue()

Post by bkkart » Tue May 13, 2014 6:00 pm

On joomla 2.5 it working but develop on joomla 3.3 is notwork.
I'm really puzzled ?????

This is a function of a problem.

I forgot to import anything or not.

Code: Select all

function save($front = false)
	{

		$mainframe = JFactory::getApplication();
		$db = JFactory::getDBO();
		$user = JFactory::getUser();
		$row = JTable::getInstance('SmartFootballGameItem', 'Table');
		$params = JComponentHelper::getParams('com_smartfootballgame');
		$nullDate = $db->getNullDate();
		$postData = JRequest::get('post');

		if (!$row->bind($postData))
		{
			$mainframe->redirect('index.php?option=com_smartfootballgame&view=items', $row->getError(), 'error');
		}
				
		
		if ($front && $row->id == NULL)
		{
			JLoader::register('SmartFootballGameHelperPermissions', JPATH_SITE.DS.'components'.DS.'com_smartfootballgame'.DS.'helpers'.DS.'permissions.php');
			if (!SmartFootballGameHelperPermissions::canAddDeposited($row->id))
			{
				$mainframe->redirect('index.php?option=com_smartfootballgame&view=item&task=add&tmpl=component', JText::_('SMARTFOOTBALLGAME_YOU_ARE_NOT_ALLOWED_TO_POST_TO_THIS_CATEGORY_SAVE_FAILED'), 'error');
			}
		}

		($row->id) ? $isNew = false : $isNew = true;

		if ($row->id)
		{
			$datenow = JFactory::getDate();
			$row->modified = SMARTFOOTBALLGAME_JVERSION == '15' ? $datenow->toMySQL() : $datenow->toSql();
			$row->modified_by = $user->get('id');
		} else {
			$row->created_by = $created_by ? $created_by : $user->get('id');
	
			if ($front)
			{
				$SmartFootballGamePermissions = SmartFootballGamePermissions::getInstance();
				if (!$SmartFootballGamePermissions->permissions->get('editAll'))
				{
					$row->created_by = $user->get('id');
				}
			}
	
			if ($created && strlen(trim($created)) <= 10)
			{
				$row->created .= ' 00:00:00';
			}
	
			$config = JFactory::getConfig();
			$tzoffset = SMARTFOOTBALLGAME_JVERSION == '30' ? $config->get('offset') : $config->getValue('config.offset');
			$date = JFactory::getDate($row->created, $tzoffset);
			$row->created = SMARTFOOTBALLGAME_JVERSION == '15' ? $date->toMySQL() : $date->toSql();
		}

		if (!$row->check())
		{
			$mainframe->redirect('index.php?option=com_smartfootballgame&view=item&cid='.$row->id, $row->getError(), 'error');
		}

		$dispatcher = JDispatcher::getInstance();
		JPluginHelper::importPlugin('smartfootballgame');
		$result = $dispatcher->trigger('onBeforeSmartFootballGameSave', array(
			&$row,
			$isNew
		));
		if (in_array(false, $result, true))
		{
			JError::raiseError(500, $row->getError());
			return false;
		}

		//Trigger the finder before save event
		$dispatcher = JDispatcher::getInstance();
		JPluginHelper::importPlugin('finder');
		$results = $dispatcher->trigger('onFinderBeforeSave', array(
			'com_smartfootballgame.item',
			$row,
			$isNew
		));
		
		if (!$row->id){
			
			$queryInsertMatch = "INSERT INTO #__footballgame_match ".
			"(league_id, team1_id, team2_id, date_time, comment, created, created_by) ".
			"VALUES (".$db->Quote($postData['league_id']).", 
			".$db->Quote($postData['team1_id']).", 
			".$db->Quote($postData['team2_id']).", 
			".$db->Quote($postData['date_time']).",
			".$db->Quote($postData['comment']).",
			".$db->Quote($row->created).",
			".$db->Quote($row->created_by).")";
			$db->setQuery($queryInsertMatch);
			if (!$db->query()){
				$mainframe->redirect('index.php?option=com_smartfootballgame&view=items', $db->getErrorMsg(), 'error');
			}
			
			$queryCheckMatch = "SELECT id FROM #__footballgame_match ".
			"WHERE created = '".$row->created."'".
			"ORDER BY id DESC LIMIT 1";
			$db->setQuery($queryCheckMatch);
        	$checkMatch = $db->loadObject();
			$row->match_id = $checkMatch->id;
			
		} else {
			$query = "UPDATE #__footballgame_match SET 
			league_id = ".$db->Quote($postData['league_id']).", 
			team1_id = ".$db->Quote($postData['team1_id']).", 
			team2_id = ".$db->Quote($postData['team2_id']).", 
			date_time = ".$db->Quote($postData['date_time']).",
			comment = ".$db->Quote($postData['comment']).",
			modified = ".$db->Quote($row->modified).", 
			modified_by = ".$db->Quote($row->modified_by)."
			WHERE id = ".$row->match_id;
			
			$db->setQuery($query);
	
			if (!$db->query())
			{
				$mainframe->redirect('index.php?option=com_smartfootballgame&view=items', $db->getErrorMsg(), 'error');
			}

		}
		
		if (!$row->store()) {
			$mainframe->redirect('index.php?option=com_smartfootballgame&view=items', $row->getError(), 'error');
		}

		if ($front)	{
			if (!SmartFootballGameHelperPermissions::canPublishItem($row->id) && $row->status) {
				$row->published = 0;
				$mainframe->enqueueMessage(JText::_('SMARTFOOTBALLGAME_YOU_DONT_HAVE_THE_PERMISSION_TO_PUBLISH_ITEMS'), 'notice');
			}
		}

		$query = "UPDATE #__footballgame_forecast SET 
        match_id = ".$db->Quote($row->match_id).", 
		fc1 = ".$db->Quote($row->fc1).", 
		fc2 = ".$db->Quote($row->fc2).", 
		s1 = ".$db->Quote($row->s1).", 
		s2 = ".$db->Quote($row->s2)." 
        WHERE id = ".$row->id;
		
		$db->setQuery($query);

		if (!$db->query())
		{
			$mainframe->redirect('index.php?option=com_smartfootballgame&view=items', $db->getErrorMsg(), 'error');
		}

		$row->checkin();

		$cache = JFactory::getCache('com_smartfootballgame');
		$cache->clean();

		$dispatcher->trigger('onAfterSmartFootballGameSave', array(
			&$row,
			$isNew
		));
		JPluginHelper::importPlugin('content');
		if (SMARTFOOTBALLGAME_JVERSION != '15')
		{
			$dispatcher->trigger('onContentAfterSave', array(
				'com_smartfootballgame.item',
				&$row,
				$isNew
			));
		}
		else
		{
			$dispatcher->trigger('onAfterContentSave', array(
				&$row,
				$isNew
			));
		}

		//Trigger the finder after save event
		$dispatcher = JDispatcher::getInstance();
		JPluginHelper::importPlugin('finder');
		$results = $dispatcher->trigger('onFinderAfterSave', array(
			'com_smartfootballgame.item',
			$row,
			$isNew
		));

		switch (JRequest::getCmd('task'))
		{
			case 'apply' :
				$msg = JText::_('SMARTFOOTBALLGAME_CHANGES_TO_MATCH_SAVED');
				$link = 'index.php?option=com_smartfootballgame&view=item&cid='.$row->id;
				break;
			case 'saveAndNew' :
				$msg = JText::_('SMARTFOOTBALLGAME_MATCH_SAVED');
				$link = 'index.php?option=com_smartfootballgame&view=item';
				break;
			case 'save' :
			default :
				$msg = JText::_('SMARTFOOTBALLGAME_MATCH_SAVED');
				if ($front)
					$link = 'index.php?option=com_smartfootballgame&view=item&task=edit&cid='.$row->id.'&tmpl=component&id='.JRequest::getInt('id');
				else
					$link = 'index.php?option=com_smartfootballgame&view=items';
				break;
		}
		$mainframe->redirect($link, $msg);
	}

User avatar
muzaru
Joomla! Explorer
Joomla! Explorer
Posts: 279
Joined: Wed Mar 31, 2010 9:34 am
Location: Amersfoort

Re: Joomla 3.3 My component Fatal error getValue()

Post by muzaru » Mon May 26, 2014 5:11 pm

The issue that the function getValue is no longer used and raises the error. You have to rewrite your little piece of code the work properly with the new version of J!

noxidsoft
Joomla! Apprentice
Joomla! Apprentice
Posts: 24
Joined: Sun Aug 16, 2009 2:39 pm
Location: Toowoomba Qld Australia
Contact:

Re: Joomla 3.3 My component Fatal error getValue()

Post by noxidsoft » Tue Aug 26, 2014 3:39 am

JRegistry::getvalue() was removed in Joomla 3.x so make sure you use JRegistry::get() instead.
Kind Regards,
Noel Dixon
http://www.noxidsoft.com

 

Locked

Return to “Extensions for Joomla! 3.x”