-2

I'm getting this error in my logs, how can I solve this? Here is error and the file it relates to. This is line 15:

<?php if (!$isCustomerLogged): ?>

ERR (3): Notice: Undefined variable: isCustomerLogged in /domains/dev.domain.co.uk/http/app/design/frontend/base/default/template/detailedreview/wrapper.phtml on line 15

<?php if (!$isCustomerLogged): ?>
    <div class="login-dialog-block" style="display: none;">
        <div class="login-dialog-container">
            <?php echo $this->getChildHtml('customer_form_login');?>
            <?php echo $this->getChildHtml('customer_form_register');?>
        </div>
        <div class="clearer"></div>
    </div>
<?php endif;?>

3 Answers 3

5

Replace if (!$isCustomerLogged): with below code

if(!Mage::getSingleton('customer/session')->isLoggedIn()):
0
1

Try this one:

<?php $customerIsLoggedIn = Mage::getSingleton('customer/session')->isLoggedIn(); ?> //return if customer is logged in

<?php if (!$customerIsLoggedIn): ?> //here we hide the code bellow if customer is not logged in
    <div class="login-dialog-block" style="display: none;">
        <div class="login-dialog-container">
            <?php echo $this->getChildHtml('customer_form_login');?>
            <?php echo $this->getChildHtml('customer_form_register');?>
        </div>
        <div class="clearer"></div>
    </div>
<?php endif;?>
3
  • It is @Prince again :D Yes it worked perfectly, accepted the users above answer as he was faster. Can you tell me why it suddenly started giving me this error? It was working fine until now.
    – Greg
    Jul 10, 2017 at 9:59
  • No problem :) about your variable i don't know what you have in your code but maybe you have some conflict in this variable or some error
    – PЯINCƎ
    Jul 10, 2017 at 10:01
  • Hymmm... Okey I'll see how it all behaves now. Thank you!
    – Greg
    Jul 10, 2017 at 10:03
0

I have faced same problem in Magento like undefined variables in all pages. Go to Index.php search below code & replaced.


if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
   Mage::setIsDeveloperMode(true);
}

to

if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) { Mage::setIsDeveloperMode(false); }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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