Skip to content

Magento 2, Undefined variable: secureRenderer

After install extension I receive error. If I go to Sales -> Order => shipped order.
If I go to new order it is ok.

Exception #0 (Exception): Notice: Undefined variable: secureRenderer in ……/app/code/Smartmage/Inpost/view/adminhtml/templates/order/view/info.phtml on line 34

line 34:

<?= /* @noEscape */ $secureRenderer->renderEventListenerAsTag(
            'onclick',
            "popWin('" . $block->escapeJs($shippingHelper->getTrackingPopupUrlBySalesModel($order)) .
            "','trackorder','width=800,height=600,resizable=yes,scrollbars=yes')",
            'a#linkId'
        ) ?>

info.phtml

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

/**
 * @var $block MagentoSalesBlockAdminhtmlOrderAbstractOrder
 * @var MagentoFrameworkViewHelperSecureHtmlRenderer $secureRenderer
 */

/** @var MagentoShippingHelperData $shippingHelper */
$shippingHelper = $block->getData('shippingHelper');
/** @var MagentoTaxHelperData $taxHelper */
$taxHelper = ($block->getData('taxHelper')) ? $block->getData('taxHelper') : $this->helper(MagentoTaxHelperData::class);
?>
<?php $order = $block->getOrder() ?>
<?php if ($order->getIsVirtual()):
    return '';
endif; ?>

<?php /* Shipping Method */ ?>
<div class="admin__page-section-item order-shipping-method">
    <div class="admin__page-section-item-title">
        <span class="title"><?= $block->escapeHtml(__('Shipping &amp; Handling Information')) ?></span>
    </div>
    <div class="admin__page-section-item-content">
        <?php  if ($order->getTracksCollection()->count()): ?>
            <p>
                <a href="#" id="linkId" title="<?= $block->escapeHtmlAttr(__('Track Order')) ?>">
                    <?= $block->escapeHtml(__('Track Order')) ?>
                </a>
            </p>
            <?= /* @noEscape */ $secureRenderer->renderEventListenerAsTag(
                'onclick',
                "popWin('" . $block->escapeJs($shippingHelper->getTrackingPopupUrlBySalesModel($order)) .
                "','trackorder','width=800,height=600,resizable=yes,scrollbars=yes')",
                'a#linkId'
            ) ?>
        <?php endif; ?>
        <?php if ($order->getShippingDescription()): ?>
            <strong><?= $block->escapeHtml($order->getShippingDescription()) ?></strong>

            <?php if ($taxHelper->displayShippingPriceIncludingTax()): ?>
                <?php $_excl = $block->displayShippingPriceInclTax($order); ?>
            <?php else: ?>
                <?php $_excl = $block->displayPriceAttribute('shipping_amount', false, ' '); ?>
            <?php endif; ?>
            <?php $_incl = $block->displayShippingPriceInclTax($order); ?>

            <?= /** @noEscape */ $_excl ?>
            <?php if ($taxHelper->displayShippingBothPrices() && $_incl != $_excl): ?>
                (<?= $block->escapeHtml(__('Incl. Tax')) ?> <?= /** @noEscape */ $_incl ?>)
            <?php endif; ?>
        <?php else: ?>
            <?= $block->escapeHtml(__('No shipping information available')) ?>
        <?php endif; ?>
    </div>
    <?php
    $targetPoint = $order->getData('inpost_locker_id');
    if ($targetPoint): ?>
        <div class="admin__page-section-item-content">
            <br/>
            <?php echo __('Selected Paczkomat:') . ' ' . $block->escapeHtml($targetPoint); ?>
        </div>
    <?php endif; ?>
</div>