1
  1. Magento 1 version : 1.9.4.0
  2. Magento 2 version : 2.3.5
  3. Fresh install of m2
  4. Run migrate:settings
  5. Run migrate:data All data is migrated

We migrated data successfully but getting issues of html tags on invoice pages. Admin->Sales->Invoices->Click on any invoice->Invoice page will open "Payment Information" under "Payment & Shipping Method" head here Data(content or description) showing in html tags.

Expected result

Data must be show WITHOUT HTML tags

Actual result

But here data is showing WITH HTML tags

Please check screenshot - enter image description here

I just changed vendor/magento/module-sales/view/adminhtml/templates/order/invoice/view/form.phtml

before - <?= $block->getChildHtml('order_payment') ?>

now i using escaper function like this -

$data = $block->getChildHtml('order_payment');
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
echo $escaper = $objectManager->create('Magento\Framework\Escaper')->escapeHtml($data);

Sample data(which i get on $data) -

<p>Western Union</p> <table> <tbody> <tr> <td><p><strong>WU Instructions: </strong>Western Union is a common way for people to send any currency to the USA. For Western Union you can either use their website, or go to a nearby Western Union store. Once you do this, email us back the information.</p><p>To find your nearest location, go to:<br><a href="http://locations.westernunion.com/" target="_blank">locations.westernunion.com</a><p>Bring your invoice, and this information with you to the Western Union store. This is the "Receiver" information: </p><p>* Name: <strong>john cloe </strong><br>* Street: <strong>123 b 108th mw</strong><br>* City, State & Zip: <strong>Seattle, Washington State, 98121</strong><br>* Country: <strong>USA </strong><br>* Phone: <strong>123-456-7890 </strong></p><p>When the money is sent, email us back: WU Control number; Senders full name, Senders City, State, and Country. That is it.</p></td> </tr> </tbody> </table>

but still not working

Section -

<div class="admin__page-section-item order-payment-method<?php if ($_order->getIsVirtual()) : ?> order-payment-method-virtual<?php endif; ?> admin__fieldset-wrapper">
            <?php /*Billing Address */ ?>
            <div class="admin__page-section-item-title">
                <span class="title"><?= $block->escapeHtml(__('Payment Information')) ?></span>
            </div>
            <div class="admin__page-section-item-content">
                <div class="order-payment-method-title">
                    <?php 
                    $data = $block->getChildHtml('order_payment');
                    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
                    $allowableTags="<a>";
                    $result = strip_tags($data, $allowableTags);
                    echo $escaper = $objectManager->create('Magento\Framework\Escaper')->escapeHtml($result, $allowableTags);
                    ?>

                </div>
                <div class="order-payment-currency">
                    <?= $block->escapeHtml(__('The order was placed using %1.', $_order->getOrderCurrencyCode())) ?>
                </div>
                <div class="order-payment-additional"><?= $block->getChildHtml('order_payment_additional') ?></div>
            </div>
        </div>

How to remove this HTML tags ?

13
  • try below code mentioned in my answer Jun 8 '20 at 11:12
  • you are create custom payment information section ??? Jun 8 '20 at 11:47
  • @MohitPatel No this is fresh magento installation and i just migrate data from M1 to M2 Jun 8 '20 at 11:49
  • So fresh magento install and form.phtml file copy and paste your migrate magento folder.i think you are understand Jun 8 '20 at 11:51
  • @MohitPatel yes i copied.But still not working,i just want to remove HTML tags Jun 8 '20 at 11:59
0

Can you try like this ?

$data = $block->getChildHtml('order_payment');
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$allowableTags="<a>";
$result = strip_tags($data, $allowableTags);
echo $escaper = $objectManager->create('Magento\Framework\Escaper')->escapeHtml($result, $allowableTags);
9
  • yes may be HTML tags directly coming from Payment gateway but it is working fine in M1 and i also edit my question,can you please check again my editable questions ? Jun 8 '20 at 10:46
  • can u give me sample html data which you receives in $data variable ? Jun 8 '20 at 10:50
  • i edited question put sample data Jun 8 '20 at 10:56
  • Please chek above code @sumeetbajaj Jun 8 '20 at 11:15
  • table tags gone but other tags is showing please check screenshot - prnt.sc/svulu3 you can compare screenshot in my question Jun 8 '20 at 11:22

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.