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!

  • Paste full code here? – Supravat M Dec 9 '18 at 19:03
  • Hello Supravat, sorry for the delay – here is the full code. – user3631648 Dec 17 '18 at 9:15
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

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

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.