Re: My Checkout Without Account Mod
Latest SQL version works perfectly - no problems, as far as I can see.
Just two minor points though:
Now there is no '.' at the end of the email address it's impossible to tell which are account and which are not - just be useful to know, really, and not that vital.
Order status add-on. If you check the status of an order there is a repeat of the email and order number input boxes at the bottom of the order status page. If you press the 'continue' button it takes you back to the previous email and order number input page with a logical error message about no input having been made. I assumed first time round that the 'Continue' button would take me back to the home page or something similar.
One final thing - we use PDFOrder Centre (Oops! Richie, I'm a Brit too!) which exhibits the same email problems as Super Orders - just thought you'd like to know.
Apart from that - Fantastic.
Re: My Checkout Without Account Mod
TPHoare,
This will partially address your post:
Code:
INSERT INTO query_builder ( query_id , query_category , query_name , query_description , query_string ) VALUES ( '', 'email,newsletters', 'Permanent Account Holders Only', 'Send email only to permanent account holders ', 'select customers_email_address, customers_firstname, customers_lastname from TABLE_CUSTOMERS where COWOA_account != true order by customers_lastname, customers_firstname, customers_email_address');
This will create a new category in your drop down, 'choose the group to e-mail this to' menu. I'll come out with an edit/overwrite for admin/customers.php that displays whether a customer is COWOA or permanent. These seem pretty essential, thanks for pointing them out. (;
I'm going to take a step back from template changes for the moment. In the meantime, however, if anybody has any changes that they feel make this a little more usable or such feel free to post them. And feel free to post requests as well. I'll get to them a bit later. (;
Thanks much,
Joe
PS: PDFOrder Center and Super Orders both seem like common mods. Now that I've got the SQL version running, I'll go ahead and post edits for these. I'll also post general edits for anything else that sends out mail.
Re: My Checkout Without Account Mod
Alright, I don't have Super Orders or PDF Order Center to test these on, but I've given the following a good eye and I think they should work. If you're using these, could you confirm that they work as they should or alternatively tell me if they don't?
Thanks much.
Super Orders
File: admin/includes/functions/extra_functions/super_orders_functions/
Find:
Code:
$customer_info = $db->Execute("SELECT customers_name, customers_email_address, date_purchased
FROM " . TABLE_ORDERS . "
WHERE orders_id = '" . $oID . "'");
Replace with:
Code:
$customer_info = $db->Execute("SELECT customers_name, customers_email_address, date_purchased, COWOA_account
FROM " . TABLE_ORDERS . "
WHERE orders_id = '" . $oID . "'");
Find:
Code:
// send email to customer
$message = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" .
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($customer_info->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'] = $customer_info->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($customer_info->fields['date_purchased']);
$html_msg['EMAIL_TEXT_STATUS_COMMENTS'] = $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);
Replace With:
Code:
// send email to customer
$message = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" .
EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n\n";
if(!$customer_info->fields['COWOA_account'])
$message .= EMAIL_TEXT_INVOICE_URL . ' ' . zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n\n";
$message .= EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($customer_info->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'] = $customer_info->fields['customers_name'];
$html_msg['EMAIL_TEXT_ORDER_NUMBER'] = EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID;
if(!$customer_info->fields['COWOA_account'])
$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>';
else
$html_msg['EMAIL_TEXT_INVOICE_URL'] = '';
$html_msg['EMAIL_TEXT_DATE_ORDERED'] = EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($customer_info->fields['date_purchased']);
$html_msg['EMAIL_TEXT_STATUS_COMMENTS'] = $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);
PDF Order Center
File: admin/pdfoc.php
Find:
Code:
$email .= "\n\n" .
$email_text_subject . ".\n\n" . PDFOC_EMAIL_SEPARATOR . "\n\n" .
PDFOC_EMAIL_TEXT_INVOICE_URL . ' ' . zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $orders->fields['orders_id'], 'SSL') . "\n" .
PDFOC_EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($order->info['date_purchased']) . "\n\n" . $notify_comments . PDFOC_EMAIL_SEPARATOR . "\n\n" .
PDFOC_EMAIL_IF_QUESTIONS . PDFOC_EMAIL_SIGNOFF . STORE_NAME . "\n\n" . PDFOC_EMAIL_SEPARATOR . "\n\n" .
EMAIL_DISCLAIMER;
$email_html['EMAIL_SUBJECT'] = "\n\n";
$email_html['EMAIL_MESSAGE_HTML'] = sprintf(PDFOC_EMAIL_SALUTATION,$order->customer['name']) . "\n\n" .
$email_text_subject . ".\n\n" . PDFOC_EMAIL_SEPARATOR . "\n\n" .
PDFOC_EMAIL_TEXT_INVOICE_URL . ' <a href="' . zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $orders->fields['orders_id'], 'SSL') . '">' . zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $orders->fields['orders_id'], 'SSL') . '</a>' . "\n" .
PDFOC_EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($order->info['date_purchased']) . "\n\n" . $notify_comments . PDFOC_EMAIL_SEPARATOR . "\n\n" .
PDFOC_EMAIL_IF_QUESTIONS . PDFOC_EMAIL_SIGNOFF . STORE_NAME . "\n\n" . PDFOC_EMAIL_SEPARATOR . "\n\n";
Replace With:
Code:
$customer_info = $db->Execute("SELECT COWOA_account
FROM " . TABLE_ORDERS . "
WHERE orders_id = '" . $oID . "'");
$email .= "\n\n" .
$email_text_subject . ".\n\n" . PDFOC_EMAIL_SEPARATOR . "\n\n";
if(!$customer_info->fields['COWOA_account'])
$email .= PDFOC_EMAIL_TEXT_INVOICE_URL . ' ' . zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $orders->fields['orders_id'], 'SSL') . "\n";
email .= PDFOC_EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($order->info['date_purchased']) . "\n\n" . $notify_comments . PDFOC_EMAIL_SEPARATOR . "\n\n" .
PDFOC_EMAIL_IF_QUESTIONS . PDFOC_EMAIL_SIGNOFF . STORE_NAME . "\n\n" . PDFOC_EMAIL_SEPARATOR . "\n\n" .
EMAIL_DISCLAIMER;
$email_html['EMAIL_SUBJECT'] = "\n\n";
$email_html['EMAIL_MESSAGE_HTML'] = sprintf(PDFOC_EMAIL_SALUTATION,$order->customer['name']) . "\n\n" .
$email_text_subject . ".\n\n" . PDFOC_EMAIL_SEPARATOR . "\n\n";
if(!$customer_info->fields['COWOA_account'])
$email_html['EMAIL_MESSAGE_HTML'] .= PDFOC_EMAIL_TEXT_INVOICE_URL . ' <a href="' . zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $orders->fields['orders_id'], 'SSL') . '">' . zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $orders->fields['orders_id'], 'SSL') . '</a>' . "\n";
$email_html['EMAIL_MESSAGE_HTML'] .= PDFOC_EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($order->info['date_purchased']) . "\n\n" . $notify_comments . PDFOC_EMAIL_SEPARATOR . "\n\n" .
PDFOC_EMAIL_IF_QUESTIONS . PDFOC_EMAIL_SIGNOFF . STORE_NAME . "\n\n" . PDFOC_EMAIL_SEPARATOR . "\n\n";
Re: My Checkout Without Account Mod
Fraid I get this error PDFOrder Center pdfoc.php:
Parse error: syntax error, unexpected T_CONCAT_EQUAL in line 392
Line 392 is:
email .= PDFOC_EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($order->info['date_purchased']) . "\n\n" . $notify_comments . PDFOC_EMAIL_SEPARATOR . "\n\n" .
I am hopeless with php so am not much help I am afraid
Re: My Checkout Without Account Mod
Ammendment to code above
For PDF Order Center. Replace With block should read:
Code:
$customer_info = $db->Execute("SELECT COWOA_account
FROM " . TABLE_ORDERS . "
WHERE orders_id = '" . $oID . "'");
$email .= "\n\n" .
$email_text_subject . ".\n\n" . PDFOC_EMAIL_SEPARATOR . "\n\n";
if(!$customer_info->fields['COWOA_account'])
$email .= PDFOC_EMAIL_TEXT_INVOICE_URL . ' ' . zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $orders->fields['orders_id'], 'SSL') . "\n";
$email .= PDFOC_EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($order->info['date_purchased']) . "\n\n" . $notify_comments . PDFOC_EMAIL_SEPARATOR . "\n\n" .
PDFOC_EMAIL_IF_QUESTIONS . PDFOC_EMAIL_SIGNOFF . STORE_NAME . "\n\n" . PDFOC_EMAIL_SEPARATOR . "\n\n" .
EMAIL_DISCLAIMER;
$email_html['EMAIL_SUBJECT'] = "\n\n";
$email_html['EMAIL_MESSAGE_HTML'] = sprintf(PDFOC_EMAIL_SALUTATION,$order->customer['name']) . "\n\n" .
$email_text_subject . ".\n\n" . PDFOC_EMAIL_SEPARATOR . "\n\n";
if(!$customer_info->fields['COWOA_account'])
$email_html['EMAIL_MESSAGE_HTML'] .= PDFOC_EMAIL_TEXT_INVOICE_URL . ' <a href="' . zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $orders->fields['orders_id'], 'SSL') . '">' . zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $orders->fields['orders_id'], 'SSL') . '</a>' . "\n";
$email_html['EMAIL_MESSAGE_HTML'] .= PDFOC_EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($order->info['date_purchased']) . "\n\n" . $notify_comments . PDFOC_EMAIL_SEPARATOR . "\n\n" .
PDFOC_EMAIL_IF_QUESTIONS . PDFOC_EMAIL_SIGNOFF . STORE_NAME . "\n\n" . PDFOC_EMAIL_SEPARATOR . "\n\n";
TPHoare:
Thanks for catching this. I left out a '$'. On the line you pointed out, place a dollar sign just before 'email'.
--Joe
Re: My Checkout Without Account Mod
Hi Joe
Now I am getting this:
1054 Unknown column 'COWOA_account' in 'field list'
in:
[SELECT COWOA_account FROM orders WHERE orders_id = '49068']
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.
Cheers
Tim
Re: My Checkout Without Account Mod
You've got a PM. Rather than incrementally solve this on the board I should figure it out first. (;
--Joe
Re: My Checkout Without Account Mod
Hi Joe again - Have sorted out the error above - missing ' around 'COWOA_account' I think. Emails are being sent but they don't reflect the change of status - so status could be 'On Order' but email just has no subject and no content.
Re: My Checkout Without Account Mod
By the way, I'm personally not worried about sending emails from PDFOrder Center, because we very rarely, if ever, send bulk emails and much prefer to update status from the normal ZenCart order admin module. So, don't burn the midnight oil just on my account.
Re: My Checkout Without Account Mod
Hi Joe,
I downloaded the new version but haven't been able to take a look at it yet. I am wondering, for those of us who are using the old version... is it better to switch to the new version? I have had several orders placed using the old version and everything seems to be working great. In the long run, are there any problems you can think of if I just leave it the way it is? Or did you foresee future problems (perhaps with the period at the end of the email addresses) and that is why you made a new version? Much thanks again!