In magento, how to setup Expected Delivery date option in the product page itself. Choosing this date(Expected Delivery) and then add the product to cart.

If the customer has order more than 1 products,(ie) if the cart have 3 products then 3 products may have different delivery date.

The customers can able to place a single order with multiple different dispatch dates? I.E Product A, B & C dispatched on Tuesday, Thursday & Friday.

If the delivery date is selected from the customer then it(delivery date) should display in cart / checkout and order pages.

The Customer can choose their delivery date as they prefered in the product page.

Any Ideas?

3 Answers 3


Your question is a little vague. Would you like the customer to select a delivery date that THEY would prefer or are the ADMIN to be able to indicate a delivery date that the customer can expect to receive his/her order.

I'm assuming the latter:

You can set up a custom attribute via:

  1. Catalog->Attributes->Manage Attributes
  2. Click Create New Attribute on the top right hand side of the page
  3. Set up the attribute as Date under Catalogue Input Type for Shop Owner
  4. Visible on Product View Page on Front-end should be set to Yes
  5. Used in Product Listing should be set to Yes
  6. Give it an appropriate label under Label Options

Obviously managing this attribute over your whole catalogue isn't really going to be a viable option, and as such it would be wiser to set up a Cron Job which runs daily to populate the date fields.

Your cron job script should look something like (note that the $mageFilename should be the directory path to your Mage.php file under the app directory)

$mageFilename = 'app/Mage.php';
require_once $mageFilename;
ini_set('display_errors', 1);
Mage::register('isSecureArea', 1);

$date = Mage::getModel('core/date')->timestamp(time());
$date = date('Y/m/d H:i:s', strtotime($date . ' + x days')); //x should be the numeric value of how many days from now delivery would be possible
$connection = _getConnection('core_read');
$sql = 'SELECT * FROM catalog_product_entity';
$products = $connection->fetchAll($sql);
$connection = _getConnection('core_write');
foreach ($products as $product){
    $sql = 'UPDATE catalog_product_entity_date SET value = ? WHERE attribute_id = ? AND entity_id = ?';
    $connection->query($sql, array($date, your_attribute_id, $product['entity_id']));

function _getConnection($type = 'core_read'){
    return Mage::getSingleton('core/resource')->getConnection($type);


You can figure out what your_attribute_id is after saving the attribute and looking at the URL on the page, it'll be something like:


In the above EXAMPLE the attribute_id is 599, you must find out what YOUR attribute ID is.

The reason you should use SQL like this to perform the task as opposed to ORM is because using ORM across your whole catalog selection will probably be quite time & resource intensive, this script on the other hand will function very efficiently.

You'll need to make this attribute visible on your product template page as well. (https://stackoverflow.com/questions/3110076/magento-echo-attribute-on-product-page)

You'll also want to edit your default templates to reflect this value on the order confirmation/delivery & invoice email template (http://www.magentocommerce.com/boards/viewthread/15411/)

Good luck.

  • Thanks moose. But I need, customer can choose delivery date option as they prefer
    – Helphin
    Feb 4, 2014 at 6:53
  • Ah, in that case I would just go the route of adding another flat delivery rate using brackets you'd be interested in, for example: Delivery within 1 - 2 business days Delivery within 2 - 3 business days ETC. The customer can then select this on checkout and you can charge appropriately.
    – Moose
    Feb 4, 2014 at 7:51
  • i wants to choose date of shipping, not the shipping methods, and also this should be done in product page not in checkout page.
    – Helphin
    Feb 4, 2014 at 8:16
  • @Helphin, so you'd like your customers to be able to place a single order with multiple different dispatch dates? I.E Product A, B & C dispatched on Tuesday, Thursday & Friday?
    – Moose
    Feb 4, 2014 at 8:23
  • yes, that's right.
    – Helphin
    Feb 4, 2014 at 8:27

Simple answer from my end.

Use Custom option, in admin panel, open the product, last option on left side is CUSTOM OPTION. over their use date and time or just date as per your wish and thats it. you are done.

  • for each products adding the custom option is not be good solution.
    – Helphin
    Feb 4, 2014 at 10:14
  • i know but these is the simplest solution. another method is to create one input text and create and observer for when product is added to cart. over there if you will check the posted data you will find the value for your input text. long back i had implemented this, good luck Feb 4, 2014 at 10:37
  • how to get posted data in cart/checkout page?
    – Helphin
    Feb 4, 2014 at 10:42
  • i dint said on cart/checkout page, i meant in observer you can learn to create an observer from snipplr.com/view/56959 and the use these event checkout_cart_add_product_complete Feb 4, 2014 at 10:45

You can use Custom option as mentioned by deepak mallah, if you have to add it to all your products, a little code can do the work for you,

Get all products, or products of a category, while fetching the collection foreach product create the custom option assign it and save product


    //You may want to add the custom option only for a specific product type
    //if($productType=='configurable' or $productType=='simple')
        $title='The title you want the sow';            
        $option['values'] = array(
                        'type' => 'date_time', // you can choose date or date_time or time
                        'is_require' => 0, //
                        'sku' => '',
                        'sort_order' => 0,
                        'default_title' => $title,
                        'store_title' => $title,
                        'title' => $title,
                        'default_price' => 0,
                        'default_price_type' => 'fixed',
                        'store_price' => 0,
                        'store_price_type' => 'fixed',
                        'price' => 0,
                        'price_type' => 'fixed'                                 


The code can be used in a simple external php file and can be executed from browser

  • thanks for your answer. for large volume. this shows timeout error, also when import new products this may not set to them.
    – Helphin
    Feb 5, 2014 at 4:59
  • You may set a count in the collection to add custom option for each 100 products and so on. You can set custom option when you import new products by adding some extra columns and values in the csv file, or maybe this can be done using an observer, called in the event 'catalog_product_prepare_save'
    – Deithso
    Feb 5, 2014 at 15:44

Your Answer

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

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