0

I am Using Magento 1.7.0.2. When I tried to edit transactional email template, I got this error Decoding failed: Syntax error. How to Solve it.

Note: The only particular template is not loading. Other templates are able to edit.

Decoding failed: Syntax error

0

Install this module.

https://github.com/Inchoo/Inchoo_PHP7

It due to PHP7 and magento compablity issue.

        <?php
        class Inchoo_PHP7_Helper_Data extends Mage_Core_Helper_Data
        {
            /** @var string $_moduleName Compatibility for translations, and maybe other stuff which uses module names. */
            protected $_moduleName = 'Mage_Core';
            /**
             * Decodes the given $encodedValue string which is encoded in the JSON format
             *
             * Overridden to prevent exceptions in json_decode
             *
             * @param string $encodedValue
             * @param int $objectDecodeType
             * @return mixed
             * @throws Zend_Json_Exception
             */
            public function jsonDecode($encodedValue, $objectDecodeType = Zend_Json::TYPE_ARRAY) {
                switch (true) {
                    case (null === $encodedValue)  : $encodedValue = 'null'; break;
                    case (true === $encodedValue)  : $encodedValue = 'true'; break;
                    case (false === $encodedValue) : $encodedValue = 'false'; break;
                    case ('' === $encodedValue)    : $encodedValue = '""'; break;
                    default    : // do nothing
                }
                return json_decode($encodedValue, $objectDecodeType);
                return Zend_Json::decode($encodedValue, $objectDecodeType);
            }
        }
  • Hi @pathiyar, After Installing this module also getting same error only. – Saravanan DS Aug 24 '17 at 6:09
  • Have you cleared cache? – padhiyar gaurang Aug 24 '17 at 6:15
  • yes, cleared cache and reindexed. Note: The only particular template is not loading. Other templates are able to edit. – Saravanan DS Aug 24 '17 at 6:19
  • just for some time comment this line Zend_Json::decode($encodedValue, $objectDecodeType); from file app/code/local/Inchoo/PHP7/Helper/Data.php Than edit same template and remove store_url=\\. and check again by uncommentiong same line. – padhiyar gaurang Aug 24 '17 at 6:21
  • got this error: Parse error: syntax error, unexpected ':', expecting ';' or '{' in /public_html/deals/shell/inchoo_php7_test.php on line 28 – Saravanan DS Aug 24 '17 at 6:23

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.