Re: Order Delivery Date Support Thread
Quote:
Originally Posted by
pjdub
The order_delivery_date calendar is working on the site and the selected delivery date appears in the email confirmation. However it does not get written to the database. The database values are all "0000-00-00". There has been a mod(not by me)to the original date format into the European d-m-y format. I am assuming that when zen cart attempts to write this date mysql does not like it and hence the 0000-00-00 values. I have looked around but can not find where the sql insert statement is performed. I am hoping to reformat the date data there and solve the problem. Can anyone tell me where the insert can be found. Perhaps it's not an insert... Thanks in advance
Yes, MySQL is particular about the format of data being inserted into DATE or DATETIME fields. It expects information to be entered in UTF, YYYY-MM-DD (or YYYY-MM-DD HH:MM:SS), but can accept some other formats.
I do not know what has been edited or where when you converted dates to DD-MM-YYYY format for display, but you will want to convert it back to YYYY-MM-DD format for the insert statement. If a new variable was created for the new date format, then the easiest way to do this would be to use the original variable for the insert statement.
Re: Order Delivery Date Support Thread
I gather that no version was ever put out that made the order date required on the shipping page. I went thru a number of php hoops trying to get something done with Dr. Byte's help and got no where. I'm thinking it has to be added to the javascript. Any one have any experience with this or has anyone figured out any way to make the date required?
Not having it required is what then gives you bizarre delivery dates in admin - the emails are probably being sent out without any delivery date at all.
I believe when I posted the newest version back in October that I didn't use the correct mootools. Has anyone had any problems with that version?
If someone will help with the required delivery date, I'll be glad to upload that as well.
Re: Order Delivery Date Support Thread
Quote:
Originally Posted by
weif
Yes, MySQL is particular about the format of data being inserted into DATE or DATETIME fields. It expects information to be entered in UTF, YYYY-MM-DD (or YYYY-MM-DD HH:MM:SS), but can accept some other formats.
I do not know what has been edited or where when you converted dates to DD-MM-YYYY format for display, but you will want to convert it back to YYYY-MM-DD format for the insert statement. If a new variable was created for the new date format, then the easiest way to do this would be to use the original variable for the insert statement.
Thanks for the reply Weif. I persisted and found that the following works for what I require:
In includes\classes\order.php in the $sql_data_array around line 600
change
'order_delivery_date' => $this->info['order_delivery_date']
to
'order_delivery_date' => date("Y-m-d", strtotime($this->info['order_delivery_date']))
This worked for me. Dates are being written to the database in yyyy-mm-dd format and elsewhere the european formatting persists (not done by me so can't detail how it was done) Obviously this has nothing to do with null values nor no values being submitted in the delivery date. A problem for another day...
Re: Order Delivery Date Support Thread
As to having the delivery date required - in includes/modules/checkout_shipping.php
change
//BEGIN Order Delivery Date
if (zen_not_null($_POST['order_delivery_date'])) {
$_SESSION['order_delivery_date'] = zen_db_prepare_input($_POST['order_delivery_date']);
}
$order_delivery_date = $_SESSION['order_delivery_date'];
// END Order Delivery Date
to
//BEGIN Order Delivery Date
if (zen_not_null($_POST['order_delivery_date'])) {
$_SESSION['order_delivery_date'] = zen_db_prepare_input($_POST['order_delivery_date']);
} else {
$messageStack->add_session('checkout_shipping', ERROR_PLEASE_CHOOSE_DELIVERY_DATE, 'error');
zen_redirect(zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
}
$order_delivery_date = $_SESSION['order_delivery_date'];
// END Order Delivery Date
Add the error to the includes/language/english/your-template/checkout_shipping.php:
define('ERROR_PLEASE_CHOOSE_DELIVERY_DATE', 'Please choose a delivery date');
Re: Order Delivery Date Support Thread
I have updated the mod and included a database setting to require or not require the delivery date. Also included the mootools version that works with IE9. I uploaded it to the plugins section a few minutes ago so it will take a little while to show up there.
1 Attachment(s)
Re: Order Delivery Date Support Thread
Hi, I have a problem with this plugin.
I downloaded the last version (2.4) and it works fine the first time. Then I cannot see the calendar image on the checkout shipping page.
I had the previous version (2.3.2) and i didn't have any problem.
I test it on Internet Explorer 8 and Google Chrome 23.0.1271.97.
Please help me. I have to publish my site as soon as possible.
Thanks in advance.Attachment 11669
Re: Order Delivery Date Support Thread
The first time? Are you staying logged in, not finished the order, refreshing the page? How are you doing a second time?
Re: Order Delivery Date Support Thread
The first time I put an order in my site without any problem. The calendar image appears on the checkout shipping page.
Then when I wanted to put another order, the calendar icon doesn't appear, so the order couldn't be finished.
I tried to solve it refreshing the page, login again, deleting my browsing history and finally re-installing the plugin but those actions didn't solve the problem.
My hosting is in godaddy and it is on Linux.
Re: Order Delivery Date Support Thread
That is truly strange and I can't think of a reason why that would happen. It's just a javascript popup. I added in the database option to require it or not. Did you install that sql and make a choice? Just covering the bases of installation here.
1 Attachment(s)
Re: Order Delivery Date Support Thread
Quote:
Originally Posted by
delia
That is truly strange and I can't think of a reason why that would happen. It's just a javascript popup. I added in the database option to require it or not. Did you install that sql and make a choice? Just covering the bases of installation here.
Yes, I install the sql required, so now I can set if delivery date is required or not. Attachment 11672