New Zenner
- Join Date:
- Apr 2011
- Location:
- England
- Posts:
- 16
- Plugin Contributions:
- 0
Quick status update [Addon]
Thanks for correcting my patch swguy
Yes, I guess $customer_notified and $comments were redundant.
Views: 15,466
New Zenner
Thanks for correcting my patch swguy
Yes, I guess $customer_notified and $comments were redundant.
Zen Follower
:clap:Thanks to swguy & slf3
Works beautifully :smile:
Administrator
Updated to support 1.5.0 and fix a bug in the creation of the status update form (missing end tag).
That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.
New Zenner
Anyway to just make it default to email customers? Once we get the order in we only update the status once to let the customer know it's shipped.
Even a starting point of how to code that myself would be much appreciated. You make some awesome addons BTW!:smile:
Administrator
Search down in orders.php for 'update_order'. This has the email logic; copy that back to the 'quick_status_update' case.
That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.
New Zenner
swguy:
Search down in orders.php for 'update_order'. This has the email logic; copy that back to the 'quick_status_update' case.
Totally works! Thanks! :smile:
In case anyone else needs to do this; all I had to do was pull everything from within the if/then block, and also grab the $check_status, from the same 'update_order' case, and paste it into the 'quick status update' block directly above it.
Viola! (this is from around line 80 or so).
// bof quick status update
case 'quick_status_update':
$oID = zen_db_prepare_input($_GET['oID']);
$status = zen_db_prepare_input($_POST['status']);
$check_status = $db->Execute("select customers_name, customers_email_address, orders_status,
date_purchased from " . TABLE_ORDERS . "
where orders_id = '" . (int)$oID . "'");
$notify_comments = '';
//send emails
$message =
EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n\n" .
//EMAIL_TEXT_INVOICE_URL . ' ' . zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n\n" .
EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($check_status->fields['date_purchased']) . "\n\n" .
strip_tags($notify_comments) .
EMAIL_TEXT_STATUS_UPDATED . sprintf(EMAIL_TEXT_STATUS_LABEL, $orders_status_array[$status] ) .
EMAIL_TEXT_STATUS_PLEASE_REPLY;
$html_msg['EMAIL_CUSTOMERS_NAME'] = $check_status->fields['customers_name'];
$html_msg['EMAIL_TEXT_ORDER_NUMBER'] = EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID;
//$html_msg['EMAIL_TEXT_INVOICE_URL'] = '<a href="' . zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') .'">'.str_replace(':','',EMAIL_TEXT_INVOICE_URL).'</a>';
$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);
$html_msg['EMAIL_TEXT_STATUS_UPDATED'] = str_replace('\n','', EMAIL_TEXT_STATUS_UPDATED);
$html_msg['EMAIL_TEXT_STATUS_LABEL'] = str_replace('\n','', sprintf(EMAIL_TEXT_STATUS_LABEL, $orders_status_array[$status] ));
$html_msg['EMAIL_TEXT_NEW_STATUS'] = $orders_status_array[$status];
$html_msg['EMAIL_TEXT_STATUS_PLEASE_REPLY'] = str_replace('\n','', EMAIL_TEXT_STATUS_PLEASE_REPLY);
zen_mail($check_status->fields['customers_name'], $check_status->fields['customers_email_address'], EMAIL_TEXT_SUBJECT . ' #' . $oID, $message, STORE_NAME, EMAIL_FROM, $html_msg, 'order_status');
$customer_notified = '1';
//send extra emails
if (SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO_STATUS == '1' and SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO != '') {
zen_mail('', SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO, SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . ' #' . $oID, $message, STORE_NAME, EMAIL_FROM, $html_msg, 'order_status_extra');
}
if ($oID) {
$db->Execute("update " . TABLE_ORDERS . "
set orders_status = '" . zen_db_input($status) . "', last_modified = now()
where orders_id = '" . (int)$oID . "'");
$db->Execute("insert into " . TABLE_ORDERS_STATUS_HISTORY . "
(orders_id, orders_status_id, date_added, customer_notified, comments)
values ('" . (int)$oID . "',
'" . zen_db_input($status) . "',
now(),
'0', '')");
}
zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('action')) . '', 'NONSSL'));
break;
// eof quick status update
Totally Zenned
I tried to run it with super order
Without success .
Totally Zenned
Search down in orders.php for 'update_order'. This has the email logic; copy that back to the 'quick_status_update' case.I assume you mean ALL the code, including the payment transaction feedback and the download timings...the previous post has ignored that.
I have used this, and it is working ok (including the message bar, which the original contribution code does not include)
// bof quick status update
case 'quick_status_update':
$oID = zen_db_prepare_input($_GET['oID']);
$status = zen_db_prepare_input($_POST['status']);
$check_status = $db->Execute("select customers_name, customers_email_address, orders_status,
date_purchased from " . TABLE_ORDERS . "
where orders_id = '" . (int)$oID . "'");
if ($check_status->fields['orders_status'] != $status) {
$db->Execute("update " . TABLE_ORDERS . "
set orders_status = '" . zen_db_input($status) . "', last_modified = now()
where orders_id = '" . (int)$oID . "'");
$customer_notified = '0';
// if (isset($_POST['notify']) && ($_POST['notify'] == '1')) {
$notify_comments = '';
/* if (isset($_POST['notify_comments']) && ($_POST['notify_comments'] == 'on') && zen_not_null($comments)) {
$notify_comments = EMAIL_TEXT_COMMENTS_UPDATE . $comments . "\n\n";
}*/
//send emails
$message = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . //steve
EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n\n" .
EMAIL_TEXT_INVOICE_URL . ' ' . zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n\n" .
EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($check_status->fields['date_purchased']) . "\n\n" .
strip_tags($notify_comments) .
EMAIL_TEXT_STATUS_UPDATED . sprintf(EMAIL_TEXT_STATUS_LABEL, $orders_status_array[$status] ) .
EMAIL_TEXT_STATUS_PLEASE_REPLY;
$html_msg['EMAIL_CUSTOMERS_NAME'] = $check_status->fields['customers_name'];
$html_msg['EMAIL_TEXT_ORDER_NUMBER'] = EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID;
$html_msg['EMAIL_TEXT_INVOICE_URL'] = '<a href="' . zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') .'">'.str_replace(':','',EMAIL_TEXT_INVOICE_URL).'</a>';
$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);
$html_msg['EMAIL_TEXT_STATUS_UPDATED'] = str_replace('\n','', EMAIL_TEXT_STATUS_UPDATED);
$html_msg['EMAIL_TEXT_STATUS_LABEL'] = str_replace('\n','', sprintf(EMAIL_TEXT_STATUS_LABEL, $orders_status_array[$status] ));
$html_msg['EMAIL_TEXT_NEW_STATUS'] = $orders_status_array[$status];
$html_msg['EMAIL_TEXT_STATUS_PLEASE_REPLY'] = str_replace('\n','', EMAIL_TEXT_STATUS_PLEASE_REPLY);
$html_msg['EMAIL_PAYPAL_TRANSID'] = '';
zen_mail($check_status->fields['customers_name'], $check_status->fields['customers_email_address'], EMAIL_TEXT_SUBJECT . ' #' . $oID, $message, STORE_NAME, EMAIL_FROM, $html_msg, 'order_status');
$customer_notified = '1';
// PayPal Trans ID, if any
$sql = "select txn_id, parent_txn_id from " . TABLE_PAYPAL . " where order_id = :orderID order by last_modified DESC, date_added DESC, parent_txn_id DESC, paypal_ipn_id DESC ";
$sql = $db->bindVars($sql, ':orderID', $oID, 'integer');
$result = $db->Execute($sql);
if ($result->RecordCount() > 0) {
$message .= "\n\n" . ' PayPal Trans ID: ' . $result->fields['txn_id'];
$html_msg['EMAIL_PAYPAL_TRANSID'] = $result->fields['txn_id'];
}
//send extra emails
if (SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO_STATUS == '1' and SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO != '') {
zen_mail('', SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO, SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . ' #' . $oID, $message, STORE_NAME, EMAIL_FROM, $html_msg, 'order_status_extra');
}
} elseif (isset($_POST['notify']) && ($_POST['notify'] == '-1')) {
// hide comment
$customer_notified = '-1';
}
$order_updated = true;
//}
$db->Execute("insert into " . TABLE_ORDERS_STATUS_HISTORY . "
(orders_id, orders_status_id, date_added, customer_notified, comments)
values ('" . (int)$oID . "',
'" . zen_db_input($status) . "',
now(),
'1',
'')");
$order_updated = true;
// trigger any appropriate updates which should be sent back to the payment gateway:
$order = new order((int)$oID);
if ($order->info['payment_module_code']) {
if (file_exists(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php')) {
require_once(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php');
require_once(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/payment/' . $order->info['payment_module_code'] . '.php');
$module = new $order->info['payment_module_code'];
if (method_exists($module, '_doStatusUpdate')) {
$response = $module->_doStatusUpdate($oID, $status, $comments, $customer_notified, $check_status->fields['orders_status']);
}
}
}
if ($order_updated == true) {
if ($status == DOWNLOADS_ORDERS_STATUS_UPDATED_VALUE) {
// adjust download_maxdays based on current date
$chk_downloads_query = "SELECT opd.*, op.products_id from " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " opd, " . TABLE_ORDERS_PRODUCTS . " op
WHERE op.orders_id='" . (int)$oID . "'
and opd.orders_products_id = op.orders_products_id";
$chk_downloads = $db->Execute($chk_downloads_query);
while (!$chk_downloads->EOF) {
$chk_products_download_time_query = "SELECT pa.products_attributes_id, pa.products_id, pad.products_attributes_filename, pad.products_attributes_maxdays, pad.products_attributes_maxcount
from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
WHERE pa.products_attributes_id = pad.products_attributes_id
and pad.products_attributes_filename = '" . $chk_downloads->fields['orders_products_filename'] . "'
and pa.products_id = '" . $chk_downloads->fields['products_id'] . "'";
$chk_products_download_time = $db->Execute($chk_products_download_time_query);
if ($chk_products_download_time->EOF) {
$zc_max_days = (DOWNLOAD_MAX_DAYS == 0 ? 0 : zen_date_diff($check_status->fields['date_purchased'], date('Y-m-d H:i:s', time())) + DOWNLOAD_MAX_DAYS);
$update_downloads_query = "update " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " set download_maxdays='" . $zc_max_days . "', download_count='" . DOWNLOAD_MAX_COUNT . "' where orders_id='" . (int)$oID . "' and orders_products_download_id='" . $_GET['download_reset_on'] . "'";
} else {
$zc_max_days = ($chk_products_download_time->fields['products_attributes_maxdays'] == 0 ? 0 : zen_date_diff($check_status->fields['date_purchased'], date('Y-m-d H:i:s', time())) + $chk_products_download_time->fields['products_attributes_maxdays']);
$update_downloads_query = "update " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " set download_maxdays='" . $zc_max_days . "', download_count='" . $chk_products_download_time->fields['products_attributes_maxcount'] . "' where orders_id='" . (int)$oID . "' and orders_products_download_id='" . $chk_downloads->fields['orders_products_download_id'] . "'";
}
$db->Execute($update_downloads_query);
$chk_downloads->MoveNext();
}
}
$messageStack->add_session(SUCCESS_ORDER_UPDATED, 'success');
} else {
$messageStack->add_session(WARNING_ORDER_NOT_UPDATED, 'warning');
}
//}
zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('action')) . '', 'NONSSL'));
break;
// eof quick status update
Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...
Totally Zenned
need merge orders.php with super_orders.php ?
It's not work.
Administrator
I only did it for orders, not super orders.
That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.
Zen Follower
Hi I've just installed this mod and am having a issue where it is not sending an email to customers ,when I change a status it does change but has the open lock instead of the green tick ... If I go into the order and send via there all works OK .Tried on 2 orders with same result.
I do use Fast easy checkout and have joined the 2 files together
File is to big to upload or load ..is there anything I should check for please
thanks
Administrator
Nothing to check - it does not send the email. It's "quick" after all. :)
That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.
Zen Follower
OK thanks ... I could have sworn it did ..used it a long time ago :)
New Zenner
At the moment we are working hard on modernising our workflow, and I think this module would be great!
Though, not sending e-mail is a problem for us. I don't have the knowledge, but maybe someone can make a config file or menu for this module.
With this we can enable e-mail, or enable the checkbox as visible, make a comment line. (For example, we use this to save our package numbers)
This will still be quicker than the extra click, and add a load of functionality. It should be integrated with ZC...
Totally Zenned
I've added optional email functionality...been meaning to post it up, I'll try and do that soon.
You can pm me with your email if you can't wait.
Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...
New Zenner
I was using this mod on the old version of ZC and had edited the code so that it sent the customer an email. I have tried to duplicated this function with the new ZC and mod and I can't get it to work. If anyone can assist me I would be very grateful.
Administrator
Quick Status Update has been updated for Zen Cart 1.5.2 and 1.5.3.
That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.
Administrator
Quick Status Update has been updated to Zen Cart 1.5.4.
That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.
Administrator
Quick Status Update has been updated to Zen Cart 1.5.5a.
That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.
Administrator
Quick Status Update has been updated for Zen Cart 1.5.6.
That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.
Tell staff why this post should be reviewed.