|
|||||||
| Addon Shipping Modules Discussion of addon Shipping modules not built-in to Zen Cart |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Zenner
Join Date: Apr 2007
Location: Nijmegen, Netherlands
Posts: 44
|
Desciption how to add a drop down list with desired delivery date to your order form [for Zen Cart 1.3.7]
Note: in the following description I use the table prefix zen_ If you have no prefix, or another then you'll have to change it yourself. The file & directory names were taken from a local Win XP + XAMPP environment. At linux webhosting all "\" should be the other way "/" ![]() Note2: I have to check the email confirmation. The desired order date seems to be missing in the email confirmation. 1. Add field to zen_orders table Code:
ALTER TABLE zen_orders ADD order_delivery_date date AFTER ip_address; * FRONT-END * 2. tpl_checkout_shipping_default.php File: includes\templates\classic\templates\tpl_checkout_shipping_default.php In the checkout form I added a dropdown field with dates. Note that I excluded some dates (1st & 2nd Christmas day and 1st January) because there won't be any deliveries. Just before <fieldset class="shipping" id="comments"> I added: Code:
<fieldset class="shipping" id="delivery_date">
<legend><?php echo TABLE_HEADING_DELIVERY_DATE; ?></legend>
<select name="delivery_date">
<?php
for ($i=0, $n=50; $i < $n; $i++) {
$now[$i] = strtotime ("+$i day", time());
if ( strftime ("%w",$now[$i])<>0
AND strftime ("%m-%d",$now[$i])<>"12-25"
AND strftime ("%m-%d",$now[$i])<>"12-26"
AND strftime ("%m-%d",$now[$i])<>"01-01"
){
echo '<option value="'.strftime ("%Y-%m-%d",$now[$i]).'">'.strftime ("%A %d %B %Y",$now[$i]).'</option>';
}
}
?>
</select>
</fieldset>
File: \includes\classes\order.php I added the order_delivery_date field in some queries: Code:
$order_query = "select customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, payment_module_code, shipping_method, shipping_module_code, coupon_code, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified, order_total, order_tax, ip_address from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'"; Code:
date_purchased, orders_status, last_modified, order_total, order_tax, ip_address, order_delivery_date from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'"; Code:
$this->info = array('currency' => $order->fields['currency'],
'currency_value' => $order->fields['currency_value'],
'payment_method' => $order->fields['payment_method'],
'payment_module_code' => $order->fields['payment_module_code'],
'shipping_method' => $order->fields['shipping_method'],
'shipping_module_code' => $order->fields['shipping_module_code'],
'coupon_code' => $order->fields['coupon_code'],
'cc_type' => $order->fields['cc_type'],
'cc_owner' => $order->fields['cc_owner'],
'cc_number' => $order->fields['cc_number'],
'cc_expires' => $order->fields['cc_expires'],
'date_purchased' => $order->fields['date_purchased'],
'orders_status' => $order_status->fields['orders_status_name'],
'last_modified' => $order->fields['last_modified'],
'total' => $order->fields['order_total'],
'tax' => $order->fields['order_tax'],
'ip_address' => $order->fields['ip_address']
);
Code:
'ip_address' => $order->fields['ip_address'], 'delivery_date' => $order->fields['delivery_date'] ); Code:
$this->info = array('order_status' => DEFAULT_ORDERS_STATUS_ID,
'currency' => $_SESSION['currency'],
'currency_value' => $currencies->currencies[$_SESSION['currency']]['value'],
'payment_method' => $GLOBALS[$class]->title,
'payment_module_code' => $GLOBALS[$class]->code,
'coupon_code' => $coupon_code->fields['coupon_code'],
// 'cc_type' => (isset($GLOBALS['cc_type']) ? $GLOBALS['cc_type'] : ''),
// 'cc_owner' => (isset($GLOBALS['cc_owner']) ? $GLOBALS['cc_owner'] : ''),
// 'cc_number' => (isset($GLOBALS['cc_number']) ? $GLOBALS['cc_number'] : ''),
// 'cc_expires' => (isset($GLOBALS['cc_expires']) ? $GLOBALS['cc_expires'] : ''),
// 'cc_cvv' => (isset($GLOBALS['cc_cvv']) ? $GLOBALS['cc_cvv'] : ''),
'shipping_method' => $_SESSION['shipping']['title'],
'shipping_module_code' => $_SESSION['shipping']['id'],
'shipping_cost' => $_SESSION['shipping']['cost'],
'subtotal' => 0,
'tax' => 0,
'total' => 0,
'tax_groups' => array(),
'comments' => (isset($_SESSION['comments']) ? $_SESSION['comments'] : ''),
'ip_address' => $_SESSION['customers_ip_address'] . ' - ' . $_SERVER['REMOTE_ADDR']
);
Code:
'ip_address' => $_SESSION['customers_ip_address'] . ' - ' . $_SERVER['REMOTE_ADDR'], 'delivery_date' => $_SESSION['delivery_date'] ); Code:
'ip_address' => $_SESSION['customers_ip_address'] . ' - ' . $_SERVER['REMOTE_ADDR']
);
zen_db_perform(TABLE_ORDERS, $sql_data_array);
Code:
'ip_address' => $_SESSION['customers_ip_address'] . ' - ' . $_SERVER['REMOTE_ADDR'],
'delivery_date' => $this->info['delivery_date']
);
zen_db_perform(TABLE_ORDERS, $sql_data_array);
File: \includes\modules\pages\checkout_shipping\header_php.php I added some lines of code after: Code:
if (isset($_SESSION['comments'])) {
$comments = $_SESSION['comments'];
}
Code:
if (isset($_SESSION['delivery_date'])) {
$delivery_date = $_SESSION['delivery_date'];
}
Code:
$comments = $_SESSION['comments']; Code:
if (zen_not_null($_POST['delivery_date'])) {
$_SESSION['delivery_date'] = zen_db_prepare_input($_POST['delivery_date']);
}
$delivery_date = $_SESSION['delivery_date'];
File: \includes\languages\english\checkout_shipping.php For every language you'll have to insert: Code:
define('TABLE_HEADING_DELIVERY_DATE', 'Desired Delivery Date');
6. order.php File: \admin\includes\classes\order.php I added to: Code:
$order = $db->Execute("select cc_cvv, customers_name, customers_company, customers_street_address,
customers_suburb, customers_city, customers_postcode, customers_id,
customers_state, customers_country, customers_telephone,
customers_email_address, customers_address_format_id, delivery_name,
delivery_company, delivery_street_address, delivery_suburb,
delivery_city, delivery_postcode, delivery_state, delivery_country,
delivery_address_format_id, billing_name, billing_company,
billing_street_address, billing_suburb, billing_city, billing_postcode,
billing_state, billing_country, billing_address_format_id,
coupon_code, payment_method, payment_module_code, shipping_method, shipping_module_code,
cc_type, cc_owner, cc_number, cc_expires, currency,
currency_value, date_purchased, orders_status, last_modified,
order_total, order_tax, ip_address
Code:
order_total, order_tax, ip_address, order_delivery_date Code:
$this->info = array('currency' => $order->fields['currency'],
'currency_value' => $order->fields['currency_value'],
'payment_method' => $order->fields['payment_method'],
'payment_module_code' => $order->fields['payment_module_code'],
'shipping_method' => $order->fields['shipping_method'],
'shipping_module_code' => $order->fields['shipping_module_code'],
'coupon_code' => $order->fields['coupon_code'],
'cc_type' => $order->fields['cc_type'],
'cc_owner' => $order->fields['cc_owner'],
'cc_number' => $order->fields['cc_number'],
'cc_cvv' => $order->fields['cc_cvv'],
'cc_expires' => $order->fields['cc_expires'],
'date_purchased' => $order->fields['date_purchased'],
'orders_status' => $order->fields['orders_status'],
'total' => $order->fields['order_total'],
'tax' => $order->fields['order_tax'],
'last_modified' => $order->fields['last_modified'],
'ip_address' => $order->fields['ip_address']
);
Code:
'ip_address' => $order->fields['ip_address'], 'delivery_date' => $order->fields['order_delivery_date'] ); File: \admin\orders.php I changed: Code:
EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($check_status->fields['date_purchased']) . "\n\n" . strip_tags($notify_comments) . Code:
EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($check_status->fields['date_purchased']) . "\n\n" . EMAIL_TEXT_DELIVERY_DATE . ' ' . zen_date_long($check_status->fields[' delivery_date']) . "\n\n" . strip_tags($notify_comments) . Code:
$html_msg['EMAIL_TEXT_DATE_ORDERED'] = EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($check_status->fields['date_purchased']); $html_msg['EMAIL_TEXT_STATUS_COMMENTS'] = nl2br($notify_comments); Code:
$html_msg['EMAIL_TEXT_DATE_ORDERED'] = EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($check_status->fields['date_purchased']); $html_msg['EMAIL_TEXT_DELIVERY_DATE'] = EMAIL_TEXT_DELIVERY_DATE . ' ' . zen_date_long($check_status->fields['delivery_date']); $html_msg['EMAIL_TEXT_STATUS_COMMENTS'] = nl2br($notify_comments); Code:
<tr>
<td class="main"><strong><?php echo ENTRY_DATE_PURCHASED; ?></strong></td>
<td class="main"><?php echo zen_date_long($order->info['date_purchased']); ?></td>
</tr>
Code:
<tr>
<td class="main"><strong><?php echo ENTRY_DATE_PURCHASED; ?></strong></td>
<td class="main"><?php echo zen_date_long($order->info['date_purchased']); ?></td>
</tr>
<tr>
<td class="main"><strong><?php echo ENTRY_DELIVERY_DATE; ?></strong></td>
<td class="main"><?php echo zen_date_long($order->info['delivery_date']); ?></td>
</tr>
Code:
<td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_DATE_PURCHASED; ?></td>
<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_STATUS; ?></td>
Code:
<td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_DATE_PURCHASED; ?></td>
<td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_DELIVERY_DATE; ?></td>
<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_STATUS; ?></td>
Code:
<td class="dataTableContent" align="center"><?php echo zen_datetime_short($orders->fields['date_purchased']); ?></td>
<td class="dataTableContent" align="right"><?php echo $orders->fields['orders_status_name']; ?></td>
Code:
<td class="dataTableContent" align="center"><?php echo zen_datetime_short($orders->fields['date_purchased']); ?></td>
<td class="dataTableContent" align="center"><?php echo zen_datetime_short($orders->fields['order_delivery_date']); ?></td>
<td class="dataTableContent" align="right"><?php echo $orders->fields['orders_status_name']; ?></td>
Code:
$orders_query_raw = "select o.orders_id, o.customers_id, o.customers_name, o.payment_method, o.shipping_method, o.date_purchased, o.last_modified, Code:
$orders_query_raw = "select o.orders_id, o.customers_id, o.customers_name, o.payment_method, o.shipping_method, o.date_purchased, o.order_delivery_date, o.last_modified, Code:
$orders_query_raw = "select o.orders_id, o.customers_id, o.customers_name, o.payment_method, o.shipping_method, o.date_purchased, o.last_modified, Code:
$orders_query_raw = "select o.orders_id, o.customers_id, o.customers_name, o.payment_method, o.shipping_method, o.date_purchased, o.order_delivery_date, o.last_modified, Code:
$orders_query_raw = "select o.orders_id, o.customers_id, o.customers_name, o.payment_method, o.shipping_method, o.date_purchased, o.last_modified, Code:
$orders_query_raw = "select o.orders_id, o.customers_id, o.customers_name, o.payment_method, o.shipping_method, o.date_purchased, o.order_delivery_date, o.last_modified, File: \admin\invoice.php I changed Code:
$order_check = $db->Execute("select cc_cvv, customers_name, customers_company, customers_street_address,
customers_suburb, customers_city, customers_postcode,
customers_state, customers_country, customers_telephone,
customers_email_address, customers_address_format_id, delivery_name,
delivery_company, delivery_street_address, delivery_suburb,
delivery_city, delivery_postcode, delivery_state, delivery_country,
delivery_address_format_id, billing_name, billing_company,
billing_street_address, billing_suburb, billing_city, billing_postcode,
billing_state, billing_country, billing_address_format_id,
payment_method, cc_type, cc_owner, cc_number, cc_expires, currency,
currency_value, date_purchased, orders_status, last_modified
Code:
currency_value, date_purchased, orders_status, last_modified, order_delivery_date Code:
<tr>
<td class="main"><strong><?php echo ENTRY_DATE_PURCHASED; ?></strong></td>
<td class="main"><?php echo zen_date_long($order->info['date_purchased']); ?></td>
</tr>
Code:
<tr>
<td class="main"><strong><?php echo ENTRY_DATE_PURCHASED; ?></strong></td>
<td class="main"><?php echo zen_date_long($order->info['date_purchased']); ?></td>
</tr>
<tr>
<td class="main"><strong><?php echo ENTRY_DELIVERY_DATE; ?></strong></td>
<td class="main"><?php echo zen_date_long($order->info['delivery_date']); ?></td>
</tr>
File: \admin\packingslip.php In: Code:
$order_check = $db->Execute("select cc_cvv, customers_name, customers_company, customers_street_address,
customers_suburb, customers_city, customers_postcode,
customers_state, customers_country, customers_telephone,
customers_email_address, customers_address_format_id, delivery_name,
delivery_company, delivery_street_address, delivery_suburb,
delivery_city, delivery_postcode, delivery_state, delivery_country,
delivery_address_format_id, billing_name, billing_company,
billing_street_address, billing_suburb, billing_city, billing_postcode,
billing_state, billing_country, billing_address_format_id,
payment_method, cc_type, cc_owner, cc_number, cc_expires, currency,
currency_value, date_purchased, orders_status, last_modified
Code:
currency_value, date_purchased, orders_status, last_modified, order_delivery_date Code:
<tr>
<td class="main"><strong><?php echo ENTRY_DATE_PURCHASED; ?></strong></td>
<td class="main"><?php echo zen_date_long($order->info['date_purchased']); ?></td>
</tr>
Code:
<tr>
<td class="main"><strong><?php echo ENTRY_DATE_PURCHASED; ?></strong></td>
<td class="main"><?php echo zen_date_long($order->info['date_purchased']); ?></td>
</tr>
<tr>
<td class="main"><strong><?php echo ENTRY_DELIVERY_DATE; ?></strong></td>
<td class="main"><?php echo zen_date_long($order->info['delivery_date']); ?></td>
</tr>
File: \includes\languages\english\orders.php add: Code:
define('TABLE_HEADING_DELIVERY_DATE', 'Desired Delivery Date');
define('ENTRY_DELIVERY_DATE', 'Desired Delivery Date:');
File: \includes\languages\english\invoice.php add: Code:
define('ENTRY_DELIVERY_DATE', 'Desired Delivery Date:');
File: \includes\languages\english\packingslip.php add: Code:
define('ENTRY_DELIVERY_DATE', 'Desired Delivery Date:');
|
|
|
|
|
|
#2 | |
|
New Zenner
Join Date: Apr 2007
Location: Nijmegen, Netherlands
Posts: 44
|
I am trying to send the desired delivery date in the email messages, but it's still not working.
Here follows a description for the changes I made so far. *** First of all I have change all references in the description above from delivery_date to order_delivery_date ! *** 13. email order status File \email\email_template_order_status.html changed: Code:
<div>$EMAIL_TEXT_DATE_ORDERED</div>
<div>$EMAIL_TEXT_STATUS_COMMENTS</div>
Quote:
14. order class File: \includes\classes\order.php Code:
EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n" .
EMAIL_TEXT_INVOICE_URL . ' ' . zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false) . "\n\n";
Code:
EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n" .
EMAIL_TEXT_DELIVERY_DATE . ' ' . zen_date_long($check_status->fields['order_delivery_date']) . "\n\n" .
EMAIL_TEXT_INVOICE_URL . ' ' . zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false) . "\n\n";
File: \includes\languages\english\checkout_process.php add Code:
define('EMAIL_TEXT_DELIVERY_DATE', 'Desired Delivery Date:');
File: \includes\languages\english\orders.php add Code:
define('EMAIL_TEXT_DELIVERY_DATE', 'Desired Delivery Date:');
17. order.php File: includes\classes\order.php Code:
EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n" .
EMAIL_TEXT_INVOICE_URL . ' ' . zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false) . "\n\n";
Code:
EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n" .
EMAIL_TEXT_DELIVERY_DATE . ' ' . zen_db_output($this->info['order_delivery_date']) . "\n\n" .
EMAIL_TEXT_INVOICE_URL . ' ' . zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false) . "\n\n";
Code:
$sql_data_array = array('orders_id' => $insert_id,
'orders_status_id' => $this->info['order_status'],
'date_added' => 'now()',
'customer_notified' => $customer_notification,
'comments' => $this->info['comments']);
Code:
$sql_data_array = array('orders_id' => $insert_id,
'orders_status_id' => $this->info['order_status'],
'date_added' => 'now()',
'order_delivery_date' => $this->info['order_delivery_date']);
'customer_notified' => $customer_notification,
'comments' => $this->info['comments']);
File: \admin\orders.php Code:
$check_status = $db->Execute("select customers_name, customers_email_address, orders_status,
date_purchased, order_delivery_date from " . TABLE_ORDERS . "
where orders_id = '" . $_GET['oID'] . "'");
Code:
$check_status = $db->Execute("select customers_name, customers_email_address, orders_status,
date_purchased, order_delivery_date from " . TABLE_ORDERS . "
where orders_id = '" . $_GET['oID'] . "'");
|
|
|
|
|
|
|
#3 |
|
New Zenner
Join Date: Apr 2007
Location: Nijmegen, Netherlands
Posts: 44
|
Ok, I had to make a couple of additional changes in order to get the confirmation email with date working correctly!
Sorry for the confusion! BTW: The email sent from the back-end (in admin/orders.php e.g. after change of status) does not contain the date. Instead there's an empty space.... Hopefully does someone else know a solution... 19. orders in back-end File: \admin\orders.php Code:
// adjust download_maxdays based on current date
$check_status = $db->Execute("select customers_name, customers_email_address, orders_status,
date_purchased, order_delivery_date from " . TABLE_ORDERS . "
where orders_id = '" . $_GET['oID'] . "'");
Code:
// adjust download_maxdays based on current date
$check_status = $db->Execute("select customers_name, customers_email_address, orders_status,
date_purchased from " . TABLE_ORDERS . "
where orders_id = '" . $_GET['oID'] . "'");
File: includes\classes\order.php Code:
$sql_data_array = array('orders_id' => $insert_id,
'orders_status_id' => $this->info['order_status'],
'date_added' => 'now()',
'order_delivery_date' => $this->info['order_delivery_date'],
'customer_notified' => $customer_notification,
'comments' => $this->info['comments']);
Code:
$sql_data_array = array('orders_id' => $insert_id,
'orders_status_id' => $this->info['order_status'],
'date_added' => 'now()',
'customer_notified' => $customer_notification,
'comments' => $this->info['comments']);
|
|
|
|
|
|
#4 |
|
New Zenner
Join Date: Oct 2007
Posts: 52
|
Thanks for posting this. I know alot of zenners have been waiting for someone to work this one out! I have a few questions.
|
|
|
|
|
|
#5 | ||||
|
New Zenner
Join Date: Apr 2007
Location: Nijmegen, Netherlands
Posts: 44
|
Quote:
thank you for your correction! Quote:
in the file tpl_checkout_shipping_default.php (See step 2. Front-end ) Remove the "%A" because it displays the "full weekday name according to the current locale" (see the php.net documentation for strftime at http://php.net/manual/en/function.strftime.php ) Quote:
Quote:
|
||||
|
|
|
|
|
#6 |
|
New Zenner
Join Date: Oct 2007
Posts: 52
|
A cancel date is usually coupled with a ship date in wholesale orders. That is - it is a window of time where the purchase can be shipped within. I guess it would just be a second field very much like order_delivery_date, but it would be order_cancel_date.
The only difference I see between the two fields would be that order_cancel_date could not take place before order_delivery_date. One other option in the drop down for order_cancel_date and should default to is empty which would indicate no cancel date. That would make sense for orders that are not wholesale and/or do not require a cancel ship date. Thanks, again! |
|
|
|
|
|
#7 |
|
New Zenner
Join Date: Feb 2008
Posts: 3
|
Hi guys,
Have you managed the confirmation email issue regarding this feature??
__________________
www.toko-indonesia.org |
|
|
|
|
|
#8 |
|
New Zenner
Join Date: Feb 2008
Posts: 5
|
Does anyone have a site that this mod is working on so I can see how it works?
|
|
|
|
|
|
#9 |
|
New Zenner
Join Date: Jul 2007
Posts: 19
|
I've tried this on 3.7.8 but it doesn't work.
Anyone tried this before? Thanks |
|
|
|
|
|
#10 |
|
New Zenner
Join Date: Mar 2008
Posts: 2
|
Based on this post and some others, I've posted net terms, start order date and start and cancel order date modules. You can find out more at Zen Cart Purchase Order System
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| fix the advanced search date from field | importprijs.nl | General Questions | 4 | 22nd October 2009 11:37 AM |
| can " “date of Birth” field in the registration form to be three drop down boxes "??? | lastpirate007 | Templates, Stylesheets, Page Layout | 9 | 24th July 2008 12:46 AM |
| add a shipping date field | chronister | Templates, Stylesheets, Page Layout | 5 | 16th February 2008 05:17 AM |