1

Backend generate date when we shipped order,

enter image description here

Frontend shown only order created dated,

enter image description here

Is it possible using event-observer?

2
  • while you see shipment? you need to show shipment date not a order date right? Dec 11, 2019 at 13:24
  • @PadhiyarGaurang I need to show both dates. By default ordered date shown once order created also need if order comment status update to shipped [ i.stack.imgur.com/QCBkq.png ] the shipment date should be display.
    – zus
    Dec 12, 2019 at 4:22

1 Answer 1

0

Ok, I have solved this for you.

sales.xml at app/design/frontend/{namespace}/{theme}/layout/sales.xml update below code.

<sales_order_shipment translate="label">
    <label>Customer My Account Order Shipment View</label>
    <update handle="customer_account"/>
    <reference name="my.account.wrapper">
        <block type="sales/order_info" as="info" name="sales.order.info" template="sales/order/shipment/info.phtml">
            <block type="sales/order_info_buttons" as="buttons" name="sales.order.info.buttons" />
        </block>
        <block type="sales/order_shipment" name="sales.order.shipment">
            <block type="sales/order_shipment_items" name="shipment_items" template="sales/order/shipment/items.phtml">
                <action method="addItemRender"><type>default</type><block>sales/order_item_renderer_default</block><template>sales/order/shipment/items/renderer/default.phtml</template></action>
                <block type="sales/order_comments" name="shipment_comments" template="sales/order/comments.phtml" />
            </block>
        </block>
    </reference>
    <reference name="sales.order.info">
        <action method="addLink" translate="label" module="sales"><name>view</name><path>*/*/view</path><label>Order Information</label></action>
        <action method="addLink" translate="label" module="sales"><name>invoice</name><path>*/*/invoice</path><label>Invoices</label></action>
        <action method="addLink" translate="label" module="sales"><name>shipment</name><path></path><label>Shipments</label></action>
        <action method="addLink" translate="label" module="sales"><name>creditmemo</name><path>*/*/creditmemo</path><label>Refunds</label></action>
    </reference>
    <block type="core/text_list" name="additional.product.info" />
</sales_order_shipment>

Than create file info.phtml at app/design/frontend/{theme_namespace}/{theme}/template/sales/order/shipment/info.phtml

<?php /** @var $this Mage_Sales_Block_Order_Info */ ?>
<?php $_order = $this->getOrder() ?>
<?php echo $this->getMessagesBlock()->toHtml() ?>
<div class="page-title title-buttons">
    <h1><?php echo $this->__('Order #%s - %s', $_order->getRealOrderId(), $_order->getStatusLabel()) ?></h1>
    <?php echo $this->getChildHtml('buttons') ?>
</div>
<?php echo $this->getStatusHistoryRssUrl($_order) ?>
<dl class="order-info">
    <dt><?php echo $this->__('About This Order:') ?></dt>
    <dd>
        <?php $_links = $this->getLinks(); ?>
        <ul id="order-info-tabs">
        <?php foreach ($_links as $_link): ?>
            <?php if($_link->getUrl()): ?>
                <li><a href="<?php echo $_link->getUrl() ?>"><?php echo $_link->getLabel() ?></a></li>
            <?php else: ?>
                <li class="current"><?php echo $_link->getLabel() ?></li>
            <?php endif; ?>
        <?php endforeach; ?>
        </ul>
        <script type="text/javascript">decorateGeneric($('order-info-tabs').select('LI'),['first','last']);</script>
    </dd>
</dl>
<p class="order-date"><?php echo $this->__('Order Date: %s', $this->formatDate($_order->getCreatedAtStoreDate(), 'long')) ?></p>
<?php $shipment = $_order->getShipmentsCollection();?>
<?php if(count($shipment) > 1): ?>
    <?php foreach($shipment as $_shipment): ?>
        <p class="shipment-date">
            <?php echo $this->__('#'.$_shipment->getIncrementId().' '.'Shipment Date: %s', $this->formatDate($_shipment->getCreatedAt(), 'long')) ?>
        </p>
    <?php endforeach; ?>
<?php elseif(count($shipment) == '1'):?>
    <p class="shipment-date">
        <?php echo $this->__('Shipment Date: %s', $this->formatDate($shipment->getFirstItem()->getCreatedAt(), 'long')) ?>
    </p>
<?php endif; ?>
<?php if (!$_order->getIsVirtual()): ?>
<div class="col2-set order-info-box">
    <div class="col-1">
        <div class="box">
            <div class="box-title">
                <h2><?php echo $this->__('Shipping Address') ?></h2>
            </div>
            <div class="box-content">
                <address><?php echo $_order->getShippingAddress()->format('html') ?></address>
            </div>
        </div>
    </div>
    <div class="col-2">
        <div class="box">
            <div class="box-title">
                <h2><?php echo $this->__('Shipping Method') ?></h2>
            </div>
            <div class="box-content">
                <?php if ($_order->getShippingDescription()): ?>
                    <?php echo $this->escapeHtml($_order->getShippingDescription()) ?>
                <?php else: ?>
                    <p><?php echo $this->helper('sales')->__('No shipping information available'); ?></p>
                <?php endif; ?>
            </div>
        </div>
    </div>
</div>
<?php endif; ?>
<div class="col2-set order-info-box">
    <div class="col-1">
        <div class="box">
            <div class="box-title">
                <h2><?php echo $this->__('Billing Address') ?></h2>
            </div>
            <div class="box-content">
                <address><?php echo $_order->getBillingAddress()->format('html') ?></address>
            </div>
        </div>
    </div>
    <div class="col-2">
        <div class="box box-payment">
            <div class="box-title">
                <h2><?php echo $this->__('Payment Method') ?></h2>
            </div>
            <div class="box-content">
                <?php echo $this->getPaymentInfoHtml() ?>
            </div>
        </div>
    </div>
</div>

This solution worked for multi shipment and single shipment both.

Update : Cache flush after this.

8
  • After update with your code may i know where will shown shipped date, imgur.com/qZ6scR0
    – zus
    Dec 12, 2019 at 6:47
  • @zus Multi Shipment : prnt.sc/q9odqr Single Shipment: prnt.sc/q9odok Dec 12, 2019 at 6:52
  • okay, let me create new order.
    – zus
    Dec 12, 2019 at 6:55
  • May i know why its not applied for already shipped order?
    – zus
    Dec 12, 2019 at 7:01
  • folder structure : app/design/frontend/default/theme/layout/sales.xml & app/design/frontend/default/theme/template/sales/order/shipment/info.phtml
    – zus
    Dec 12, 2019 at 7:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.