cancel
Showing results for 
Search instead for 
Did you mean: 

how to call admin html code to frontend html code in magento 2 ?

how to call admin html code to frontend html code in magento 2 ?

Hi guys ,

                      am trying to call  admin phtml  code into  frontend phtml code. Below is the example 

 

file 1 : vendor\magento\module-sales\view\adminhtml\templates\items\column/name.phtml

    code  : 

                <?php if ($block->getOrderOptions()): ?>
<dl class="item-options">
<?php foreach ($block->getOrderOptions() as $_option): ?>
<dt><?= /* @escapeNotVerified */ $_option['label'] ?>:</dt>
<dd>
<?php if (isset($_option['custom_view']) && $_option['custom_view']): ?>
<?= /* @escapeNotVerified */ $block->getCustomizedOptionValue($_option) ?>
<?php else: ?>
<?php $_option = $block->getFormattedOption($_option['value']); ?>
<?= /* @escapeNotVerified */ $_option['value'] ?><?php if (isset($_option['remainder']) && $_option['remainder']): ?><span id="<?= /* @escapeNotVerified */ $_dots = 'dots' . uniqid() ?>"> ...</span><span id="<?= /* @escapeNotVerified */ $_id = 'id' . uniqid() ?>"><?= /* @escapeNotVerified */ $_option['remainder'] ?></span>
<script>
require(['prototype'], function() {
$('<?= /* @escapeNotVerified */ $_id ?>').hide();
$('<?= /* @escapeNotVerified */ $_id ?>').up().observe('mouseover', function(){$('<?= /* @escapeNotVerified */ $_id ?>').show();});
$('<?= /* @escapeNotVerified */ $_id ?>').up().observe('mouseover', function(){$('<?= /* @escapeNotVerified */ $_dots ?>').hide();});
$('<?= /* @escapeNotVerified */ $_id ?>').up().observe('mouseout', function(){$('<?= /* @escapeNotVerified */ $_id ?>').hide();});
$('<?= /* @escapeNotVerified */ $_id ?>').up().observe('mouseout', function(){$('<?= /* @escapeNotVerified */ $_dots ?>').show();});
});
</script>
<?php endif; ?>
<?php endif; ?>
</dd>
<?php endforeach; ?>
</dl>
<?php endif; ?>        

 

Note : I just want to call the above code in below path . I tried but am unable to sort. 

 

file 2 :  vendor/magento/module-sales/view/frontend/templates/email/items.phtml

 

can anyone guide me ?