Jump to content
Latest News: (loading..)

Recommended Posts

Currently in osc 2.4 order update mails are sent in the same language as the language that is used by  the administrator who updates the order. Which is not good. is there a fix for this?

Share this post


Link to post
Share on other sites

@@burt

is this in the pipeline for 2.4 ?

i have some code to store the preferred language, but we do need to switch on the admin side to generate the email in the customer language


KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Share this post


Link to post
Share on other sites

@@bruyndoncx - no plans so far as I know. Propose it? And if you've code to share, even better!

Edited by burt

This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest current code (community-supported responsive 2.3.4.1BS Edge) here

 

Share this post


Link to post
Share on other sites

My code is based on this contribution

http://addons.oscommerce.com/info/6006


KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Share this post


Link to post
Share on other sites

@@burt

Sorry, I was confused - I also have the comment bar implemented on my admin/orders page, and that content depends on the interface used, the actual update mail I have language specific.

 

So, I have contribution 6006 , database language field and changes to checkout files and admin orders to show the customer language

 

further I have in admin/includes/english/orders.php following added for english and dutch


define('EMAIL_SEPARATOR_en', '------------------------------------------------------');
define('EMAIL_TEXT_SUBJECT_en', 'Order Update');
define('EMAIL_TEXT_ORDER_NUMBER_en', 'Order Number:');
define('EMAIL_TEXT_INVOICE_URL_en', 'Detailed Invoice:');
define('EMAIL_TEXT_DATE_ORDERED_en', 'Date Ordered:');
define('EMAIL_TEXT_STATUS_UPDATE_en', 'Your order has been updated to the following status.' . "\n\n" . 'New status: %s' . "\n\n" . 'Please reply to this email if you have any questions.' . "\n");
define('EMAIL_TEXT_COMMENTS_UPDATE_en', 'The comments for your order are' . "\n\n%s\n\n");
define('EMAIL_TEXT_SPECIAL_en', 'We have also have the following on special:');
define('EMAIL_TEXT_FOOTER_NEW_en','new');
define('EMAIL_TEXT_FOOTER_SPECIALS_en','specials');
define('EMAIL_TEXT_FOOTER_CONTACT_en','contact');
define('EMAIL_VERSION_LANGUAGE_en', 'English version');

define('EMAIL_SEPARATOR_nl', '------------------------------------------------------');
define('EMAIL_TEXT_SUBJECT_nl', 'Order Update');
define('EMAIL_TEXT_ORDER_NUMBER_nl', 'Ordernummer:');
define('EMAIL_TEXT_INVOICE_URL_nl', 'Gedetailleerde Bestelling:');
define('EMAIL_TEXT_DATE_ORDERED_nl', 'Orderdatum:');
define('EMAIL_TEXT_STATUS_UPDATE_nl', 'Uw order is aangepast naar de volgende status.' . "\n\n" . 'Nieuwe status: %s' . "\n\n" . 'Reageer s.v.p. op deze email als u nog vragen heeft.' . "\n");
define('EMAIL_TEXT_COMMENTS_UPDATE_nl', 'Het commentaar voor uw order is' . "\n\n%s\n\n");
define('EMAIL_TEXT_SPECIAL_nl', 'Wij hebben ook nog de volgende aanbieding:');
define('EMAIL_TEXT_FOOTER_NEW_nl','nieuw');
define('EMAIL_TEXT_FOOTER_SPECIALS_nl','promoties');
define('EMAIL_TEXT_FOOTER_CONTACT_nl','contact');
define('EMAIL_VERSION_LANGUAGE_nl', 'Nederlandse versie');
and in the admin/orders.php it is originally from epishire, but site no longer exists.

