{"id":289,"date":"2020-02-28T16:03:12","date_gmt":"2020-02-28T16:03:12","guid":{"rendered":"http:\/\/wiki2.plumserver.com\/knowledge-base\/magento-estimated-delivery-date-v1-x-developers-guide-and-api-reference"},"modified":"2022-06-24T03:45:02","modified_gmt":"2022-06-24T07:45:02","slug":"magento-1-estimated-delivery-date-v1-developer-guide","status":"publish","type":"post","link":"https:\/\/plumrocket.com\/docs\/magento-1-estimated-delivery-date\/v1\/devguide","title":{"rendered":"Magento 1 Estimated Delivery Date v1.x Developer Guide &#038; API Reference"},"content":{"rendered":"\n<p>In this developer documentation for the&nbsp;<a href=\"\/magento-1-estimated-delivery-date\">Magento Estimated Delivery Date Extension<\/a>, you will find step-by-step instructions, sample code, and API references to fully customize your plugin.<\/p>\n\n\n\n<h2 id=\"estimated-delivery-date-manual-configuration\">Estimated Delivery Date Manual Configuration<\/h2>\n\n\n\n<p>Estimated Delivery Date module will automatically add &#8220;Delivery Dates&#8221; on Product Page if enabled in back-end. However, you can change standard &#8220;Delivery Date&#8221; display or position in the front-end. To do this follow the instructions below.<\/p>\n\n\n\n<h3>Product Page<\/h3>\n\n\n\n<p>To have the Delivery Date displayed on the page, make sure you have the corresponding block in the layout template file:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-bash\">\/app\/design\/frontend\/default\/default\/layout\/catalog.xml<\/code><\/pre><\/div>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-markup\">&lt;block type=\"estimateddelivery\/product\" name=\"estimateddelivery_product\"\n    as=\"estimateddelivery\" template=\"estimateddelivery\/product.phtml\" \/><\/code><\/pre><\/div>\n\n\n\n<p>Now, edit HTML template and place following code in desired place on Product Page:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-bash\">\/app\/design\/frontend\/default\/default\/template\/catalog\/product\/view.phtml<\/code><\/pre><\/div>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">&lt;?php echo $this->getChildHtml('estimateddelivery') ?><\/code><\/pre><\/div>\n\n\n\n<p>The changes in the code above are enough to display &#8220;Estimated Delivery Date&#8221; on Product Page. However you can also change design of Estimated Delivery block. To do this, edit corresponding file:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-bash\">\/theme_path\/default\/template\/estimateddelivery\/product.phtml<\/code><\/pre><\/div>\n\n\n\n<h3><strong>Category Page<\/strong><\/h3>\n\n\n\n<p>In order to add the Estimated Delivery to the category page, you will have to edit the file:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-bash\">\/app\/design\/frontend\/&lt;your active theme>\/default\/template\/catalog\/category\/view.phtml<\/code><\/pre><\/div>\n\n\n\n<p>and enter the following code where the desired block should be located.<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">&lt;?php echo $this->getChildHtml('estimateddelivery')?><\/code><\/pre><\/div>\n\n\n\n<h2 id=\"display-estimated-delivery-dates-and-shipping-dates-in-magento-for-specific-categories-products\">Display Estimated Delivery Dates and Shipping Dates in Magento for Specific Categories &amp; Products<\/h2>\n\n\n\n<p>The following methods in &#8220;Plumrocket_Estimateddelivery_Block_Product&#8221; block allow to show shipping and delivery dates for specific products:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">setProduct($product)<\/code><\/pre><\/div>\n\n\n\n<p>Allows to set the product for which the dates will be shown.<\/p>\n\n\n\n<p><div class=\"example-block\">\n    <p class=\"example-block-title\">Example:<\/p>\n\n    <p><strong>Let&#8217;s show the date for &#8220;related&#8221; products on Product Page:<\/strong><\/p>\n\n    <div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">$relatedProducts = get_related_products(); \/\/ where get_related_products() is some custom \n        method to retrieve related products\n    $estimatedBlock = $this-&gt;getLayout()-&gt;createBlock('estimateddelivery\/product')\n        -&gt;setTemplate('estimateddelivery\/product.phtml');\n    foreach ($relatedProducts as $_product) { \n        echo $estimatedBlock-&gt;setProduct($_product)-&gt;toHtml();\n    }<\/code><\/pre><\/div>\n<\/div><\/p>\n\n\n\n<p><div class=\"example-block\">\n    <p class=\"example-block-title\">Example:<\/p>\n\n    <p>On <strong>Product Page with custom design<\/strong> we can display dates for &#8220;related&#8221; products and immediately after that display dates for the current product:<\/p>\n\n    <div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">&lt;div class=\"related_dates\"&gt;\n        &lt;?php\n            $relatedProducts = get_related_products(); \/\/ where get_related_products() is some \n                custom method to retrieve related products\n                foreach ($relatedProducts as $_product) {\n                    echo $this-&gt;getChild('estimateddelivery')-&gt;setProduct($_product)-&gt;toHtml();\n            } ?&gt;\n    &lt;\/div&gt;\n     \n    &lt;div class=\"main_date\"&gt;\n        &lt;?php $this-&gt;getChild('estimateddelivery')-&gt;reset()-&gt;toHtml(); ?&gt;\n    &lt;\/div&gt;<\/code><\/pre><\/div>\n<\/div><\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">setCategory($category)<\/code><\/pre><\/div>\n\n\n\n<p>Allows to set the category for which the dates will be shown.<\/p>\n\n\n\n<p><div class=\"example-block\">\n    <p class=\"example-block-title\">Example:<\/p>\n\n    <p><strong>Let&#8217;s display html block that contains delivery date for the set category:<\/strong><\/p>\n    <div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">$customCategory = Mage::getModel('catalog\/category')-&gt;load(&lt;any id&gt;);\n    echo $this-&gt;getLayout()-&gt;createBlock('estimateddelivery\/product')\n        -&gt;setTemplate('estimateddelivery\/category.phtml')-&gt;setCategory($customCategory)\n        -&gt;toHtml();<\/code><\/pre><\/div>\n<\/div><\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">getProduct()<\/code><\/pre><\/div>\n\n\n\n<p>Allows to get the product for which the dates will be shown. Note: If no product was indicated manually &#8211; current product will be returned on Product Page.<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">getCategory()<\/code><\/pre><\/div>\n\n\n\n<p>Allows to get the category for which the dates will be shown. Note: If no category was indicated manually &#8211; current category will be returned on Product Page or Category Page.<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">reset()<\/code><\/pre><\/div>\n\n\n\n<p>Allows to clear all current settings. After calling this method, the other methods (getProduct and getCategory) will return current product (on Product Page) and current category (on Product Page or Category Page) accordingly.This method comes handy for displaying dates of custom products (categories) on the product (category) page, and for returning to default settings.<\/p>\n\n\n<div class=\"example-block\">\n<p class=\"example-block-title\"><strong>Example code of <em>layout.xml<\/em> file:<\/strong><\/p>\n<p><strong>Let&#8217;s display block with date for the product by inserting it into the layout:<\/strong><\/p>\n<div class=\"wp-block-prismatic-blocks\">\n<div><\/div>\n<pre><code class=\"language-markup\">&lt;catalog_product_default&gt;\n        &lt;reference name=\"content\"&gt;\n            &lt;block type=\"estimateddelivery\/product\" name=\"estimateddelivery_product\"\n                as=\"estimateddelivery\" template=\"estimateddelivery\/product.phtml\" \/&gt;\n        &lt;\/reference&gt;\n    &lt;\/catalog_product_default&gt;<\/code><\/pre>\n<\/div>\n<\/div>\n\n\n<h2 id=\"fixing-issue-with-estimated-delivery-attribute-import\">Fixing issue with estimated delivery attribute import<\/h2>\n\n\n\n<p>Magento has a problem with importing product attribute values that have custom source model. <\/p>\n\n\n\n<p><strong>1. In order to import the attributes correctly using Magento import, you need to perform some changes in the code.<\/strong> <\/p>\n\n\n\n<p>Please, follow the instructions below.<\/p>\n\n\n\n<p>Find the file:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-markup\">\/app\/code\/core\/Mage\/ImportExport\/Model\/Import\/Entity\/Product.php<\/code><\/pre><\/div>\n\n\n\n<p>and copy it into the file:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-bash\">\/app\/code\/local\/Mage\/ImportExport\/Model\/Import\/Entity\/Product.php<\/code><\/pre><\/div>\n\n\n\n<p>Open created file and change the following code:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">protected $_indexValueAttributes = array('status', 'tax_class_id', 'visibility', \n    'gift_message_available', 'custom_design' );<\/code><\/pre><\/div>\n\n\n\n<p>to this code:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">protected $_indexValueAttributes = array('estimated_delivery_enable', \n    'estimated_shipping_enable', 'status', 'tax_class_id', 'visibility',  \n    'gift_message_available', 'custom_design'\n);<\/code><\/pre><\/div>\n\n\n\n<p>Save your changes<\/p>\n\n\n\n<p><strong>2. If you are using <a href=\"https:\/\/sourceforge.net\/projects\/magmi\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Magmi<\/a> for import, you need to change the code in this software, as it has the same issue as Magento.<\/strong><\/p>\n\n\n\n<p>Please, follow the instructions below to change the code.<\/p>\n\n\n\n<p>Find and edit file:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-bash\">\/magmi\/plugins\/inc\/magmi_defaultattributehandler.php<\/code><\/pre><\/div>\n\n\n\n<p>After the following code in method <strong>handleIntAttribute<\/strong>&nbsp;:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">\/\/ if it's tax_class, get tax class id from item value\ncase \"tax\/class_source_product\":\n$ovalue = $this->getTaxClassId($ivalue);\nbreak;<\/code><\/pre><\/div>\n\n\n\n<p>add next code lines:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">\/\/ if it's estimated delivery class\ncase \"estimateddelivery\/attribute_source_enable\":\n$ovalue = $ivalue;\nbreak;<\/code><\/pre><\/div>\n\n\n\n<p>It should look like this:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">\/\/ if it's tax_class, get tax class id from item value\ncase \"tax\/class_source_product\":\n$ovalue = $this->getTaxClassId($ivalue);\nbreak;\n\/\/ if it's estimated delivery class\ncase \"estimateddelivery\/attribute_source_enable\":\n$ovalue = $ivalue;\nbreak;<\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this developer documentation for the&nbsp;Magento Estimated Delivery Date Extension, you will find step-by-step instructions, sample code, and API references to fully customize your plugin. Estimated Delivery Date Manual Configuration Estimated Delivery Date module will automatically add &#8220;Delivery Dates&#8221; on Product Page if enabled in back-end. However, you can change standard &#8220;Delivery Date&#8221; display or &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/plumrocket.com\/docs\/magento-1-estimated-delivery-date\/v1\/devguide\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Magento 1 Estimated Delivery Date v1.x Developer Guide &#038; API Reference&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[262],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v17.2 (Yoast SEO v17.2) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Magento Estimated Delivery Date v1.x Developer Guide &amp; API Reference - Plumrocket Documentation<\/title>\n<meta name=\"description\" content=\"In this developer documentation for the&nbsp;Magento Estimated Delivery Date Extension, you will find step-by-step instructions, sample code, and API\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/plumrocket.com\/docs\/magento-1-estimated-delivery-date\/v1\/devguide\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Magento 1 Estimated Delivery Date v1.x Developer Guide &amp; API Reference\" \/>\n<meta property=\"og:description\" content=\"In this developer documentation for the&nbsp;Magento Estimated Delivery Date Extension, you will find step-by-step instructions, sample code, and API\" \/>\n<meta property=\"og:url\" content=\"https:\/\/plumrocket.com\/docs\/magento-1-estimated-delivery-date\/v1\/devguide\" \/>\n<meta property=\"og:site_name\" content=\"Plumrocket Documentation\" \/>\n<meta property=\"article:published_time\" content=\"2020-02-28T16:03:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-06-24T07:45:02+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Plumrocket\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Magento Estimated Delivery Date v1.x Developer Guide & API Reference - Plumrocket Documentation","description":"In this developer documentation for the&nbsp;Magento Estimated Delivery Date Extension, you will find step-by-step instructions, sample code, and API","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/plumrocket.com\/docs\/magento-1-estimated-delivery-date\/v1\/devguide","og_locale":"en_US","og_type":"article","og_title":"Magento 1 Estimated Delivery Date v1.x Developer Guide & API Reference","og_description":"In this developer documentation for the&nbsp;Magento Estimated Delivery Date Extension, you will find step-by-step instructions, sample code, and API","og_url":"https:\/\/plumrocket.com\/docs\/magento-1-estimated-delivery-date\/v1\/devguide","og_site_name":"Plumrocket Documentation","article_published_time":"2020-02-28T16:03:12+00:00","article_modified_time":"2022-06-24T07:45:02+00:00","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Plumrocket","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/plumrocket.com\/docs\/#website","url":"https:\/\/plumrocket.com\/docs\/","name":"Plumrocket Documentation","description":"Extensions docs, troubleshootings etc.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/plumrocket.com\/docs\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/plumrocket.com\/docs\/magento-1-estimated-delivery-date\/v1\/devguide#webpage","url":"https:\/\/plumrocket.com\/docs\/magento-1-estimated-delivery-date\/v1\/devguide","name":"Magento 1 Estimated Delivery Date v1.x Developer Guide & API Reference - Plumrocket Documentation","isPartOf":{"@id":"https:\/\/plumrocket.com\/docs\/#website"},"datePublished":"2020-02-28T16:03:12+00:00","dateModified":"2022-06-24T07:45:02+00:00","author":{"@id":"https:\/\/plumrocket.com\/docs\/#\/schema\/person\/38b360639b934d6c984ee4f3ffce7d20"},"description":"In this developer documentation for the&nbsp;Magento Estimated Delivery Date Extension, you will find step-by-step instructions, sample code, and API","breadcrumb":{"@id":"https:\/\/plumrocket.com\/docs\/magento-1-estimated-delivery-date\/v1\/devguide#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/plumrocket.com\/docs\/magento-1-estimated-delivery-date\/v1\/devguide"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/plumrocket.com\/docs\/magento-1-estimated-delivery-date\/v1\/devguide#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Magento Extensions","item":"https:\/\/plumrocket.com\/magento-1-extensions"},{"@type":"ListItem","position":2,"name":"Magento Estimated Delivery Date","item":"https:\/\/plumrocket.com\/magento-1-estimated-delivery-date"},{"@type":"ListItem","position":3,"name":"Documentation","item":"https:\/\/plumrocket.com\/docs\/magento-1-estimated-delivery-date"},{"@type":"ListItem","position":4,"name":"v1","item":"https:\/\/plumrocket.com\/docs\/magento-1-estimated-delivery-date\/v1"},{"@type":"ListItem","position":5,"name":"Developer Guide"}]},{"@type":"Person","@id":"https:\/\/plumrocket.com\/docs\/#\/schema\/person\/38b360639b934d6c984ee4f3ffce7d20","name":"Plumrocket","image":{"@type":"ImageObject","@id":"https:\/\/plumrocket.com\/docs\/#personlogo","inLanguage":"en-US","url":"https:\/\/secure.gravatar.com\/avatar\/72392a92ae750c66560be284502b6676?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/72392a92ae750c66560be284502b6676?s=96&d=mm&r=g","caption":"Plumrocket"},"sameAs":["https:\/\/plumrocket.com\/docs"]}]}},"_links":{"self":[{"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/posts\/289"}],"collection":[{"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/comments?post=289"}],"version-history":[{"count":5,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/posts\/289\/revisions"}],"predecessor-version":[{"id":25761,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/posts\/289\/revisions\/25761"}],"wp:attachment":[{"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/media?parent=289"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/categories?post=289"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/tags?post=289"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}