0

I've given some HTML in the custom options of Magento, it is working perfectly fine on the product page however in the checkout page, it is showing with HTML code. When I checked the source code, the HTML tags has been converted to entities. For example, <span> is showing like &lt;span&gt;

<dl class="item-options"> <?php foreach ($_options as $_option) : ?> <?php $_formatedOptionValue = $this->getFormatedOptionValue($_option) ?> <dt><?php echo $this->htmlEscape($_option['label']) ?></dt> <dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated"<?php endif; ?>><?php echo $_formatedOptionValue['value'] ?> <?php if (isset($_formatedOptionValue['full_view'])): ?> <div class="truncated_full_value"> <dl class="item-options"> <dt><?php echo $this->htmlEscape($_option['label']) ?></dt> <dd><?php echo $_formatedOptionValue['full_view'] ?></dd> </dl> **

  • Edit: Here is the ouput of HTML <dl class="item-options"> <dt>Customize Your System:</dt> <dd class="truncated">&lt;span id="evo-blue"&gt;Heading: <a href="#" class="dots" onclick="return false">...</a> <div class="truncated_full_value show"> <dl class="item-options"> <dt>Heading-2</dt> <dd>&lt;span id="evo-blue"&gt;Heading-3:&lt;/span&gt; Some text..</dd> </dl> </div> </dd> </dl>

**

I'm thinking that $this->htmlEscape has something to do with this mess? Anyone knows how to solve this?

0

You can decode HTML chars using htmlspecialchars_decode:

<?php echo htmlspecialchars_decode($_formatedOptionValue['value']) ?>

I don't know if there is a Magento function to do so.

2
  • thanks for replying.Yeah I do have tried with the escapeHtml. It doesn't sovle the issue.Check above the edit version for the output result of the present code. – Shoeb Mirza Sep 11 '14 at 10:55
  • thanks dude.. You made my day.. Works like charm..!!!Superb!! – Shoeb Mirza Sep 11 '14 at 12:13

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.