I’d like to let the customer add a delivery date (required) and a message field (and maybe a signature field) (one by product, or bettre one by shipment address (so multiple with multiple addresses))
How can I do this ??? I first thought about configurable products and specials attribute, but don’t feel like this is the answer
The message field should be added to Magento, hopefully by the end of the year. The delivery date sounds like something custom that will probably require some development on your side. Please follow the development process and watch out for documentations on customizing Magento.
The message feature will be a great thing to add. For the “Shipping date” feature I’ll do it by myself, because I understand that this is a too specific task for my project but can you give me some clue to add this.
I already took a look a the implementation, I think I’ll add the “shipping date” like we have the “shipping method”. Thanks to the magic use of __call function setter and getter are natively recognized…
I’ve changed the “Multishipping checkout shipping template” in order to add a date input for each address.
public function shippingPostAction() { $shippingMethods = $this->getRequest()->getPost('shipping_method'); // i've added this.... $shippingDates = $this->getRequest()->getPost('shipping_date');
try { $this->_getCheckout()->setShippingMethods($shippingMethods); // and i've added also this.... $this->_getCheckout()->setShippingDates($shippingDates);
Here is my new function (inserted just after existing setShippingMethods function inside Multishipping model)
public function setShippingDates($dates) { $addresses = $this->getQuote()->getAllShippingAddresses(); foreach ($addresses as $address) { if (isset($dates[$address->getId()]) && !empty($dates[$address->getId()])) { $address->setShippingDate($dates[$address->getId()]); //die($address->getShippingDate()); // this works as expected... but when calling this inside the template it doesn't work } elseif (!$address->getShippingDate()) { Mage::throwException(__('Please select shipping dates for all addresses')); } } // $addresses = $this->getQuote()->collectTotals()->save(); // not usefull because total price is not changed return $this; }
This seems (to me) to be correct but when calling $_address->getShippingDate() (inside the template), i get NULL value, can you give me a clue…
I’ll have to check that this date is given (because this is mandatory for my project) and of course this date should be in the future (i can add also check other things like that this date is not a sunday etc...)
I already checked that date is given in the setShippingDates($dates), (because it throw an exception if date is empty) but I’m not sure it’s the right place to do it. Maybe I should override the sefault setter (providen by __call magical) setShippingDate($date) and throw an exception if my validation fails.
What do you think of it?
Formating this date...(solved i think)
Another thing I’d like to know is about formating date in the shop depending of the L10N of the shop. Is there any helper to display the date in the right format (and of course convert from posting format to timestamp)? I’ve just found what i need in /magento/app/code/core/Mage/Core/Helper/Data.php
// in the template... <?= $this->formatDate($_address->getShippingDate(), Mage_Core_Model_Locale::FORMAT_TYPE_SHORT) ?>
// getting the right formatting before saving it to the db... $date = Mage::app()->getLocale()->date($dates[$address->getId()], Zend_Date::DATE_SHORT); $address->setShippingDate($date->toString('YYYY-MM-dd HH:mm:ss'));
Display shipping date in the backend...
Now that the shipping date is written in the db, i’d like to display it in the backend (and in the customer dashboard). I’ve found the template corresponding to /magento/admin/sales_order/view/order_id/7/ page, but I can’t achieve the display of this value… Furthermore in the list view I’d like to add a new input filter in order to sort orders by “shipping date”. But one thing at a time, let’s find a solution for the view…
// I tried... but NULL is given <? var_dump($_order->getShippingDate()) ?>
I guess that this attribute (shipping date) is saved for the quote but not for the order, so I should take a look in “importQuoteAddressAttributes(Mage_Sales_Model_Quote_Address $address)” function i guess… or can I touch this attribute with the help of ‘quote_address_id’ attribute of the order…
Help me to light my way , do I forgot/misunderstood something ?
I think I’ve made it, I just needed to add the shipping_date to the order (or order_address?) entity (like you’ve told me for quote_adress)…
Thank again for your help, and let me know if you think I forgot something…
I am following your footsteps on programming a delivery date at checkout. Basically ours is a flower shop and we want to capture a delivery date with order.
Were you successfully in implementing the entire piece i.e. date picker, storing into DB, validation, and backend display?
I am new to this product and having difficulties. Can you share your final code snippets or files here? This will be a great help.
I think a quick way may be to access the function that adds comments to orders. You could add the delivery date as a comment and send an updated order receipt to the customer. I know it’s a hack, but it may work.
I’m looking into adding a date field everywhere the gift message lives. There are quite a few files that need to be touched, but I’ll report back when I’ve got something or I’ve gone as far as I can.
Basically I’m doing a site wide search for anything that looks remotely related to gift message and duplicating it to make an “gift calendar”.
Well it has been a couple of days. This is a part time job for me (which means I can work as many hours as I want so long as it isn’t during my day job).
I’ve been copying/converting everything with the barest mention of “gift message” in it to have an exact duplicate called calendar. There are a ton of files and a good number of database tables that I’m going to need to touch. I’m not even sure if this is going to work. If it does, I’ll post as much about what I did as I can. If it doesn’t, I’ll be here begging for advice. Thanks for the well wishes. Can’t wait to see if it does anything or if it just blows a gasket. Even if it works, I’ll need to disentangle it from the standard code so I don’t lose it all when the next upgrade comes out. Like I said I’ll check in every few days and post progress.
Well my first cut didn’t fare so well. I took a few days off to regroup and tackled writing a shipping module. With that successfully under my belt I’m going to have another crack at adding a “gift” calendar to the checkout. I’ll keep you posted here in this thread.
This will update your EAV configuration to have your attribute.
I’m trying to work again on this feature but with current Magento version, things seems to have changed, when I try to install entities with this solution, I get an error (or something unusual :( )
Notice: Array to string conversion in /home/me/Zend/workspaces/DefaultWorkspace/MyShop/magento/app/code/core/Mage/Core/Model/Config.php on line 749
Can you help me, because things are getting so complicated right now :(