1

How to display estimated delivery date in product page when the user selects country and zip code ?

  • When I have such a requirement with one of our client, we agreed to use a paid module store.plumrocket.com/… – Kumar A. May 23 '17 at 10:12
  • but i want to apply in my module...programmatically.. – user52726 May 23 '17 at 12:51
0

Update this code :

app/code/[NameSpace]/[ModuleName]/view/frontend/layout/catalog_product_view.xml

<?xml version="1.0"?>
<body>
    <referenceContainer name="alert.urls">
        <block class="Magento\Catalog\Block\Product\View" name="product.info.[ModuleName]" as="[ModuleName]" 
        after="-" template="[NameSpace]_[ModuleName]::product/view/temp.phtml"/>
    </referenceContainer>
</body>

app/code/[NameSpace]/[ModuleName]/view/frontend/templates/product/view/temp.phtml

<?php
$product = $this->getProduct()
?>
<div>Estimated Delivery Date</div>
<div><?php // your code ?></div>

<div>Estimated Shipping Date</div>
<div><?php // your code ?></div>
| improve this answer | |
2

You can add block and .phtml in product view page and add your code as you want

Create catalog_product_view.xml in app/code/[NameSpace]/[ModuleName]/view/frontend/layout/

<?xml version="1.0"?>
<body>
    <referenceContainer name="alert.urls">
        <block class="Magento\Catalog\Block\Product\View" name="product.info.[ModuleName]" as="[ModuleName]" 
        after="-" template="[NameSpace]_[ModuleName]::product/view/[fileName].phtml"/>
    </referenceContainer>
</body>

Create [fileName].phtml in app/code/[NameSpace]/[ModuleName]/view/frontend/templates/product/view

<?php
$product = $this->getProduct()
?>
<div>Estimated Delivery Date</div>
<div><?php // Your code ?></div>

<div>Estimated Shipping Date</div>
<div><?php // Your code ?></div>

Here you can add you logic to get Delivery and Shipping date and display according to Product

| improve this answer | |
  • i'll try this way thank You :) Manoj Mondal – user52726 May 24 '17 at 6:09
0

Crate xml file on this path :

app/code/[NameSpace]/[ModuleName]/view/frontend/layout/catalog_product_view.xml

<?xml version="1.0"?>
<body>
    <referenceContainer name="alert.urls">
        <block class="Magento\Catalog\Block\Product\View" name="product.info.[ModuleName]" as="[ModuleName]" 
        after="-" template="[NameSpace]_[ModuleName]::product/view/temp.phtml"/>
    </referenceContainer>
</body>

app/code/[NameSpace]/[ModuleName]/view/frontend/templates/product/view/temp.phtml

<?php
$product = $this->getProduct()
?>
<div>Estimated Delivery Date</div>
<div><?php // add your date function ?></div>

<div>Estimated Shipping Date</div>
<div><?php // add your date function ?></div>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy