Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Mail Manager for OSC v2.3


npn2531

Recommended Posts

I have been working away like a madman, trying to get this thing squared away. But I needs some help...

I have Mail Manager installed in gBurton 2.3.4 Bootstrap.

There are some things that I am trying to iron out, and wondering if anyone can help out.

I have it hosted on GitHUB.

https://github.com/newburns/osCommerce-234-bootstrap-wADDONS

 

Primarily, it's this issue:

https://github.com/newburns/osCommerce-234-bootstrap-wADDONS/issues/16

Link to comment
Share on other sites

 if (file_exists(DIR_FS_CATALOG_MODULES.'mail_manager/order_confirm.php')){
		  include(DIR_FS_CATALOG_MODULES.'mail_manager/order_confirm.php'); 
		  }else{
		tep_mail($order->customer['name'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
	  }

It sounds like you are saying the issue is that the tep_mail command above initiates. Your code looks fine, the only thing I can see that would go wrong is that order_confirm.php is not being located.  I don't have this set up, but try something like this and see what happens:

 if (file_exists(DIR_FS_CATALOG_MODULES.'mail_manager/order_confirm.php')){
		  echo 'order_confirm found';
                  // include(DIR_FS_CATALOG_MODULES.'mail_manager/order_confirm.php'); 
		  }else{
		echo 'order_confirm not found';
                  //tep_mail($order->customer['name'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
	  }

I know this is a  bit simple, but I am not a professional and this is what I know to do. 

Oscommerce site:

 

 

OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120

Link to comment
Share on other sites

  • 4 months later...

I'm upgrading my site osc234 with BS.  This add on caught my eye and it seems to be on target with what I need for my company.  I see that the add on was last updated to the downloads on 4 Sept 2014 and a lot of work has been done to debug it since.  Is there a new add on with all the fixes some where ready to be down loaded?

Link to comment
Share on other sites

@@dculley

From what I uderstand, I should have all of the incorporated changes in my repo

https://github.com/newburns/osCommerce-234-bootstrap-wADDONS

 

Take a look at all of the issues posted before you go with this. There are some things yet to be fixed that are not related to this addon.

Still working on incorporating Mail Manager into the complete OSC and all it's components for emailing

Link to comment
Share on other sites

@@newburns

 

Thanks for getting back to me.  I have read all the commits.  That is why I have not installed it.  I can wait.  I haven't gone live with BS yet but getting close.  I wanted to get all the modifications done before bring over all the customers and inventory.

 

Please keep me on your radar and when it is ready let me know.

 

Dean

Link to comment
Share on other sites

  • 8 months later...

Step three of the instructions needs alteration:

3. Open catalog/includes/languages/english/checkout_process.php, add:
//Mail Manager define('EMAIL_TEXT_CONFIRM', 'has recommended');
define('TEXT_FROM', 'from');
Should be

3. Open catalog/includes/languages/english/checkout_process.php, add:
//Mail Manager definitions 
  define('EMAIL_TEXT_CONFIRM', 'has recommended');
  define('TEXT_FROM', 'from');

 

 

I think this instruction was supposed to be for catalog/includes/languages/english/tell_a_friend.php

 

Also, it results in a subject line that says that the recipient has recommended it!

 

ie, if A sends the recommendation to B, then it says "B has recommended..."!

 

I fixed this by changing line 25 of catalog/includes/modules/mail_manager/tell_a_friend.php from

$output_subject = $to_name.' ' .TEXT_RECOMMEND.' '. $product_info['products_name'].' '.TEXT_FROM.' '.STORE_NAME;
to

$output_subject = $from_name.' ' .TEXT_RECOMMEND.' '. $product_info['products_name'].' '.TEXT_FROM.' '.STORE_NAME;
as I think it makes more sense to have the originator in the subject anyway rather than the recipient.

 

Also to fix the product image in the recommendation email, I changed line 35 of this file from

$product_image = tep_image($image_urlfix.DIR_WS_IMAGES . $product_info['products_image_med'], $product_info['products_name'], '', '', '');
to

$product_image = tep_image($image_urlfix.DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], '', '', '');
Link to comment
Share on other sites

Also missing was the definition for EMAIL_TEXTHTML_STATUS_UPDATE. I added this to admin/includes/languages/english/orders.php:

define('EMAIL_TEXTHTML_STATUS_UPDATE', '<p>Your order has been updated to the following status.</p>' . "\n\n" . '<p>New status: <b>%s</b></p>' . "\n\n" . '<p>Please reply to this email if you have any questions.</p>' . "\n");
Link to comment
Share on other sites

  • 5 months later...
  • 1 year later...

Hello,

Changing the order status results in:


Warning: mail(): Multiple or malformed newlines found in additional_header in /home/x/public_html/x/admin/includes/classes/email.php on line 524

Warning: Cannot modify header information - headers already sent by (output started at /home/x/public_html/x/admin/includes/classes/email.php:524) in /home/x/public_html/x/admin/includes/functions/general.php on line 35

 

Anyone knows why this is happening?

 

It shows the that error and then the comments of the status is: The comments for your order are...

Edited by sinopia
edit
Link to comment
Share on other sites

It only shows in admin/orders.php when trying to change the status of the order (it changes but doesn't send the mail), I got this in languages:

 

define('EMAIL_TEXT_STATUS_UPDATE', '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', 'The comments for your order are' . "\n\n%s\n\n");

define('EMAIL_TEXTHTML_STATUS_UPDATE', '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");

I tried to remove the \n\n but didn't result due the class:

class emailMailManager extends email { 
  function add_html($html, $text = NULL, $images_dir = NULL) {
    $this->html = $html; //tep_convert_linefeeds(array("\r\n", "\n", "\r"), '<br>', $html);
    $this->html_text = tep_convert_linefeeds(array("\r\n", "\n", "\r"), $this->lf, $text);
  if (isset($images_dir)) $this->find_html_images($images_dir);
  }
}

Link to comment
Share on other sites

Interesting.. changing the template for order status actually let the mail work o_O

 

All others work fine with this template but when I choice to order_status use the same template than others it gets:

mail(): Multiple or malformed newlines found in additional_header in /home/xxx/public_html/xxx/admin/includes/classes/email.php on line 524

Which is:

return mail($to, $subject, $this->output, 'From: '.$from.$this->lf.implode($this->lf, $this->headers).$this->lf.implode($this->lf, $xtra_headers));

 

Just don't know why can't order_status use the same template than others.. others works fine.

Edited by sinopia
edit
Link to comment
Share on other sites

  • 2 years later...

Hello to all, do not know if anyone is still supporting this.

I am adapting Mail Manager to work with PHOENIX 1.0.5.5 and have now everything working beautifully except to show the products in the order confirmation. Apparently $products_ordered does not function in PHOENIX 1.0.5.5 whereas it does in PHOENIX 1.0.5.0. Any idea of what could have changed in the call to the products?

Link to comment
Share on other sites

That code is at https://github.com/gburton/CE-Phoenix/blob/master/includes/modules/notifications/templates/tpl_n_checkout.php#L27

But you might find it easier to go from the other direction.  What are the instructions for making Mail Manager display the products that used to work?  How did you install Mail Manager into checkout_process previously?  What are you trying to do now? 

Always back up before making changes.

Link to comment
Share on other sites

1 minute ago, ecartz said:

That code is at https://github.com/gburton/CE-Phoenix/blob/master/includes/modules/notifications/templates/tpl_n_checkout.php#L27

But you might find it easier to go from the other direction.  What are the instructions for making Mail Manager display the products that used to work?  How did you install Mail Manager into checkout_process previously?  What are you trying to do now? 

Hi Matt,

In n_checkout.php MM is added as follows and does send the order confirmation email in beautifully with html, just the products do not get listed

      $parameters = ['order' => $order, 'email' => &$email_order];
      echo $GLOBALS['OSCOM_Hooks']->call('siteWide', 'orderMail', $parameters);

      //tep_mail($order->customer['name'], $order->customer['email_address'], MODULE_NOTIFICATIONS_CHECKOUT_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
    //*******start mail manager****************//
    if (file_exists('includes/modules/mail_manager/order_confirm.php')){
    include('includes/modules/mail_manager/order_confirm.php');
    }else{
      tep_mail($order->customer['name'], $order->customer['email_address'], MODULE_NOTIFICATIONS_CHECKOUT_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
    }
    //*******end mail manager*****************//

 

In the Mail Manager file includes/modules/mail_manager/order_confirm.php the code is :

<?php
/*
order_confirm.php, 2011
mail manager for oscommerce
Copyright (c) 2011 Niora http://www.css-oscommerce.com
Released under the GNU General Public License
*/
//get status of mail manager create account  email
$mail_manager_status_query = tep_db_query("select status, template, htmlcontent, txtcontent from mm_responsemail where mail_id = '1'");
$mail_manager_status = tep_db_fetch_array($mail_manager_status_query);

//default to tep_mail if order_confirm mailpiece inactived in admin
if (isset($mail_manager_status['status']) && ($mail_manager_status['status'] == '1')) {         

// create the order totals variable
  foreach ($GLOBALS['order_totals'] as $order_total) {
    $mm_ordertotal .= strip_tags($order_total[$i]['title']) . ' ' . strip_tags($order_total['text']) . "\n".'<br/ >'; 
  }

//retrieve html and txt headers 
$header_query = tep_db_query("select htmlheader, htmlfooter, txtheader, txtfooter from mm_templates where title = '".$mail_manager_status['template']."'");
$header = tep_db_fetch_array($header_query);
 
//build email
$output_content_html = $header['htmlheader'].$mail_manager_status['htmlcontent'].$header['htmlfooter']; 
$output_content_txt = $header['txtheader'].$mail_manager_status['txtcontent'].$header['txtfooter']; 
$output_subject = EMAIL_TEXT_CONFIRM.STORE_NAME;

//define values for placeholder variables
$order_no = EMAIL_TEXT_ORDER_NUMBER . ' ' . $order->get_id();
$order_date = EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG);
$invoice_url = EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link('account_history_info.php', 'order_id=' . $order->get_id(), 'SSL', false);

$billing_address = $customer->make_address_label($billto, 0, '', '<br />');
$delivery_address = $customer->make_address_label($sendto, 0, '', '<br />');
$telephone = EMAIL_TEXT_TELEPHONE . ' ' . $order->customer['telephone'];
$email = EMAIL_TEXT_EMAIL_ADDRESS . ' ' . $order->customer['email_address'];
$order_comments = EMAIL_TEXT_COMMENTS . ' ' . $order->info['comments'];
$paymentmethod = $order->info['payment_method'];
$ccardtype = $order->info['cc_type'];
$payment_class = $payment_class->email_footer;

//define placeholders
$placeholders= ['$storeurl','$storename','$storeemail','$separator','$orderno','$orderdate','$invoiceurl','$productsorderedhead','$productsordered','$billingaddresshead','$billingaddress','$deliveryaddresshead','$deliveryaddress','$telephonehead','$telephone','$emailaddresshead','$email','$paymethodhead','$paymentmethod','$ccardtype','$ordercommentshead','$ordercomments','$totaltext','subtotaltext','$ordertotal'];
$values= [HTTP_SERVER, STORE_NAME, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SEPARATOR, $order_no, $order_date, $invoice_url, EMAIL_TEXT_PRODUCTS, $products_ordered, EMAIL_TEXT_BILLING_ADDRESS, $billing_address, EMAIL_TEXT_DELIVERY_ADDRESS, $delivery_address, EMAIL_TEXT_TELEPHONE, $telephone, EMAIL_TEXT_EMAIL_ADDRESS, $email, EMAIL_TEXT_PAYMENT_METHOD, $paymentmethod, $ccardtype, $order_comments, EMAIL_TEXT_TOTAL, EMAIL_TEXT_SUBTOTAL, $mm_ordertotal];
$output_content_html=str_replace($placeholders, $values, $output_content_html);
$output_content_txt=str_replace($placeholders, $values, $output_content_txt);

//send email      
tep_mm_sendmail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $output_subject, $output_content_html, $output_content_txt);
//send extra email to store owner       
tep_mm_sendmail($order->customer['firstname'] . ' ' . $order->customer['lastname'], STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $output_subject, $output_content_html, $output_content_txt);
//if mail manager status update email 'inactive' process normally via oscommerce
}else{
       tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
  }
?>

The confirmation email sent looks like this (footer reduced so the image won't take up to much room to show here). As you can see the only thing missing are the products :


 

test_order_1.jpg

Link to comment
Share on other sites

From where you are, the easiest way would probably be to change line 28 of tpl_n_checkout_.php from

    echo "\n" . $product['qty']

to

    $products_ordered .= "\n" . $product['qty']

and line 35 from

      $products_ordered_attributes .= "\n\t" . $attributes_values['option'] . ' ' . $attributes_values['value'];

to

      $products_ordered .= "\n\t" . $attributes_values['option'] . ' ' . $attributes_values['value'];

Although overall I think that copying n_checkout.php to n_checkout_mm.php, renaming the class and constants accordingly, and moving order-confirm into the module and template files would be better. 

The two times where the code says $order->customer['firstname'] . ' ' . $order->customer['lastname'] would be better as just $order->customer['name']. 

Always back up before making changes.

Link to comment
Share on other sites

4 minutes ago, ecartz said:

From where you are, the easiest way would probably be to change line 28 of tpl_n_checkout_.php from


    echo "\n" . $product['qty']

to


    $products_ordered .= "\n" . $product['qty']

and line 35 from


      $products_ordered_attributes .= "\n\t" . $attributes_values['option'] . ' ' . $attributes_values['value'];

to


      $products_ordered .= "\n\t" . $attributes_values['option'] . ' ' . $attributes_values['value'];

Although overall I think that copying n_checkout.php to n_checkout_mm.php, renaming the class and constants accordingly, and moving order-confirm into the module and template files would be better. 

The two times where the code says $order->customer['firstname'] . ' ' . $order->customer['lastname'] would be better as just $order->customer['name']. 

A bit overwhelmed! The file  tpl_n_checkout.php is not called by mail manager so I do not understand how the change would affect it… doing the rest goes beyond my competences unfortunately. It worked perfectly in 1.0.5.0

Link to comment
Share on other sites

15 minutes ago, artfulweb said:

In fact, tpl_n_checkout.php is only called for the extra order email which is not in HTML format so the above changes blitzes the products in the email to the owner.

The two aren't separate that way.  A more correct way to put it would be that the output from tpl_n_checkout.php is only used by the extra order email.  To fix that, you can add

echo $products_ordered;

either before or after the

//------insert customer chosen option eof ----

 

Always back up before making changes.

Link to comment
Share on other sites

1 minute ago, ecartz said:

The two aren't separate that way.  A more correct way to put it would be that the output from tpl_n_checkout.php is only used by the extra order email.  To fix that, you can add


echo $products_ordered;

either before or after the


//------insert customer chosen option eof ----

 

That is the way it is actually working as called for in n_checkout.php, mail manager only being called for the customer's order confirmation in HTML for using only the mail manager order_confirm, and the admin copy, not in HTML format uses the n_checkout.php and tpl_n_checkout.php

Link to comment
Share on other sites

After trying all the changes to tpl_n_checkout.php it is clear that changes have to be made instead to includes/modules/mail_manager/order_confirm.php so that it picks up the new way to call for products but I can not figure out what that is. If modifications are made to the tpl file the admin mail shows no products, only totals. As for attributes they have never shown in the emails on vanilla installs after 1.0.5.0.

Link to comment
Share on other sites

  • 2 weeks later...
On 3/26/2020 at 2:13 PM, artfulweb said:

After trying all the changes to tpl_n_checkout.php it is clear that changes have to be made instead to includes/modules/mail_manager/order_confirm.php so that it picks up the new way to call for products but I can not figure out what that is. If modifications are made to the tpl file the admin mail shows no products, only totals. As for attributes they have never shown in the emails on vanilla installs after 1.0.5.0.

Got it all figured out. Mod working perfectly now.

Link to comment
Share on other sites

  • 5 weeks later...

There is an error on line 34:

Quote

//------insert customer chosen option to order--------
    foreach (($product['attributes'] ?? []) as $attribute) {
      echo "\n\t" . $attributes_values['option'] . ' ' . $attributes_values['value'];

Should not this variable be "$attributes_values"?

 

Edited by kgtee
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...