Skip to main content

Magento2: - How to get dynamically orderOrder number?

in file pathFile Path :

SR\DeliveryDate\view\adminhtml\templates\order_info_shipping_info.phtml

SR\DeliveryDate\view\adminhtml\templates\order_info_shipping_info.phtml

In lineLine No : $orderid = 33;

$orderid = 33;

Magento2: How to get dynamically order number

in file path:

SR\DeliveryDate\view\adminhtml\templates\order_info_shipping_info.phtml

In line:

$orderid = 33;

Magento2 - How to get dynamically Order number?

File Path :

SR\DeliveryDate\view\adminhtml\templates\order_info_shipping_info.phtml

Line No : $orderid = 33;

Source Link
Sylvester
  • 2.3k
  • 4
  • 30
  • 69

Magento2: How to get dynamically order number

in file path:

SR\DeliveryDate\view\adminhtml\templates\order_info_shipping_info.phtml

code:

<section class="admin__page-section" id="delivery-date-content">
    <div class="admin__page-section-title">
        <span class="title"><?= $block->escapeHtml(__('Delivery Date Information')) ?></span>
    </div>
    <div class="admin__page-section-content">
        <div id="delivery-date">
            <strong><?= __('Delivery Date') ?></strong>
            <span><?= $block->getDeliveryDate() ?></span>
        </div>
        <div id="delivery-comment">
            <strong><?= __('Comment') ?>:</strong>
            <br/>
            <?= $block->getDeliveryComment() ?>
        </div>
        <div id="delivery-test">
            <strong><?= __('Test') ?>:</strong>
            <br/>
            <?php
                $orderid = 33;
                $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
                $order = $objectManager->create('Magento\Sales\Api\Data\OrderInterface')->load($orderid);
                 
                //fetch whole order information
                //print_r($order->getData());
                 
                //Or fetch specific information
                //echo $order->getIncrementId();
                //echo $order->getGrandTotal();
                //echo $order->getSubtotal();
                echo $order->getDeliveryDropdown();
            ?>
        </div>
    </div>
</section>
<script type="text/javascript">
    require(
        ['jquery'],
        function($) {
            $('#delivery-date-content').insertAfter($('.order-view-billing-shipping'));
        }
    );
</script>

In line:

$orderid = 33;

I want get dynamically order number after place order.

Can anyone help create block and call to phtml file?