As a quick solution: update this file to have your attribute, then run once in one of your controllers this code:
This will update your EAV configuration to have your attribute.
$setup = Mage::getModel('sales/entity_setup');
I found an even quicker solution… just open this page in my browser : http://localhost/magento/checkout/test/createEntities/ ... So what is my next step?… doing some validation of course!
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);
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…