Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Olá, estou com um erro em meu código PHP, tenho uma loja virtual, no qual ao clicar em uma categoria aparece a seguinte URL(ex): www.minhaloja.com/categories/exemplo-de-categoria porém, se eu ir para a url e deixar preenchido até categories, sem chamar nenhuma categoria ela dá o seguinte erro:
Notice: Undefined variable: category in /home/hiperpap/public_html/loja/includes/classes/class.category.php on line 409
Notice: Undefined variable: category in /home/loja/public_html/loja/includes/classes/class.category.php on line 410
Notice: Undefined variable: category in /home/loja/public_html/loja/includes/classes/class.category.php on line 411
Notice: Undefined variable: category in /home/loja/public_html/loja/includes/classes/class.category.php on line 412
Notice: Undefined variable: category in /home/loja/public_html/loja/includes/classes/class.category.php on line 413
Notice: Undefined variable: category in /home/loja/public_html/loja/includes/classes/class.category.php on line 414
Notice: Undefined variable: category in /home/loja/public_html/loja/includes/classes/class.category.php on line 415
Notice: Undefined variable: category in /home/loja/public_html/loja/includes/classes/class.category.php on line 416
Notice: Undefined variable: category in /home/loja/public_html/loja/includes/classes/class.category.php on line 417
Notice: Undefined variable: category in /home/loja/public_html/loja/includes/classes/class.category.php on line 418
O código das classes de erro são estes:
linha:408 // $category contains the details of the actual category we're viewing
linha:409 $this->Data = $category;
linha:410 $this->SetId($category['categoryid']);
linha:411 $this->SetName($category['catname']);
linha:412 $this->SetDesc($category['catdesc']);
linha:413 $this->SetLayoutFile($category['catlayoutfile']);
linha:414 $this->SetCatPageTitle($category['catpagetitle']);
linha:415 $this->SetMetaKeywords($category['catmetakeywords']);
linha:416 $this->SetMetaDesc($category['catmetadesc']);
linha:417 $this->SetSearchKeywords($category['catsearchkeywords']);
linha:418 $this->SetEnableOptimizer($category['cat_enable_optimizer']);linha:421 if(!CustomerGroupHasAccessToCategory($this->_catid)) {
linha:422 $noPermissionsPage = GetClass('ISC_403');
linha:423 $noPermissionsPage->HandlePage();
linha:424 exit;linha:427 $GLOBALS['CatTrail'] = $this->GetTrail();
Se alguém conseguir me ajudar ficaria grato.
faz assim:
if(isset($category)) {
//seu código todo
}
else {
//redireciona
header('Location: erro-categoria.php');
}
>
Olá, estou com um erro em meu código PHP, tenho uma loja virtual, no qual ao clicar em uma categoria aparece a seguinte URL(ex): www.minhaloja.com/categories/exemplo-de-categoria porém, se eu ir para a url e deixar preenchido até categories, sem chamar nenhuma categoria ela dá o seguinte erro:
Notice: Undefined variable: category in /home/hiperpap/public_html/loja/includes/classes/class.category.php on line 409
Notice: Undefined variable: category in /home/loja/public_html/loja/includes/classes/class.category.php on line 410
Notice: Undefined variable: category in /home/loja/public_html/loja/includes/classes/class.category.php on line 411
Notice: Undefined variable: category in /home/loja/public_html/loja/includes/classes/class.category.php on line 412
Notice: Undefined variable: category in /home/loja/public_html/loja/includes/classes/class.category.php on line 413
Notice: Undefined variable: category in /home/loja/public_html/loja/includes/classes/class.category.php on line 414
Notice: Undefined variable: category in /home/loja/public_html/loja/includes/classes/class.category.php on line 415
Notice: Undefined variable: category in /home/loja/public_html/loja/includes/classes/class.category.php on line 416
Notice: Undefined variable: category in /home/loja/public_html/loja/includes/classes/class.category.php on line 417
Notice: Undefined variable: category in /home/loja/public_html/loja/includes/classes/class.category.php on line 418
O código das classes de erro são estes:
linha:408 // $category contains the details of the actual category we're viewing
linha:409 $this->Data = $category;
linha:410 $this->SetId($category['categoryid']);
linha:411 $this->SetName($category['catname']);
linha:412 $this->SetDesc($category['catdesc']);
linha:413 $this->SetLayoutFile($category['catlayoutfile']);
linha:414 $this->SetCatPageTitle($category['catpagetitle']);
linha:415 $this->SetMetaKeywords($category['catmetakeywords']);
linha:416 $this->SetMetaDesc($category['catmetadesc']);
linha:417 $this->SetSearchKeywords($category['catsearchkeywords']);
linha:418 $this->SetEnableOptimizer($category['cat_enable_optimizer']);linha:421 if(!CustomerGroupHasAccessToCategory($this->_catid)) {
linha:422 $noPermissionsPage = GetClass('ISC_403');
linha:423 $noPermissionsPage->HandlePage();
linha:424 exit;linha:427 $GLOBALS['CatTrail'] = $this->GetTrail();
Se alguém conseguir me ajudar ficaria grato.
Se você ler a documentação da loja virtual, provavelmente encontrará alguma informação sobre executar em ambientes com modo de erros estrito.
>
408. // $category contains the details of the actual category we're viewing
Suponho, então, que não "estamos visualizando" categoria alguma. Você deverá fazer algum redirecionamento ou emitir um erro dizendo para escolher uma categoria.
Digamos que ela seja obrigatória.