0

I have checked log file exc.log

[2020-01-06 11:20:35] main.CRITICAL: Notice: Undefined offset: 2 in /var/www/vhosts/exmp.com/httpdocs/app/design/frontend/Smartwave/porto/Magento_Catalog/templates/category/subcategory.phtml on line 5 {"exception":"[object] (Exception(code: Notice: Undefined offset: 2 in /var/www/vhosts/exmp.com/httpdocs/app/design/frontend/Smartwave/porto/Magento_Catalog//category/subcategory.phtml on line 5 at /var/www/vhosts/exmp.com/httpdocs/vendor/magento/framework/App/ ErrorHandler.php:61)"} []

subcategory.phtml File Code

<?php

$curr_url = $_SERVER['REQUEST_URI'];
$exp_url = explode('/', $curr_url);
//print_r($exp_url);
if($exp_url[2] == 'xyz.html' || $exp_url[2] == 'xyz'){
    $classType='xyz';
    }else if($exp_url[2] == 'abc.html' || $exp_url[2] == 'abc'){ 
        $classType='abc xyz;
        }else{
            $classType='tool-another';
            }
?>
2

Please replace your code with below code.

<?php

$curr_url = $_SERVER['REQUEST_URI'];
$exp_url = explode('/', $curr_url);
//print_r($exp_url);

$classType = 'tool-another';
if(!empty($exp_url) && isset($exp_url[2]) )
{
    if($exp_url[2] == 'xyz.html' || $exp_url[2] == 'xyz'){
        $classType = 'xyz';
    } elseif($exp_url[2] == 'abc.html' || $exp_url[2] == 'abc'){ 
       $classType = 'abc xyz';
    }
}

?>

Let me know if you are still getting this issue.

  • ok wait sir sometime – Dinesh Thakur Jan 6 at 11:55
  • Did it work for you? – DJ Dev Jan 6 at 12:23
  • Its working thankyou – Dinesh Thakur Jan 6 at 12:46
  • Please accept this answer if it work for you. – DJ Dev Jan 6 at 12:49
  • Please mark this answer as accepted. – DJ Dev Jan 6 at 12:58

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.