0

For the title of an article, I am using HTML-code. Unfortunately, the HTML-code in the cart is not written as formatted in HTML – it is written with the HTML-tags, like:

"This is a title.<br>Yeah, really!" 

The item is rendered with the following command in "details.html"

data-bind="html: full_view"

I would like to show it like this:

This is an title.
Yeah, really!

The template comes from here:

vendor/magento/module-checkout/view/frontend/templates/cart/item/default.phtml

and looks like this:

<dl class="item-options">
 <?php foreach ($_options as $_option) : ?>
  <?php $_formatedOptionValue = $block->getFormatedOptionValue($_option) ?>
   <dt><?php echo $block->escapeHtml($_option['label']) ?></dt>
   <dd>
     <?php if (isset($_formatedOptionValue['full_view'])): ?>
      <?php /* @escapeNotVerified */ echo $_formatedOptionValue['full_view'] ?>
     <?php else: ?>
      <?php /* @escapeNotVerified */ echo $_formatedOptionValue['value'] ?>
     <?php endif; ?>
   </dd>
 <?php endforeach; ?>
</dl>

Does anybody know how to achieve this? Many thanks!

The problem seems to be "echo $_formatedOptionValue['full_view']" – but I do not understand where this value comes from. I really appreciate any hint!

2
  • Paste full code here? Commented Dec 9, 2018 at 19:03
  • Hello Supravat, sorry for the delay – here is the full code. Commented Dec 17, 2018 at 9:15

1 Answer 1

0

If you want to write HTML in your description, it is important, that you're using the HTML-Editor (marked grey in my screenshot)

enter image description here

3
  • Thanks, but the HTML-tags are used in the product name. so, it is plain HTML there like the example above. Commented Dec 17, 2018 at 15:52
  • wait. do you want to use HTML in the name or description? because in the question you stated description Commented Dec 17, 2018 at 16:04
  • Hi Philipp, shame on me – yes, it is the title, not the description. Many thanks! I changed the text above. Commented Dec 18, 2018 at 11:31

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.