1 Comment

How to fix the error “Notice: Undefined variable : block in app/code/core/Mage/Core/Model/Email/Template/Filter.php”

how to edit custom css or less in Magento 2?
access variables / array in media.phtml on description.phtml

After I have installed the following patches: SUPEE-6285-1.9.1v2, SUPEE-6482-1.9.1.1, SUPEE-6788-1.9.1.1, SUPEE-7405-1.9.1.1,
my system.log file is filled with full of the following errors:

Notice: Undefined variable: block in app/code/core/Mage/Core/Model/Email/Template/Filter.php on line 187
Notice: Undefined variable: block in app/code/core/Mage/Core/Model/Email/Template/Filter.php on line 197

How to fix the issue…

Here is the block code:

    /**
 * Retrieve Block html directive
 *
 * @param array $construction
 * @return string
 */
public function blockDirective($construction)
{
    $skipParams = array('type', 'id', 'output');
    $blockParameters = $this->_getIncludeParameters($construction[2]);
    $layout = Mage::app()->getLayout();

    if (isset($blockParameters['type'])) {
        if ($this->_permissionBlock->isTypeAllowed($blockParameters['type'])) {
            $type = $blockParameters['type'];
            $block = $layout->createBlock($type, null, $blockParameters);
        }
    } elseif (isset($blockParameters['id'])) {
        $block = $layout->createBlock('cms/block');
        if ($block) {
            $block->setBlockId($blockParameters['id']);
        }
    }

 **LINE 187**   if ($block) {
        $block->setBlockParams($blockParameters);
        foreach ($blockParameters as $k => $v) {
            if (in_array($k, $skipParams)) {
                continue;
            }
            $block->setDataUsingMethod($k, $v);
        }
    }

 **LINE 197**   if (!$block) {
        return '';
    }
    if (isset($blockParameters['output'])) {
        $method = $blockParameters['output'];
    }
    if (!isset($method) || !is_string($method) || !method_exists($block, $method)) {
        $method = 'toHtml';
    }
    return $block->$method();
}

any help would be appreciated…

Related Posts

  • How to fix the error “Notice: Undefined variable: storeId in /catalog/product/special.phtml” (1)
    My system.log file filled with full of the error "Notice: Undefined variable: storeId in /catalog/product/special.phtml on line 26" See the line 26 here: $_product = Mage::getModel('catalog/product')->setStoreId($storeId)->load($_product->getId()); How can I fix the […]
  • Magento2: How to get config variable in block.php (2)
    I want to get the value of config variable in my custom block.php file. Can somebody help me in this? So far, I did following this in my block file. public function __construct( MagentoFrameworkAppConfigScopeConfigInterface $scopeConfig, […]
  • Magento2: How to get config variable in block.php (2)
    I want to get the value of config variable in my custom block.php file. Can somebody help me in this? So far, I did following this in my block file. public function __construct( MagentoFrameworkAppConfigScopeConfigInterface $scopeConfig, […]
  • SUPEE-7405 failing to install on my version of 1.9.1.1 (1)
    SUPEE-7405 produces errors when applied to Mag 1.9.1.1. app/etc/applied.patches.list displayed installed patches are: SUPEE-5998 | EE_1.14.1.0 | v1 SUPEE-6237 | EE_1.14.2.0 | v1 SUPEE-6285 | CE_1.9.1.1 | v1 SUPEE-6285 | CE_1.9.1.1 | v1 (REVERTED) SUPEE-6285 | […]
  • Error after installing patch 7405 on Magento 1.4.0.1 (0)
    The Magento patch 7405 adds a function to app/code/core/Mage/Adminhtml/Helper/Sales.php that is as follows: /** * Escape string preserving links * * @param array|string $data * @param null|array $allowedTags * @return string */ public function escapeHtmlWithLinks($data, […]
  • Error after installing patch 7405 on Magento 1.4.0.1 (1)
    The Magento patch 7405 adds a function to app/code/core/Mage/Adminhtml/Helper/Sales.php that is as follows: /** * Escape string preserving links * * @param array|string $data * @param null|array $allowedTags * @return string */ public function escapeHtmlWithLinks($data, […]
  • M2.1: Loading Products with MagentoCatalogBlockProductView (1)
    I want to load another Product on the catalog product view page using the the default MagentoCatalogBlockProductView Block and trying to load the product via SKU in an custom template file <block class="MagentoCatalogBlockProductView" name="product.bundle.options" […]
  • M2.1: Loading Products with MagentoCatalogBlockProductView (1)
    I want to load another Product on the catalog product view page using the the default MagentoCatalogBlockProductView Block and trying to load the product via SKU in an custom template file <block class="MagentoCatalogBlockProductView" name="product.bundle.options" […]
  • M2.1: Loading Products with MagentoCatalogBlockProductView (1)
    I want to load another Product on the catalog product view page using the the default MagentoCatalogBlockProductView Block and trying to load the product via SKU in an custom template file <block class="MagentoCatalogBlockProductView" name="product.bundle.options" […]
  • M2.1: Loading Products with MagentoCatalogBlockProductView (1)
    I want to load another Product on the catalog product view page using the the default MagentoCatalogBlockProductView Block and trying to load the product via SKU in an custom template file <block class="MagentoCatalogBlockProductView" name="product.bundle.options" […]
how to edit custom css or less in Magento 2?
access variables / array in media.phtml on description.phtml

1 Comment on this article

  • User November 12, 2016

    Did you whitelist the blocks and vars in the backend?

    Try to know which block to whitelist by printing debug information in app/code/core/Mage/Core/Model/Email/Template/Filter.php

    If not try the following:

    DON’T TRY OTHER COMMANDS UNLESS YOU REALLY KNOW WHAT YOU DO AS IT MAY BREAK YOUR WHOLE INSTALLATION!

    Reply

Add a comment

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax