ERRO NO VIRTUEM MART ( ! ) Fatal error: Call to a member fun

  • jppnf
  • Avatar de jppnf Autor do Tópico
  • Offline
  • JCB! Junior
  • JCB! Junior
Mais
11 anos 7 meses atrás #79673 por jppnf
jppnf created the topic: ERRO NO VIRTUEM MART ( ! ) Fatal error: Call to a member fun
Fala galera blz?
Estou utilizando a nossa atualizando minha loja virtuemart e por algum motivo que desconheço, ao clicar para ver os produtos aparece a seguinte mensagem de erro.
( ! ) Fatal error: Call to a member function get() on a non-object in C:\wamp\www\Site\components\com_content\router.php on line 27


devo adicionar get() na parte em vermelho?
Alguem poderia me dizer ao certo o que eu devo fazer?
e se nao for muito incomodo o porque do erro?
Vlw obrigado e abraços!
<?php
/**
* @package Joomla.Site
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die;

jimport('joomla.application.categories');

/**
* Build the route for the com_content component
*
* @param array An array of URL arguments
* @return array The URL arguments to use to assemble the subsequent URL.
* @since 1.5
*/
function ContentBuildRoute(&$query)
{
$segments = array();

// get a menu item based on Itemid or currently active
$app = JFactory::getApplication();
$menu = $app->getMenu();
$params = JComponentHelper::getParams('com_content');
$advanced = $params->get('sef_advanced_link', 0);

// we need a menu item. Either the one specified in the query, or the current active one if none specified
[color=#FF0000:15udv0mo]get()[/color:15udv0mo]
if (empty($query)) {
$menuItem = $menu->getActive();
$menuItemGiven = false;
}
else {
$menuItem = $menu->getItem($query);
$menuItemGiven = true;
}

if (isset($query)) {
$view = $query;
}
else {
// we need to have a view in the query or it is an invalid URL
return $segments;
}

// are we dealing with an article or category that is attached to a menu item?
if (($menuItem instanceof stdClass) && $menuItem->query == $query && isset($query) && $menuItem->query == intval($query)) {
unset($query);

if (isset($query)) {
unset($query);
}

if (isset($query)) {
unset($query);
}

unset($query);

return $segments;
}

if ($view == 'category' || $view == 'article')
{
if (!$menuItemGiven) {
$segments[] = $view;
}

unset($query);

if ($view == 'article') {
if (isset($query) && isset($query) && $query) {
$catid = $query;
// Make sure we have the id and the alias
if (strpos($query, ':') === false) {
$db = JFactory::getDbo();
$aquery = $db->setQuery($db->getQuery(true)
->select('alias')
->from('#__content')
->where('id='.(int)$query)
);
$alias = $db->loadResult();
$query = $query.':'.$alias;
}
} else {
// we should have these two set for this view. If we don't, it is an error
return $segments;
}
}
else {
if (isset($query)) {
$catid = $query;
} else {
// we should have id set for this view. If we don't, it is an error
return $segments;
}
}

if ($menuItemGiven && isset($menuItem->query)) {
$mCatid = $menuItem->query;
} else {
$mCatid = 0;
}

$categories = JCategories::getInstance('Content');
$category = $categories->get($catid);

if (!$category) {
// we couldn't find the category we were given. Bail.
return $segments;
}

$path = array_reverse($category->getPath());

$array = array();

foreach($path as $id) {
if ((int)$id == (int)$mCatid) {
break;
}

list($tmp, $id) = explode(':', $id, 2);

$array[] = $id;
}

$array = array_reverse($array);

if (!$advanced && count($array)) {
$array[0] = (int)$catid.':'.$array[0];
}

$segments = array_merge($segments, $array);

if ($view == 'article') {
if ($advanced) {
list($tmp, $id) = explode(':', $query, 2);
}
else {
$id = $query;
}
$segments[] = $id;
}
unset($query);
unset($query);
}

if ($view == 'archive') {
if (!$menuItemGiven) {
$segments[] = $view;
unset($query);
}

if (isset($query)) {
if ($menuItemGiven) {
$segments[] = $query;
unset($query);
}
}

if (isset($query) && isset($query)) {
if ($menuItemGiven) {
$segments[] = $query;
unset($query);
}
}
}

// if the layout is specified and it is the same as the layout in the menu item, we
// unset it so it doesn't go into the query string.
if (isset($query)) {
if ($menuItemGiven && isset($menuItem->query)) {
if ($query == $menuItem->query) {

unset($query);
}
}
else {
if ($query == 'default') {
unset($query);
}
}
}

return $segments;
}



/**
* Parse the segments of a URL.
*
* @param array The segments of the URL to parse.
*
* @return array The URL attributes to be used by the application.
* @since 1.5
*/
function ContentParseRoute($segments)
{
$vars = array();

//Get the active menu item.
$app = JFactory::getApplication();
$menu = $app->getMenu();
$item = $menu->getActive();
$params = JComponentHelper::getParams('com_content');
$advanced = $params->get('sef_advanced_link', 0);
$db = JFactory::getDBO();

// Count route segments
$count = count($segments);

// Standard routing for articles. If we don't pick up an Itemid then we get the view from the segments
// the first segment is the view and the last segment is the id of the article or category.
if (!isset($item)) {
$vars = $segments[0];
$vars = $segments[$count - 1];

return $vars;
}

// if there is only one segment, then it points to either an article or a category
// we test it first to see if it is a category. If the id and alias match a category
// then we assume it is a category. If they don't we assume it is an article
if ($count == 1) {
// we check to see if an alias is given. If not, we assume it is an article
if (strpos($segments[0], ':') === false) {
$vars = 'article';
$vars = (int)$segments[0];
return $vars;
}

list($id, $alias) = explode(':', $segments[0], 2);

// first we check if it is a category
$category = JCategories::getInstance('Content')->get($id);

if ($category && $category->alias == $alias) {
$vars = 'category';
$vars = $id;

return $vars;
} else {
$query = 'SELECT alias, catid FROM #__content WHERE id = '.(int)$id;
$db->setQuery($query);
$article = $db->loadObject();

if ($article) {
if ($article->alias == $alias) {
$vars = 'article';
$vars = (int)$article->catid;
$vars = (int)$id;

return $vars;
}
}
}
}

// if there was more than one segment, then we can determine where the URL points to
// because the first segment will have the target category id prepended to it. If the
// last segment has a number prepended, it is an article, otherwise, it is a category.
if (!$advanced) {
$cat_id = (int)$segments[0];

$article_id = (int)$segments[$count - 1];

if ($article_id > 0) {
$vars = 'article';
$vars = $cat_id;
$vars = $article_id;
} else {
$vars = 'category';
$vars = $cat_id;
}

return $vars;
}

// we get the category id from the menu item and search from there
$id = $item->query;
$category = JCategories::getInstance('Content')->get($id);

if (!$category) {
JError::raiseError(404, JText::_('COM_CONTENT_ERROR_PARENT_CATEGORY_NOT_FOUND'));
return $vars;
}

$categories = $category->getChildren();
$vars = $id;
$vars = $id;
$found = 0;

foreach($segments as $segment)
{
$segment = str_replace(':', '-', $segment);

foreach($categories as $category)
{
if ($category->alias == $segment) {
$vars = $category->id;
$vars = $category->id;
$vars = 'category';
$categories = $category->getChildren();
$found = 1;
break;
}
}

if ($found == 0) {
if ($advanced) {
$db = JFactory::getDBO();
$query = 'SELECT id FROM #__content WHERE catid = '.$vars.' AND alias = '.$db->Quote($segment);
$db->setQuery($query);
$cid = $db->loadResult();
} else {
$cid = $segment;
}

$vars = $cid;

if ($item->query == 'archive' && $count != 1){
$vars = $count >= 2 ? $segments[$count-2] : null;
$vars = $segments[$count-1];
$vars = 'archive';
}
else {
$vars = 'article';
}
}

$found = 0;
}

return $vars;
}

Please Entrar ou Registrar to join the conversation.


Mais
11 anos 7 meses atrás #79674 por Thyoity
Thyoity replied the topic: Re: ERRO NO VIRTUEM MART ( ! ) Fatal error: Call to a member fun
Bom, na verdade esse get aí ta meio perdido no código, uma que pela sintaxe do PHP, toda linha de código exceto as que usam "{ }" (chaves), tem que terminar com ";" (ponto e vírgula).

---

OPS: Li denovo o tópico, e esse get não estava no código? Você que colocou? Se sim, com certeza ta errado, você deveria mostrar o erro que acontece quando você não coloca o get().

Agora sobre o erro:

( ! ) Fatal error: Call to a member function get() on a non-object in C:\wamp\www\Site\components\com_content\router.php on line 27


Acontece que o get não é um objeto, do jeito que ta ali ele está procurando pela função get(), porém ele é inexistente, o código não está encontrando ele, por isso está mostrando esse erro.

[center:2alrub8j]Desenvolvedor de temas, plugins, módulos, componentes, etc...
<!-- e --><a href="Este endereço de email está sendo protegido de spambots. Você precisa do JavaScript ativado para vê-lo.">Este endereço de email está sendo protegido de spambots. Você precisa do JavaScript ativado para vê-lo.</a><!-- e --> - WebPositiva[/center:2alrub8j]

Please Entrar ou Registrar to join the conversation.

  • jppnf
  • Avatar de jppnf Autor do Tópico
  • Offline
  • JCB! Junior
  • JCB! Junior
Mais
11 anos 7 meses atrás #79694 por jppnf
jppnf replied the topic: Re: ERRO NO VIRTUEM MART ( ! ) Fatal error: Call to a member fun
Entao amigo, Realmente deixei o texto bem confuso.
Eu nao fiz nenhuma alteração. simplesmente de uma hora para outra comeceu aparecer o seguinte erro ao clicar para ver produtos no menu(EXIBIR UM TIPO DE CATEGORIA VIRTUEMART):
Fatal error: Call to a member function get() on a non-object in C:\wamp\www\Site\components\com_content\router.php on line 27
http://imageshack.us/photo/my-images/155/erronovm.png/

Irei postar o codigo que esta no caminho mencionado pelo erro e gostaria de saber o que devo faazer..

<?php
/**
* @package Joomla.Site
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die;

jimport('joomla.application.categories');

/**
* Build the route for the com_content component
*
* @param array An array of URL arguments
* @return array The URL arguments to use to assemble the subsequent URL.
* @since 1.5
*/
function ContentBuildRoute(&$query)
{
$segments = array();

// get a menu item based on Itemid or currently active
$app = JFactory::getApplication();
$menu = $app->getMenu();
$params = JComponentHelper::getParams('com_content');
$advanced = $params->get('sef_advanced_link', 0);

// we need a menu item. Either the one specified in the query, or the current active one if none specified
if (empty($query)) {
$menuItem = $menu->getActive();
$menuItemGiven = false;
}
else {
$menuItem = $menu->getItem($query);
$menuItemGiven = true;
}

if (isset($query)) {
$view = $query;
}
else {
// we need to have a view in the query or it is an invalid URL
return $segments;
}

// are we dealing with an article or category that is attached to a menu item?
if (($menuItem instanceof stdClass) && $menuItem->query == $query && isset($query) && $menuItem->query == intval($query)) {
unset($query);

if (isset($query)) {
unset($query);
}

if (isset($query)) {
unset($query);
}

unset($query);

return $segments;
}

if ($view == 'category' || $view == 'article')
{
if (!$menuItemGiven) {
$segments[] = $view;
}

unset($query);

if ($view == 'article') {
if (isset($query) && isset($query) && $query) {
$catid = $query;
// Make sure we have the id and the alias
if (strpos($query, ':') === false) {
$db = JFactory::getDbo();
$aquery = $db->setQuery($db->getQuery(true)
->select('alias')
->from('#__content')
->where('id='.(int)$query)
);
$alias = $db->loadResult();
$query = $query.':'.$alias;
}
} else {
// we should have these two set for this view. If we don't, it is an error
return $segments;
}
}
else {
if (isset($query)) {
$catid = $query;
} else {
// we should have id set for this view. If we don't, it is an error
return $segments;
}
}

if ($menuItemGiven && isset($menuItem->query)) {
$mCatid = $menuItem->query;
} else {
$mCatid = 0;
}

$categories = JCategories::getInstance('Content');
$category = $categories->get($catid);

if (!$category) {
// we couldn't find the category we were given. Bail.
return $segments;
}

$path = array_reverse($category->getPath());

$array = array();

foreach($path as $id) {
if ((int)$id == (int)$mCatid) {
break;
}

list($tmp, $id) = explode(':', $id, 2);

$array[] = $id;
}

$array = array_reverse($array);

if (!$advanced && count($array)) {
$array[0] = (int)$catid.':'.$array[0];
}

$segments = array_merge($segments, $array);

if ($view == 'article') {
if ($advanced) {
list($tmp, $id) = explode(':', $query, 2);
}
else {
$id = $query;
}
$segments[] = $id;
}
unset($query);
unset($query);
}

if ($view == 'archive') {
if (!$menuItemGiven) {
$segments[] = $view;
unset($query);
}

if (isset($query)) {
if ($menuItemGiven) {
$segments[] = $query;
unset($query);
}
}

if (isset($query) && isset($query)) {
if ($menuItemGiven) {
$segments[] = $query;
unset($query);
}
}
}

// if the layout is specified and it is the same as the layout in the menu item, we
// unset it so it doesn't go into the query string.
if (isset($query)) {
if ($menuItemGiven && isset($menuItem->query)) {
if ($query == $menuItem->query) {

unset($query);
}
}
else {
if ($query == 'default') {
unset($query);
}
}
}

return $segments;
}



/**
* Parse the segments of a URL.
*
* @param array The segments of the URL to parse.
*
* @return array The URL attributes to be used by the application.
* @since 1.5
*/
function ContentParseRoute($segments)
{
$vars = array();

//Get the active menu item.
$app = JFactory::getApplication();
$menu = $app->getMenu();
$item = $menu->getActive();
$params = JComponentHelper::getParams('com_content');
$advanced = $params->get('sef_advanced_link', 0);
$db = JFactory::getDBO();

// Count route segments
$count = count($segments);

// Standard routing for articles. If we don't pick up an Itemid then we get the view from the segments
// the first segment is the view and the last segment is the id of the article or category.
if (!isset($item)) {
$vars = $segments[0];
$vars = $segments[$count - 1];

return $vars;
}

// if there is only one segment, then it points to either an article or a category
// we test it first to see if it is a category. If the id and alias match a category
// then we assume it is a category. If they don't we assume it is an article
if ($count == 1) {
// we check to see if an alias is given. If not, we assume it is an article
if (strpos($segments[0], ':') === false) {
$vars = 'article';
$vars = (int)$segments[0];
return $vars;
}

list($id, $alias) = explode(':', $segments[0], 2);

// first we check if it is a category
$category = JCategories::getInstance('Content')->get($id);

if ($category && $category->alias == $alias) {
$vars = 'category';
$vars = $id;

return $vars;
} else {
$query = 'SELECT alias, catid FROM #__content WHERE id = '.(int)$id;
$db->setQuery($query);
$article = $db->loadObject();

if ($article) {
if ($article->alias == $alias) {
$vars = 'article';
$vars = (int)$article->catid;
$vars = (int)$id;

return $vars;
}
}
}
}

// if there was more than one segment, then we can determine where the URL points to
// because the first segment will have the target category id prepended to it. If the
// last segment has a number prepended, it is an article, otherwise, it is a category.
if (!$advanced) {
$cat_id = (int)$segments[0];

$article_id = (int)$segments[$count - 1];

if ($article_id > 0) {
$vars = 'article';
$vars = $cat_id;
$vars = $article_id;
} else {
$vars = 'category';
$vars = $cat_id;
}

return $vars;
}

// we get the category id from the menu item and search from there
$id = $item->query;
$category = JCategories::getInstance('Content')->get($id);

if (!$category) {
JError::raiseError(404, JText::_('COM_CONTENT_ERROR_PARENT_CATEGORY_NOT_FOUND'));
return $vars;
}

$categories = $category->getChildren();
$vars = $id;
$vars = $id;
$found = 0;

foreach($segments as $segment)
{
$segment = str_replace(':', '-', $segment);

foreach($categories as $category)
{
if ($category->alias == $segment) {
$vars = $category->id;
$vars = $category->id;
$vars = 'category';
$categories = $category->getChildren();
$found = 1;
break;
}
}

if ($found == 0) {
if ($advanced) {
$db = JFactory::getDBO();
$query = 'SELECT id FROM #__content WHERE catid = '.$vars.' AND alias = '.$db->Quote($segment);
$db->setQuery($query);
$cid = $db->loadResult();
} else {
$cid = $segment;
}

$vars = $cid;

if ($item->query == 'archive' && $count != 1){
$vars = $count >= 2 ? $segments[$count-2] : null;
$vars = $segments[$count-1];
$vars = 'archive';
}
else {
$vars = 'article';
}
}

$found = 0;
}

return $vars;
}



OBRIGADO desde já!

Please Entrar ou Registrar to join the conversation.

  • jppnf
  • Avatar de jppnf Autor do Tópico
  • Offline
  • JCB! Junior
  • JCB! Junior
Mais
11 anos 7 meses atrás #79737 por jppnf
jppnf replied the topic: Re: ERRO NO VIRTUEM MART ( ! ) Fatal error: Call to a member fun
Alguem pode me da uma força com este erro?
Pelo oque tenho percebido este erro nao é diretamente do VM e sim um erro de administraçao
Alguem sabe alguma coisa sobre

( ! ) Fatal error: Call to a member function get() on a non-object in C:\wamp\www\Site\components\com_content\router.php on line 27
?

Abraços!

Please Entrar ou Registrar to join the conversation.