0

Getting this inclusion error. This seems to cause home to die now. Blank screen and this is the only error I am getting. Was not the case before. Perhaps me dumping all the cache caused this but doubt it. Here is the error:

    tail -n 20 prelaunch.domain.com/var/log/system.log
    2017-02-04T18:08:51+00:00 ERR (3): Warning: include(): Failed opening 'TCurrencySwitcher.php' for inclusion (include_path='/home/user/prelaunch.domain.com/app/code/local:
 /home/user/prelaunch.domain.com/app/code/community:/home/user/prelaunch.domain.com/app/code/core:/home/user/prelaunch.domain.com/lib:.:/usr/local/lib/php:/usr/local/php5/lib/pear')  in /home/user/prelaunch.domain.com/lib/Varien/Autoload.php on line 94

Seems that it looks for the file TCurrencySwitcher.php in multiple locations, but cannot find it. And that makes two of us. Cannot locate it nor do I see it included anywhere. grep -rnw 'prelaunch.domain.com/' -e "TCurrencySwitcher.php" only showed the same error multiple times in the /var/log/system.log.

When I do a grep -rnw 'prelaunch.domain.com/' -e "TCurrencySwitcher" --exclude-dir prelaunch.domain.com/var/log

I do find some legacy code (done by previous developer) here:

prelaunch.domain.com/app/design/frontend/rwd/default/template/directory/currency.phtml:32:if(!class_exists('TCurrencySwitcher')) {
prelaunch.domain.com/app/design/frontend/rwd/default/template/directory/currency.phtml:33:  class TCurrencySwitcher {
prelaunch.domain.com/app/design/frontend/rwd/default/template/directory/currency.phtml:58:              <?php echo TCurrencySwitcher::codeToIcon($_code); ?>

That file has

if(!class_exists('TCurrencySwitcher')) {
    class TCurrencySwitcher {


        function codeToIcon($_code) {
            if($_code == 'BND') {
                $_code = 'usd';
            }
            return "<i class='fa fa-".strtolower($_code)."'></i>";
        }
    }
}

if($this->getCurrencyCount()>1): ?>
<div class="currency-switcher">
    <label for="select-currency"><?php echo $this->__('Your Currency:') ?></label>
    <ul class="select-currency-list">
    <?php foreach($this->getCurrencies() as $_code => $_name) {
        $currencyClass = $_code;
        if($this->getCurrentCurrencyCode() == $_code) {
        $currencyClass .= " current";
        }
        ?>
        <li>
            <a href="<?php echo $this->getSwitchCurrencyUrl($_code); ?>" 
               class="<?php echo $currencyClass; ?>">
                <?php echo TCurrencySwitcher::codeToIcon($_code); ?>
            </a>
        </li>
        <?php
    }; ?>
    </ul>
    <?php /*
    <select id="select-currency" name="currency" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Your Currency')) ?>" onchange="setLocation(this.value)">
        <?php foreach ($this->getCurrencies() as $_code => $_name): ?>
        <option value="<?php echo $this->getSwitchCurrencyUrl($_code) ?>"<?php if($_code==$this->getCurrentCurrencyCode()): ?> selected="selected"<?php endif; ?>>
            <?php echo $_name ?> - <?php echo $_code ?>
        </option>
    <?php endforeach; ?>
    </select>
     * 
     */ ?>
</div>
<?php endif; ?>

But not the specific include. Any ideas how I can debug this?

1 Answer 1

1

Update your code with below in file app/design/frontend/rwd/default/template/directory/currency.phtml,

if($this->getCurrencyCount()>1): ?>
<div class="currency-switcher">
    <label for="select-currency"><?php echo $this->__('Your Currency:') ?></label>
    <ul class="select-currency-list">
    <?php foreach($this->getCurrencies() as $_code => $_name) {
        $currencyClass = $_code;
        if($this->getCurrentCurrencyCode() == $_code) {
            $currencyClass .= " current";
        }
        if($_code == 'BND') {
            $_code = 'usd';
        }
        ?>
        <li>
            <a href="<?php echo $this->getSwitchCurrencyUrl($_code); ?>" 
               class="<?php echo $currencyClass; ?>">
                <?php echo "<i class='fa fa-".strtolower($_code)."'></i>"; ?>
            </a>
        </li>
        <?php
    }; ?>
    </ul>
    <?php /*
    <select id="select-currency" name="currency" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Your Currency')) ?>" onchange="setLocation(this.value)">
        <?php foreach ($this->getCurrencies() as $_code => $_name): ?>
        <option value="<?php echo $this->getSwitchCurrencyUrl($_code) ?>"<?php if($_code==$this->getCurrentCurrencyCode()): ?> selected="selected"<?php endif; ?>>
            <?php echo $_name ?> - <?php echo $_code ?>
        </option>
    <?php endforeach; ?>
    </select>
     * 
     */ ?>
</div>
<?php endif; ?>
5
  • Yeah, just did, but still no joy. Really odd.
    – rhand
    Commented Feb 5, 2017 at 8:20
  • Whats the error now? Commented Feb 5, 2017 at 8:28
  • 2017-02-05T08:27:49+00:00 DEBUG (7): HEADERS ALREADY SENT: <pre>[0] /home/user/prelaunch.domain.com/app/code/core/Mage/Core/Controller/Response/Http.php:52 [1]/home/user/prelaunch.domain.com/lib/Zend/Controller/Response/Abstract.php:768[2]/home/user/prelaunch.domain.com/app/code/core/Mage/Core/Controller/Response/Http.php:84[3]/home/user/prelaunch.domain.com/app/code/core/Mage/Core/Controller/Varien/Front.php:184[4]/home/user/prelaunch.domain.com/app/code/core/Mage/Core/Model/App.php:365 [5] /home/user/prelaunch.domain.com/app/Mage.php:684 [6] /home/user/prelaunch.domain.com/index.php:83
    – rhand
    Commented Feb 5, 2017 at 8:39
  • 1
    for headers already sent, refer to the answer by Alan stackoverflow.com/a/4673609/1409718 with a single update for replace Mage::log('File: ' . $file);Mage::log('Line: ' . $line); with Mage::log('File: ' . $file, null, 'system.log', true); Mage::log('Line: ' . $line, null, 'system.log', true); Commented Feb 5, 2017 at 8:49
  • Had to fix that and another phtml loading on home block wise. That fixed it all in the end.
    – rhand
    Commented Feb 5, 2017 at 10:09

Your Answer

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

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