It also includes a product in the update email, and has some stuff hardcoded, but you have the essence of it all here.

 

      case 'update_order':
        $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);
        $status = tep_db_prepare_input($HTTP_POST_VARS['status']);
        $comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);

        $order_updated = false;
        $check_status_query = tep_db_query("select o.customers_name, o.customers_email_address, o.orders_status, o.date_purchased, customers_language from " . TABLE_ORDERS . " o left join " . TABLE_CUSTOMERS . " c on o.customers_id=c.customers_id where orders_id = '" . (int)$oID . "'");
        $check_status = tep_db_fetch_array($check_status_query);

        if ( ($check_status['orders_status'] != $status) || tep_not_null($comments)) {
          tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . tep_db_input($status) . "', last_modified = now() where orders_id = '" . (int)$oID . "'");

          $customer_notified = '0';
          if (isset($HTTP_POST_VARS['notify']) && ($HTTP_POST_VARS['notify'] == 'on')) {
		    $customers_language = $check_status['customers_language'];
			switch($customers_language) {
				case 'dutch':
					$customers_language = array('_nl');
					break;
				case 'english':
					$customers_language = array('_en');
					break;
				default:
					$customers_language = array('_nl','_en');
					break;
			}
			
			$epis_email = '';
			if(count($customers_language)>1) {
				$epis_email .= '<ul>';
				foreach($customers_language as $current_language) {
					$epis_email .= '<li><a href="#' . substr($current_language, -2) . '">' . constant(EMAIL_VERSION_LANGUAGE . $current_language) . '</a></li>' . "\n";
				}
				$epis_email .= "</ul>\n";
			}
			foreach($customers_language as $current_language)
			{
				if(count($customers_language)>1) {
					$epis_email .= '<a name="' . substr($current_language, -2) . '" />';
				}
	            $notify_comments = '';
	            if (isset($HTTP_POST_VARS['notify_comments']) && ($HTTP_POST_VARS['notify_comments'] == 'on')) {
	              $notify_comments = sprintf(constant(EMAIL_TEXT_COMMENTS_UPDATE . $current_language), $comments) . "\n\n";
	            }

	            //$email = STORE_NAME . "\n" . constant(EMAIL_SEPARATOR . $current_language) . "\n" . constant(EMAIL_TEXT_ORDER_NUMBER . $current_language) . ' ' . $oID . "\n" . constant(EMAIL_TEXT_INVOICE_URL . $current_language) . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n" . constant(EMAIL_TEXT_DATE_ORDERED . $current_language) . ' ' . tep_date_long($check_status['date_purchased']) . "\n\n" . $notify_comments . sprintf(constant(EMAIL_TEXT_STATUS_UPDATE . $current_language), $orders_status_array[$status]);

				// retrieve first product id, product name and product image that's on special
				$epis_one='1';	
				$specials_query_raw = tep_db_query("select specials.products_id from specials, products p where p.products_id = specials.products_id and p.products_image <> '' and products_image is not null and products_image <> 'nopicture.gif' and status= '" . $epis_one . "' order by specials_id desc limit 1");
				$specials_query = tep_db_fetch_array($specials_query_raw);
				$specials_id=$specials_query['products_id'];
				$products_query_raw = tep_db_query("select  pd.products_name, p.products_image from " . TABLE_PRODUCTS_DESCRIPTION  . " pd, ".  TABLE_PRODUCTS . " p where  pd.products_id = p.products_id and  pd.products_id = '" . $specials_id . "'");
				$products_query = tep_db_fetch_array($products_query_raw);
				$products_name=$products_query['products_name'];
				$products_image_id=$products_query['products_image'];
				$products_id=$products_query['products_id'];

				// build the link
				$products_link='<a href="'.HTTP_CATALOG_SERVER.'product_info.php?products_id='.$specials_id.'"><u>'.$products_name.'</u></a>';

				// build the image
//			$products_image='<img src="'.HTTP_CATALOG_SERVER.DIR_WS_CATALOG.'/images/'.$products_image_id.'">';
				$products_image='<img src="'.DIR_WS_CATALOG_IMAGES.$products_image_id.'">';

				// blankout EMAIL_TEXT_COMMENTS_UPDATE  if no comments made
				if($comments==NULL){
					$notify_comments=NULL;
				}
					
				// build the email	 
				$epis_email .= '<table align="center" cellspacing="10" style="font-size: 12px; font-family: Verdana, Arial, sans-serif; border: 1px solid #999999; color: #333333;width: 550px;">'
					.'<tr><td></td><td align="right" style="font-size: 28px; font-family: Verdana, Arial, sans-serif;margin-right: 10px;color: #999999;font-weight:bold; ">K E U K E N L U S T</td>'
					.'<tr><td align="left" colspan="2" bgcolor="f2f2f2">'.constant(EMAIL_TEXT_ORDER_NUMBER . $current_language) . $oID.'<br/>    '. constant(EMAIL_TEXT_DATE_ORDERED . $current_language) .' '.tep_date_short($check_status['date_purchased']).' ' . '<a href="'.tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL').'"><br/>'
					.'<u>'. constant(EMAIL_TEXT_INVOICE_URL . $current_language) .'</u></a><br/><br/></td></tr>'
					.'<tr><td align="left" colspan="2" ><i>'.sprintf(constant(EMAIL_TEXT_STATUS_UPDATE . $current_language), $orders_status_array[$status]).'</i><br/></td></tr>'  
					.'<tr><td align="left" colspan="2" ><br/>'. $notify_comments . '</td></tr>'
				    .'<tr><td align="left" colspan="2">' . constant(EMAIL_TEXT_SPECIAL . $current_language) . '<br/><hr/><br/></td></tr>'
				    .'<tr><td align="center" colspan="2">'.$products_image.'<br/>'.$products_link.'<br/><hr/><br/></td></tr>'
					.'<tr><td align="center" colspan="2" style="font-size: 10px;color: #666666;"><br/><a href="http://www.keukenlust.be/products_new.php'>http://www.keukenlust.be/products_new.php">' . constant(EMAIL_TEXT_FOOTER_NEW . $current_language) . '</a> | <a href="http://www.keukenlust.be/specials.php'>http://www.keukenlust.be/specials.php">' . constant(EMAIL_TEXT_FOOTER_SPECIALS . $current_language). '</a> | <a href="http://www.keukenlust.be/contact_us.php'>http://www.keukenlust.be/contact_us.php">'. constant(EMAIL_TEXT_FOOTER_CONTACT . $current_language).'</a><br/></td></tr>'
					.'<tr><td align="center" colspan="2" style="font-size: 10px;color: #666666;"><a href="http://www.keukenlust.be">KEUKENLUST</a> Hovestraat 1, 2370 Arendonk<br/></td></tr>'
				    .'</table>' . "\n";
			}
			// send the email	
			tep_mail($check_status['customers_name'], $check_status['customers_email_address'], constant(EMAIL_TEXT_SUBJECT . $current_language), $epis_email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
            //tep_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
            $customer_notified = '1';
          }

          tep_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . " (orders_id, orders_status_id, date_added, customer_notified, comments) values ('" . (int)$oID . "', '" . tep_db_input($status) . "', now(), '" . tep_db_input($customer_notified) . "', '" . tep_db_input($comments)  . "')");

          $order_updated = true;
        }

        if ($order_updated == true) {
         $messageStack->add_session(SUCCESS_ORDER_UPDATED, 'success');
        } else {
          $messageStack->add_session(WARNING_ORDER_NOT_UPDATED, 'warning');
        }

        tep_redirect(tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action')) . 'action=edit'));
        break;

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Share this post


Link to post
Share on other sites

OK, it gives me something to look at.  Thanks

 

I'll think on a way to do this, I have plans to take languages into .ini files - which will simplify things.

 

It's a project that is however very much low on the list of "to do" at this point.


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest current code (community-supported responsive 2.3.4.1BS Edge) here

 

Share this post


Link to post
Share on other sites

I wrote a dirty hack that stores language used by the customer when purchasing and then chooses the email text from admin. Just need to add another column to table orders and check its value when sending emails from admin.

Share this post


Link to post
Share on other sites

maybe it would be better not to add the language ID with order information, but with customer information? I think it would be more logical.

 

If customer registers on create account page the current language ID will be stored with hidden input field. If later the customer changes language, the ID will be updated in customer information(i don't know the name of the table)

Share this post


Link to post
Share on other sites

maybe it would be better not to add the language ID with order information, but with customer information? I think it would be more logical.

 

If customer registers on create account page the current language ID will be stored with hidden input field. If later the customer changes language, the ID will be updated in customer information(i don't know the name of the table)

That is how the contribution works

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Share this post


Link to post
Share on other sites

In my experience some customers register under main language and after that they change to their language I searched the daabase before doing this and found there was a lot of people who registered under the default language and then ended up using another one.

 

You can also add a new language after a customer registers so he will stay on his current language and can't change it.

Share this post


Link to post
Share on other sites

with the contribution, the customer can change his preferred language on the acouunt edit page


KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×