Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Email Invoice 1.0


Recommended Posts

Hello,

 

I have installed the latest email mod but am having issues with my logo being visible in the email. When I utilized the stock invoice.php <---that was included in the mod, it was giving me the same issue - red X image. I have attempted to make full URL changes with no luck. Does someone know how to resolve this issue?

 

Also, any plans on getting "Professional Invoice & Packaging Slip" contribution to work? I like that layout the best but for the life of me, I cannot get the body to look similar.

 

Thanks in advance,

 

Brad

 

 

In your e-mails, are they in HTML format? And if so, have you right-clicked on the missing image and chose properties? That will display the URL address for the image and you can see if it is correct or not.

 

Go to http://www.oscommerce.com/community/contributions,2861 for my version of the Professional Invoice & Packaging Slip.

L8r,

PopTheTop

 

Published osC Contributions:

- eCheck Payment Module v3.1

- Reviews in Product Display v2.0

- Fancier Invoice & Packingslip v6.1

- Admin Notes / Customer Notes v2.2

- Customer Zip & State Validation v2.2

- Search Box with Dropdown Category Menu v1.0

 

Pop your camper's top today!

It's a popup thing...

You wouldn't understand

Link to comment
Share on other sites

  • Replies 79
  • Created
  • Last Reply

Top Posters In This Topic

In your e-mails, are they in HTML format? And if so, have you right-clicked on the missing image and chose properties? That will display the URL address for the image and you can see if it is correct or not.

 

Go to http://www.oscommerce.com/community/contributions,2861 for my version of the Professional Invoice & Packaging Slip.

 

 

PopTheTop,

 

Yes, the emails are HTML format and the url the is visible when it shows /catalog/images/bwd_logo.gif and that is simply changing the image name - left the rest of the PHP file alone.

 

As far as your Fancier Invoicing contribution - I like it and all but the main issue I have with using it is that it does not support any PayPal IPN contributions. I currently have the osCommerce PayPal contribution installed for some clients who have requested it. That is why I went with this contribution: http://www.oscommerce.com/community/contributions,2604 and it works beautifully. Now, I am just trying to get that image to work in the email - until then I still have the image logo problem.

 

<?php
/*
 $Id: invoice.php,v 1.6 2003/06/20 00:37:30 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="<?php echo $ei_css_path; ?>stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">

<!-- body_text //-->
<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr>
   <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
     <tr>
       <td class="pageHeading"><?php echo nl2br(STORE_NAME_ADDRESS); ?></td>
       <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'bwd_logo.gif', 'BWD And Associates', '204', '50'); ?></td>
     </tr>
   </table></td>
 </tr>
 <tr>
   <td><table width="100%" border="0" cellspacing="0" cellpadding="2">
     <tr>
       <td colspan="2"><?php echo tep_draw_separator(); ?></td>
     </tr>
     <tr>
       <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">
         <tr>
           <td class="main"><b><?php echo ENTRY_SOLD_TO; ?></b></td>
         </tr>
         <tr>
           <td class="main"><?php echo tep_address_format($order->customer['format_id'], $order->customer, 1, '', '<br>'); ?></td>
         </tr>
         <tr>
           <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '5'); ?></td>
         </tr>
         <tr>
           <td class="main"><?php echo $order->customer['telephone']; ?></td>
         </tr>
         <tr>
           <td class="main"><?php echo '<a href="mailto:' . $order->customer['email_address'] . '"><u>' . $order->customer['email_address'] . '</u></a>'; ?></td>
         </tr>
       </table></td>
       <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">
         <tr>
           <td class="main"><b><?php echo ENTRY_SHIP_TO; ?></b></td>
         </tr>
         <tr>
           <td class="main"><?php echo tep_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br>'); ?></td>
         </tr>
       </table></td>
     </tr>
   </table></td>
 </tr>
 <tr>
   <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 </tr>
 <tr>
   <td><table border="0" cellspacing="0" cellpadding="2">
     <tr>
       <td class="main"><b><?php echo ENTRY_PAYMENT_METHOD; ?></b></td>
       <td class="main"><?php echo $order->info['payment_method']; ?></td>
     </tr>
   </table></td>
 </tr>
 <tr>
   <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 </tr>
 <tr>
   <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
     <tr class="dataTableHeadingRow">
       <td class="dataTableHeadingContent" colspan="2"><?php echo TABLE_HEADING_PRODUCTS; ?></td>
       <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td>
       <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TAX; ?></td>
       <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_PRICE_EXCLUDING_TAX; ?></td>
       <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_PRICE_INCLUDING_TAX; ?></td>
       <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_EXCLUDING_TAX; ?></td>
       <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_INCLUDING_TAX; ?></td>
     </tr>
<?php
   for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
     echo '      <tr class="dataTableRow">' . "\n" .
          '        <td class="dataTableContent" valign="top" align="right">' . $order->products[$i]['qty'] . ' x</td>' . "\n" .
          '        <td class="dataTableContent" valign="top">' . $order->products[$i]['name'];

     if (isset($order->products[$i]['attributes']) && (($k = sizeof($order->products[$i]['attributes'])) > 0)) {
       for ($j = 0; $j < $k; $j++) {
         echo '<br><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'];
         if ($order->products[$i]['attributes'][$j]['price'] != '0') echo ' (' . $order->products[$i]['attributes'][$j]['prefix'] . $currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ')';
         echo '</i></small></nobr>';
       }
     }

     echo '        </td>' . "\n" .
          '        <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n";
     echo '        <td class="dataTableContent" align="right" valign="top">' . tep_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n" .
          '        <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" .
          '        <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" .
          '        <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" .
          '        <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n";
     echo '      </tr>' . "\n";
   }
?>
     <tr>
       <td align="right" colspan="8"><table border="0" cellspacing="0" cellpadding="2">
<?php
 for ($i = 0, $n = sizeof($order->totals); $i < $n; $i++) {
   echo '          <tr>' . "\n" .
        '            <td align="right" class="smallText">' . $order->totals[$i]['title'] . '</td>' . "\n" .
        '            <td align="right" class="smallText">' . $order->totals[$i]['text'] . '</td>' . "\n" .
        '          </tr>' . "\n";
 }
?>
       </table></td>
     </tr>
   </table></td>
 </tr>
</table>
<!-- body_text_eof //-->

<br>
</body>
</html>

Link to comment
Share on other sites

What is your website address and also, what is the setting for: DIR_WS_IMAGES in your config files?

L8r,

PopTheTop

 

Published osC Contributions:

- eCheck Payment Module v3.1

- Reviews in Product Display v2.0

- Fancier Invoice & Packingslip v6.1

- Admin Notes / Customer Notes v2.2

- Customer Zip & State Validation v2.2

- Search Box with Dropdown Category Menu v1.0

 

Pop your camper's top today!

It's a popup thing...

You wouldn't understand

Link to comment
Share on other sites

What is your website address and also, what is the setting for: DIR_WS_IMAGES in your config files?

 

 

PopTheTop,

 

My web address is as follows: www.bwdandassociates.com

 

Settings for DIR_WS_IMAGES:

 

/catalog/includes/configure.php --> define('DIR_WS_IMAGES', '/catalog/images/');

 

/catalog/admin/includes/configure.php --> define('DIR_WS_ADMIN', '/catalog/admin/'); and then define('DIR_WS_IMAGES', 'images/'); and then define('DIR_WS_CATALOG_IMAGES', DIR_WS_CATALOG . 'images/');

 

Let me know if you need anything else.

 

Brad

Link to comment
Share on other sites

PopTheTop,

 

My web address is as follows: www.bwdandassociates.com

 

Settings for DIR_WS_IMAGES:

 

/catalog/includes/configure.php --> define('DIR_WS_IMAGES', '/catalog/images/');

 

/catalog/admin/includes/configure.php --> define('DIR_WS_ADMIN', '/catalog/admin/'); and then define('DIR_WS_IMAGES', 'images/'); and then define('DIR_WS_CATALOG_IMAGES', DIR_WS_CATALOG . 'images/');

 

Let me know if you need anything else.

 

Brad

 

 

 

Make your /catalog/includes/configure.php -->

define('DIR_WS_IMAGES', 'images/');

 

 

Make your /catalog/admin/includes/configure.php -->

define('DIR_WS_ADMIN', '/admin/');

L8r,

PopTheTop

 

Published osC Contributions:

- eCheck Payment Module v3.1

- Reviews in Product Display v2.0

- Fancier Invoice & Packingslip v6.1

- Admin Notes / Customer Notes v2.2

- Customer Zip & State Validation v2.2

- Search Box with Dropdown Category Menu v1.0

 

Pop your camper's top today!

It's a popup thing...

You wouldn't understand

Link to comment
Share on other sites

PopTheTop,

 

My web address is as follows: www.bwdandassociates.com

 

Brad

 

 

Hey I just made a test order and your template file is screwed up. It states this when you try to open it...

Parse error: parse error, unexpected '<', expecting ',' or ';' in /home/bwdand14/public_html/catalog/includes/modules/email_invoice/templates/invoice.php on line 28

L8r,

PopTheTop

 

Published osC Contributions:

- eCheck Payment Module v3.1

- Reviews in Product Display v2.0

- Fancier Invoice & Packingslip v6.1

- Admin Notes / Customer Notes v2.2

- Customer Zip & State Validation v2.2

- Search Box with Dropdown Category Menu v1.0

 

Pop your camper's top today!

It's a popup thing...

You wouldn't understand

Link to comment
Share on other sites

Hey I just made a test order and your template file is screwed up. It states this when you try to open it...

 

 

PopTheTop,

 

Thanks for your help. The changes you mentioned worked like a charm. As for the parse error - I had created a second template trying to match my invoice (Professional Invoice & Packaging Slip Contribution). As you can tell, it didn't work :'( I made the change back to your original and all works good.

 

Now I just need to add the comments - shouldn't be too hard! :D

 

I appreciate your help!

 

Brad

Link to comment
Share on other sites

PopTheTop,

 

Thanks for your help. The changes you mentioned worked like a charm. As for the parse error - I had created a second template trying to match my invoice (Professional Invoice & Packaging Slip Contribution). As you can tell, it didn't work  :'(  I made the change back to your original and all works good.

 

Now I just need to add the comments - shouldn't be too hard!  :D

 

I appreciate your help!

 

Brad

 

 

If you download and use the templates found in http://www.oscommerce.com/community/contributions,2861 then you should be OK. I have the comments in them already and I think there are 4 templates with it that you can use. They should still work for you but if not, you can compare the templates with your templates and see how I added the comments and such.

L8r,

PopTheTop

 

Published osC Contributions:

- eCheck Payment Module v3.1

- Reviews in Product Display v2.0

- Fancier Invoice & Packingslip v6.1

- Admin Notes / Customer Notes v2.2

- Customer Zip & State Validation v2.2

- Search Box with Dropdown Category Menu v1.0

 

Pop your camper's top today!

It's a popup thing...

You wouldn't understand

Link to comment
Share on other sites

One other question...

 

I am using the osCommerce version (1.1) of PayPal IPN. Do you or anyone else know how to modify the IPN files to send the proper email template. Currently it is only sending the non-html version. I tried adding the same coding as the check_out.php file but without success. Below is the IPN file:

 

<?php

/*

 $Id: paypal_ipn.php,v 1.1.2.11 2004/12/05 19:14:35 hpdl Exp $

 

 osCommerce, Open Source E-Commerce Solutions

 http://www.oscommerce.com

 

 Copyright (c) 2004 osCommerce

 

 Released under the GNU General Public License

*/

 

 class paypal_ipn {

   var $code, $title, $description, $enabled, $identifier;

 

// class constructor

   function paypal_ipn() {

     global $order;

 

     $this->code = 'paypal_ipn';

     $this->title = MODULE_PAYMENT_PAYPAL_IPN_TEXT_TITLE;

     $this->description = MODULE_PAYMENT_PAYPAL_IPN_TEXT_DESCRIPTION;

     $this->sort_order = MODULE_PAYMENT_PAYPAL_IPN_SORT_ORDER;

     $this->enabled = ((MODULE_PAYMENT_PAYPAL_IPN_STATUS == 'True') ? true : false);

     $this->identifier = 'osCommerce PayPal IPN v1.0';

 

     if ((int)MODULE_PAYMENT_PAYPAL_IPN_PREPARE_ORDER_STATUS_ID > 0) {

       $this->order_status = MODULE_PAYMENT_PAYPAL_IPN_PREPARE_ORDER_STATUS_ID;

     }

 

     if (is_object($order)) $this->update_status();

 

     if (MODULE_PAYMENT_PAYPAL_IPN_GATEWAY_SERVER == 'Live') {

       $this->form_action_url = 'https://www.paypal.com/cgi-bin/webscr';

     } else {

       $this->form_action_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';

     }

   }

 

// class methods

   function update_status() {

     global $order;

 

     if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_PAYPAL_IPN_ZONE > 0) ) {

       $check_flag = false;

       $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_PAYPAL_IPN_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");

       while ($check = tep_db_fetch_array($check_query)) {

         if ($check['zone_id'] < 1) {

           $check_flag = true;

           break;

         } elseif ($check['zone_id'] == $order->billing['zone_id']) {

           $check_flag = true;

           break;

         }

       }

 

       if ($check_flag == false) {

         $this->enabled = false;

       }

     }

   }

 

   function javascript_validation() {

     return false;

   }

 

   function selection() {

     return array('id' => $this->code,

                  'module' => $this->title);

   }

 

   function pre_confirmation_check() {

     return false;

   }

 

   function confirmation() {

     global $cartID, $cart_PayPal_IPN_ID, $customer_id, $languages_id, $order, $order_total_modules;

 

     if (tep_session_is_registered('cartID')) {

       $insert_order = false;

 

       if (tep_session_is_registered('cart_PayPal_IPN_ID')) {

         $order_id = substr($cart_PayPal_IPN_ID, strpos($cart_PayPal_IPN_ID, '-')+1);

 

         $curr_check = tep_db_query("select currency from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");

         $curr = tep_db_fetch_array($curr_check);

 

         if ( ($curr['currency'] != $order->info['currency']) || ($cartID != substr($cart_PayPal_IPN_ID, 0, strlen($cartID))) ) {

           $check_query = tep_db_query('select orders_id from ' . TABLE_ORDERS_STATUS_HISTORY . ' where orders_id = "' . (int)$order_id . '" limit 1');

 

           if (tep_db_num_rows($check_query) < 1) {

             tep_db_query('delete from ' . TABLE_ORDERS . ' where orders_id = "' . (int)$order_id . '"');

             tep_db_query('delete from ' . TABLE_ORDERS_TOTAL . ' where orders_id = "' . (int)$order_id . '"');

             tep_db_query('delete from ' . TABLE_ORDERS_STATUS_HISTORY . ' where orders_id = "' . (int)$order_id . '"');

             tep_db_query('delete from ' . TABLE_ORDERS_PRODUCTS . ' where orders_id = "' . (int)$order_id . '"');

             tep_db_query('delete from ' . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . ' where orders_id = "' . (int)$order_id . '"');

             tep_db_query('delete from ' . TABLE_ORDERS_PRODUCTS_DOWNLOAD . ' where orders_id = "' . (int)$order_id . '"');

           }

 

           $insert_order = true;

         }

       } else {

         $insert_order = true;

       }

 

       if ($insert_order == true) {

         $order_totals = array();

         if (is_array($order_total_modules->modules)) {

           reset($order_total_modules->modules);

           while (list(, $value) = each($order_total_modules->modules)) {

             $class = substr($value, 0, strrpos($value, '.'));

             if ($GLOBALS[$class]->enabled) {

               for ($i=0, $n=sizeof($GLOBALS[$class]->output); $i<$n; $i++) {

                 if (tep_not_null($GLOBALS[$class]->output[$i]['title']) && tep_not_null($GLOBALS[$class]->output[$i]['text'])) {

                   $order_totals[] = array('code' => $GLOBALS[$class]->code,

                                           'title' => $GLOBALS[$class]->output[$i]['title'],

                                           'text' => $GLOBALS[$class]->output[$i]['text'],

                                           'value' => $GLOBALS[$class]->output[$i]['value'],

                                           'sort_order' => $GLOBALS[$class]->sort_order);

                 }

               }

             }

           }

         }

 

         $sql_data_array = array('customers_id' => $customer_id,

                                 'customers_name' => $order->customer['firstname'] . ' ' . $order->customer['lastname'],

                                 'customers_company' => $order->customer['company'],

                                 'customers_street_address' => $order->customer['street_address'],

                                 'customers_suburb' => $order->customer['suburb'],

                                 'customers_city' => $order->customer['city'],

                                 'customers_postcode' => $order->customer['postcode'],

                                 'customers_state' => $order->customer['state'],

                                 'customers_country' => $order->customer['country']['title'],

                                 'customers_telephone' => $order->customer['telephone'],

                                 'customers_email_address' => $order->customer['email_address'],

                                 'customers_address_format_id' => $order->customer['format_id'],

                                 'delivery_name' => $order->delivery['firstname'] . ' ' . $order->delivery['lastname'],

                                 'delivery_company' => $order->delivery['company'],

                                 'delivery_street_address' => $order->delivery['street_address'],

                                 'delivery_suburb' => $order->delivery['suburb'],

                                 'delivery_city' => $order->delivery['city'],

                                 'delivery_postcode' => $order->delivery['postcode'],

                                 'delivery_state' => $order->delivery['state'],

                                 'delivery_country' => $order->delivery['country']['title'],

                                 'delivery_address_format_id' => $order->delivery['format_id'],

                                 'billing_name' => $order->billing['firstname'] . ' ' . $order->billing['lastname'],

                                 'billing_company' => $order->billing['company'],

                                 'billing_street_address' => $order->billing['street_address'],

                                 'billing_suburb' => $order->billing['suburb'],

                                 'billing_city' => $order->billing['city'],

                                 'billing_postcode' => $order->billing['postcode'],

                                 'billing_state' => $order->billing['state'],

                                 'billing_country' => $order->billing['country']['title'],

                                 'billing_address_format_id' => $order->billing['format_id'],

                                 'payment_method' => $order->info['payment_method'],

                                 'cc_type' => $order->info['cc_type'],

                                 'cc_owner' => $order->info['cc_owner'],

                                 'cc_number' => $order->info['cc_number'],

                                 'cc_expires' => $order->info['cc_expires'],

                                 'date_purchased' => 'now()',

                                 'orders_status' => $order->info['order_status'],

                                 'currency' => $order->info['currency'],

                                 'currency_value' => $order->info['currency_value']);

 

         tep_db_perform(TABLE_ORDERS, $sql_data_array);

 

         $insert_id = tep_db_insert_id();

 

         for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {

           $sql_data_array = array('orders_id' => $insert_id,

                                   'title' => $order_totals[$i]['title'],

                                   'text' => $order_totals[$i]['text'],

                                   'value' => $order_totals[$i]['value'],

                                   'class' => $order_totals[$i]['code'],

                                   'sort_order' => $order_totals[$i]['sort_order']);

 

           tep_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array);

         }

 

         for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {

           $sql_data_array = array('orders_id' => $insert_id,

                                   'products_id' => tep_get_prid($order->products[$i]['id']),

                                   'products_model' => $order->products[$i]['model'],

                                   'products_name' => $order->products[$i]['name'],

                                   'products_price' => $order->products[$i]['price'],

                                   'final_price' => $order->products[$i]['final_price'],

                                   'products_tax' => $order->products[$i]['tax'],

                                   'products_quantity' => $order->products[$i]['qty']);

 

           tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);

 

           $order_products_id = tep_db_insert_id();

 

           $attributes_exist = '0';

           if (isset($order->products[$i]['attributes'])) {

             $attributes_exist = '1';

             for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {

               if (DOWNLOAD_ENABLED == 'true') {

                 $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename

                                      from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa

                                      left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad

                                      on pa.products_attributes_id=pad.products_attributes_id

                                      where pa.products_id = '" . $order->products[$i]['id'] . "'

                                      and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'

                                      and pa.options_id = popt.products_options_id

                                      and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'

                                      and pa.options_values_id = poval.products_options_values_id

                                      and popt.language_id = '" . $languages_id . "'

                                      and poval.language_id = '" . $languages_id . "'";

                 $attributes = tep_db_query($attributes_query);

               } else {

                 $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");

               }

               $attributes_values = tep_db_fetch_array($attributes);

 

               $sql_data_array = array('orders_id' => $insert_id,

                                       'orders_products_id' => $order_products_id,

                                       'products_options' => $attributes_values['products_options_name'],

                                       'products_options_values' => $attributes_values['products_options_values_name'],

                                       'options_values_price' => $attributes_values['options_values_price'],

                                       'price_prefix' => $attributes_values['price_prefix']);

 

               tep_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array);

 

               if ((DOWNLOAD_ENABLED == 'true') && isset($attributes_values['products_attributes_filename']) && tep_not_null($attributes_values['products_attributes_filename'])) {

                 $sql_data_array = array('orders_id' => $insert_id,

                                         'orders_products_id' => $order_products_id,

                                         'orders_products_filename' => $attributes_values['products_attributes_filename'],

                                         'download_maxdays' => $attributes_values['products_attributes_maxdays'],

                                         'download_count' => $attributes_values['products_attributes_maxcount']);

 

                 tep_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array);

               }

             }

           }

         }

 

         tep_session_register('cart_PayPal_IPN_ID');

         $cart_PayPal_IPN_ID = $cartID . '-' . $insert_id;

       }

     }

 

     return false;

   }

 

   function process_button() {

     global $customer_id, $order, $languages_id, $currencies, $currency, $cart_PayPal_IPN_ID, $shipping;

 

     if (MODULE_PAYMENT_PAYPAL_IPN_CURRENCY == 'Selected Currency') {

       $my_currency = $currency;

     } else {

       $my_currency = substr(MODULE_PAYMENT_PAYPAL_IPN_CURRENCY, 5);

     }

     if (!in_array($my_currency, array('CAD', 'EUR', 'GBP', 'JPY', 'USD'))) {

       $my_currency = 'USD';

     }

 

     $parameters = array();

 

     if ( (MODULE_PAYMENT_PAYPAL_IPN_TRANSACTION_TYPE == 'Per Item') && (MODULE_PAYMENT_PAYPAL_IPN_EWP_STATUS == 'False') ) {

       $parameters['cmd'] = '_cart';

       $parameters['upload'] = '1';

 

       for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {

         $item = $i+1;

 

         $tax_value = ($order->products[$i]['tax'] / 100) * $order->products[$i]['final_price'];

 

         $parameters['item_name_' . $item] = $order->products[$i]['name'];

         $parameters['amount_' . $item] = number_format($order->products[$i]['final_price'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));

         $parameters['tax_' . $item] = number_format($tax_value * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));

         $parameters['quantity_' . $item] = $order->products[$i]['qty'];

 

         if ($i == 0) {

           if (DISPLAY_PRICE_WITH_TAX == 'true') {

             $shipping_cost = $order->info['shipping_cost'];

           } else {

             $module = substr($shipping['id'], 0, strpos($shipping['id'], '_'));

             $shipping_tax = tep_get_tax_rate($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);

             $shipping_cost = $order->info['shipping_cost'] + tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);

           }

 

           $parameters['shipping_' . $item] = number_format($shipping_cost * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));

         }

 

         if (isset($order->products[$i]['attributes'])) {

           for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {

             if (DOWNLOAD_ENABLED == 'true') {

               $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename

                                    from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa

                                    left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad

                                    on pa.products_attributes_id=pad.products_attributes_id

                                    where pa.products_id = '" . $order->products[$i]['id'] . "'

                                    and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'

                                    and pa.options_id = popt.products_options_id

                                    and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'

                                    and pa.options_values_id = poval.products_options_values_id

                                    and popt.language_id = '" . $languages_id . "'

                                    and poval.language_id = '" . $languages_id . "'";

               $attributes = tep_db_query($attributes_query);

             } else {

               $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");

             }

             $attributes_values = tep_db_fetch_array($attributes);

 

// Unfortunately PayPal only accepts two attributes per product, so the

// third attribute onwards will not be shown at PayPal

             $parameters['on' . $j . '_' . $item] = $attributes_values['products_options_name'];

             $parameters['os' . $j . '_' . $item] = $attributes_values['products_options_values_name'];

           }

         }

       }

 

       $parameters['num_cart_items'] = $item;

     } else {

       $parameters['cmd'] = '_xclick';

       $parameters['item_name'] = STORE_NAME;

       $parameters['shipping'] = number_format($order->info['shipping_cost'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));

       $parameters['tax'] = number_format($order->info['tax'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));

     }

 

     $parameters['business'] = MODULE_PAYMENT_PAYPAL_IPN_ID;

     $parameters['amount'] = number_format(($order->info['total'] - $order->info['shipping_cost'] - $order->info['tax']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));

     $parameters['currency_code'] = $my_currency;

     $parameters['invoice'] = substr($cart_PayPal_IPN_ID, strpos($cart_PayPal_IPN_ID, '-')+1);

     $parameters['custom'] = $customer_id;

     $parameters['no_shipping'] = '1';

     $parameters['no_note'] = '1';

     $parameters['notify_url'] = tep_href_link('ext/modules/payment/paypal_ipn/ipn.php', '', 'SSL', false, false);

     $parameters['return'] = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL');

     $parameters['cancel_return'] = tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL');

     $parameters['bn'] = $this->identifier;

 

     if (tep_not_null(MODULE_PAYMENT_PAYPAL_IPN_PAGE_STYLE)) {

       $parameters['page_style'] = MODULE_PAYMENT_PAYPAL_IPN_PAGE_STYLE;

     }

 

     if (MODULE_PAYMENT_PAYPAL_IPN_EWP_STATUS == 'True') {

       $parameters['cert_id'] = MODULE_PAYMENT_PAYPAL_IPN_EWP_CERT_ID;

 

       $random_string = rand(100000, 999999) . '-' . $customer_id . '-';

 

       $data = '';

       while (list($key, $value) = each($parameters)) {

         $data .= $key . '=' . $value . "\n";

       }

 

       $fp = fopen(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt', 'w');

       fwrite($fp, $data);

       fclose($fp);

 

       unset($data);

 

       if (function_exists('openssl_pkcs7_sign') && function_exists('openssl_pkcs7_encrypt')) {

         openssl_pkcs7_sign(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt', MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt', file_get_contents(MODULE_PAYMENT_PAYPAL_IPN_EWP_PUBLIC_KEY), file_get_contents(MODULE_PAYMENT_PAYPAL_IPN_EWP_PRIVATE_KEY), array('From' => MODULE_PAYMENT_PAYPAL_IPN_ID), PKCS7_BINARY);

 

         unlink(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt');

 

// remove headers from the signature

         $signed = file_get_contents(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt');

         $signed = explode("\n\n", $signed);

         $signed = base64_decode($signed[1]);

 

         $fp = fopen(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt', 'w');

         fwrite($fp, $signed);

         fclose($fp);

 

         unset($signed);

 

         openssl_pkcs7_encrypt(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt', MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt', file_get_contents(MODULE_PAYMENT_PAYPAL_IPN_EWP_PAYPAL_KEY), array('From' => MODULE_PAYMENT_PAYPAL_IPN_ID), PKCS7_BINARY);

 

         unlink(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt');

 

// remove headers from the encrypted result

         $data = file_get_contents(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt');

         $data = explode("\n\n", $data);

         $data = '-----BEGIN PKCS7-----' . "\n" . $data[1] . "\n" . '-----END PKCS7-----';

 

         unlink(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt');

       } else {

         exec(MODULE_PAYMENT_PAYPAL_IPN_EWP_OPENSSL . ' smime -sign -in ' . MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt -signer ' . MODULE_PAYMENT_PAYPAL_IPN_EWP_PUBLIC_KEY . ' -inkey ' . MODULE_PAYMENT_PAYPAL_IPN_EWP_PRIVATE_KEY . ' -outform der -nodetach -binary > ' . MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt');

         unlink(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt');

 

         exec(MODULE_PAYMENT_PAYPAL_IPN_EWP_OPENSSL . ' smime -encrypt -des3 -binary -outform pem ' . MODULE_PAYMENT_PAYPAL_IPN_EWP_PAYPAL_KEY . ' < ' . MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt > ' . MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt');

         unlink(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt');

 

         $fh = fopen(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt', 'rb');

         $data = fread($fh, filesize(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt'));

         fclose($fh);

 

         unlink(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt');

       }

 

       $process_button_string = tep_draw_hidden_field('cmd', '_s-xclick') .

                                tep_draw_hidden_field('encrypted', $data);

 

       unset($data);

     } else {

       while (list($key, $value) = each($parameters)) {

         echo tep_draw_hidden_field($key, $value);

       }

     }

 

     return $process_button_string;

   }

 

   function before_process() {

     global $customer_id, $order, $sendto, $billto, $payment, $currencies, $cart, $cart_PayPal_IPN_ID;

     global $$payment;

 

     include(DIR_WS_CLASSES . 'order_total.php');

     $order_total_modules = new order_total;

 

     $order_totals = $order_total_modules->process();

 

     $order_id = substr($cart_PayPal_IPN_ID, strpos($cart_PayPal_IPN_ID, '-')+1);

 

     $sql_data_array = array('orders_id' => $order_id,

                             'orders_status_id' => $order->info['order_status'],

                             'date_added' => 'now()',

                             'customer_notified' => (SEND_EMAILS == 'true') ? '1' : '0',

                             'comments' => $order->info['comments']);

 

     tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);

 

// initialized for the email confirmation

     $products_ordered = '';

     $subtotal = 0;

     $total_tax = 0;

 

     for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {

// Stock Update - Joao Correia

       if (STOCK_LIMITED == 'true') {

         if (DOWNLOAD_ENABLED == 'true') {

           $stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename

                               FROM " . TABLE_PRODUCTS . " p

                               LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa

                               ON p.products_id=pa.products_id

                               LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad

                               ON pa.products_attributes_id=pad.products_attributes_id

                               WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'";

// Will work with only one option for downloadable products

// otherwise, we have to build the query dynamically with a loop

           $products_attributes = $order->products[$i]['attributes'];

           if (is_array($products_attributes)) {

             $stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'";

           }

           $stock_query = tep_db_query($stock_query_raw);

         } else {

           $stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

         }

         if (tep_db_num_rows($stock_query) > 0) {

           $stock_values = tep_db_fetch_array($stock_query);

// do not decrement quantities if products_attributes_filename exists

           if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename'])) {

             $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty'];

           } else {

             $stock_left = $stock_values['products_quantity'];

           }

           tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

           if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) {

             tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

           }

         }

       }

 

// Update products_ordered (for bestsellers list)

       tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

 

//------insert customer choosen option to order--------

       $attributes_exist = '0';

       $products_ordered_attributes = '';

       if (isset($order->products[$i]['attributes'])) {

         $attributes_exist = '1';

         for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {

           if (DOWNLOAD_ENABLED == 'true') {

             $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename

                                  from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa

                                  left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad

                                  on pa.products_attributes_id=pad.products_attributes_id

                                  where pa.products_id = '" . $order->products[$i]['id'] . "'

                                  and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'

                                  and pa.options_id = popt.products_options_id

                                  and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'

                                  and pa.options_values_id = poval.products_options_values_id

                                  and popt.language_id = '" . $languages_id . "'

                                  and poval.language_id = '" . $languages_id . "'";

             $attributes = tep_db_query($attributes_query);

           } else {

             $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");

           }

           $attributes_values = tep_db_fetch_array($attributes);

 

           $products_ordered_attributes .= "\n\t" . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name'];

         }

       }

//------insert customer choosen option eof ----

       $total_weight += ($order->products[$i]['qty'] * $order->products[$i]['weight']);

       $total_tax += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty'];

       $total_cost += $total_products_price;

 

       $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";

     }

 

// lets start with the email confirmation

     $email_order = STORE_NAME . "\n" .

                    EMAIL_SEPARATOR . "\n" .

                    EMAIL_TEXT_ORDER_NUMBER . ' ' . $order_id . "\n" .

                    EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $order_id, 'SSL', false) . "\n" .

                    EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";

     if ($order->info['comments']) {

       $email_order .= tep_db_output($order->info['comments']) . "\n\n";

     }

     $email_order .= EMAIL_TEXT_PRODUCTS . "\n" .

                     EMAIL_SEPARATOR . "\n" .

                     $products_ordered .

                     EMAIL_SEPARATOR . "\n";

 

     for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {

       $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";

     }


Link to comment
Share on other sites

  • 1 month later...

Hi there,

 

I am trying to install this contribution but am unable to import the sql file.

 

I get this error

 

MySQL said: 

 

#1064 - You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'INSERT INTO `configuration` ( `configuration_id` , `configurati

 

When trying to import this code from the latest update

 

INSERT INTO `configuration` ( `configuration_id` , `configuration_title` , `configuration_key` , `configuration_value` , `configuration_description` , `configuration_group_id` , `sort_order` , `last_modified` , `date_added` , `use_function` , `set_function` )

VALUES (

'', 'Email Invoice to Customer', 'EMAIL_INVOICE', 'true', 'If this flag is enabled, the HTML invoice of the order will be sent to the customer.', '12', '0', NULL , NOW( ) , '', ''

)

INSERT INTO `configuration` ( `configuration_id` , `configuration_title` , `configuration_key` , `configuration_value` , `configuration_description` , `configuration_group_id` , `sort_order` , `last_modified` , `date_added` , `use_function` , `set_function` )  VALUES ('', 'Default Email Template File', 'EMAIL_TEMPLATE_FILE', 'invoice.php', 'This value dictates which template file will be used when sending the email.', 12, 0, NULL, NOW(), '', '');

 

Can anyone help?

 

Btw, I'm running MySQL 4.0.22-standard

 

Thanks

 

stubbsy

Link to comment
Share on other sites

  • 1 month later...

I just installed email invoice, and it works great.

 

2 things I'm trying to figure out:

 

1) It is emailing the oscommerce logo. Where do I change the coding to point it to my logo instead (i've changed oscommerce logo on the admin side)

 

2) The comments on the order are not being passed through to the email that is sent to the customer.

 

I am using email_invoice.php

 

Thanks for any help.. I'll keep looking.

Link to comment
Share on other sites

I just installed email invoice, and it works great.

 

2 things I'm trying to figure out:

 

1) It is emailing the oscommerce logo. Where do I change the coding to point it to my logo instead (i've changed oscommerce logo on the admin side)

 

2) The comments on the order are not being passed through to the email that is sent to the customer.

 

I am using email_invoice.php

 

Thanks for any help.. I'll keep looking.

 

I figured #1 out, needed to change the reference to the image in invoice.php in /catalog/includes/modules/email_invoice/templates

 

For #2, this works for me:

 

Add this text at the end of invoice.php in pokerguard/catalog/includes/modules/email_invoice/templates

and this will get the customer's order comments on the html invoice that is sent to the customer. This will not add

the order comments to the invoice under admin.

 

Format accordingly in a table, etc. or you can put this in another area on the invoice rather than the bottom of the invoice.

 

Got this from here:

 

http://www.oscommerce.com/forums/index.php?showtopic=42120&hl=

 

<?php

$orders_comments_query = tep_db_query("select comments from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . tep_db_input($oID) . "' order by date_added");

if (tep_db_num_rows($orders_comments_query)) {

 while ($orders_comments = tep_db_fetch_array($orders_comments_query)) {

if(tep_not_null($orders_comments['comments'])){

   echo '<tr><td align="right" class="smallText" colspan="8">' . nl2br(tep_db_output($orders_comments['comments'])) . '?</td></tr>';

   }

 }

}

?>

 

Just in case someone else needs similar changes and thanks to all on the forum!

Link to comment
Share on other sites

I just installed this and in the emails that are sent says...

 

--=_3ec2452f74ea6758ea6858befcd722f0

Content-Type: text/plain; charset="iso-8859-1"

Content-Transfer-Encoding: 7bit

 

mydomain

------------------------------------------------------

Order Number: 1298791

Detailed Invoice: http://shop.mydomain/account_history_info....rder_id=1298791

Date Ordered: Saturday 12 November, 2005

 

Products

------------------------------------------------------

1 x (8bags) = $16.99

Color Option 1 : Black

Color Option 2 : Hunter Green

------------------------------------------------------

Sub-Total: $16.99

Standard USPS 2-10 Day Delivery ($1.00 Insurance Included) (($9.00 first item, $4.00 each additional)): $10.00

Total: $26.99

 

Delivery Address

------------------------------------------------------

***************

*******************

******************

United States

 

Billing Address

------------------------------------------------------

***********

*********************

*****************

United States

 

Payment Method

------------------------------------------------------

Check/Money Order

 

Make Payable To: **********************

 

Send To:

*******************************************

 

Your order will not ship until we receive payment.

 

 

--=_3ec2452f74ea6758ea6858befcd722f0

Content-Type: text/html; charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable

 

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"><html dir=3D=

"LTR" lang=3D"en"><head><meta http-equiv=3D"Content-Type" content=3D"text/h=

tml; charset=3Diso-8859-1"><title>mydomain</title><link rel=3D"st=

ylesheet" type=3D"text/css" href=3D"http://shop.mydomain/includes=

/modules/email_invoice/templates/stylesheet.css"></head><body marginwidth=

=3D"0" marginheight=3D"0" topmargin=3D"0" bottommargin=3D"0" leftmargin=3D"=

0" rightmargin=3D"0" bgcolor=3D"#FFFFFF"><!-- body_text //--><table border=

=3D"0" width=3D"100%" cellspacing=3D"0" cellpadding=3D"2"> <tr> <td><ta=

ble border=3D"0" width=3D"100%" cellspacing=3D"0" cellpadding=3D"0"> <=

tr> <td class=3D"pageHeading">mydomain<br />mydomain@g=

mail.com</td> <td class=3D"pageHeading" align=3D"right"><img src=3D"=

http://shop.mydomain/images/oscommerce.gif" border=3D"0" alt=3D"o=

sCommerce" title=3D" osCommerce " width=3D"204" height=3D"50"></td> </=

tr> </table></td> </tr> <tr> <td><table width=3D"100%" border=3D"0"=

cellspacing=3D"0" cellpadding=3D"2"> <tr> <td colspan=3D"2"><i=

mg src=3D"http://shop.mydomain/images/pixel_black.gif" border=3D"=

0" alt=3D"" width=3D"100%" height=3D"1"></td> </tr> <tr> <=

td valign=3D"top"><table width=3D"100%" border=3D"0" cellspacing=3D"0" cell=

padding=3D"2"> <tr> <td class=3D"main"><b>SOLD TO:</b><=

/td> </tr> <tr> <td class=3D"main"> Str=

eb <br>Customer Address Ave. NW<br>, Ohio zip<br>United States</=

td> </tr> <tr> <td><img src=3D"http://shop.domain=

ndomain.com/images/pixel_trans.gif" border=3D"0" alt=3D"" width=3D"1" h=

eight=3D"5"></td> </tr> <tr> <td class=3D"main=

">330.353.1777</td> </tr> <tr> <td class=3D"ma=

in"><a href=3D"mailto:[email protected]"><u>[email protected]</u></a>=

</td> </tr> </table></td> <td valign=3D"top"><table =

width=3D"100%" border=3D"0" cellspacing=3D"0" cellpadding=3D"2"> <=

tr> <td class=3D"main"><b>SHIP TO:</b></td> </tr> =

<tr> <td class=3D"main">Customer Name <br>Customer Address A=

ve. NW<br>, Ohio zip<br>United States</td> </tr> =

</table></td> </tr> </table></td> </tr> <tr> <td><img src=3D"=

http://shop.mydomain/images/pixel_trans.gif" border=3D"0" alt=3D"=

" width=3D"1" height=3D"10"></td> </tr> <tr> <td><table border=3D"0" c=

ellspacing=3D"0" cellpadding=3D"2"> <tr> <td class=3D"main"><b>=

Payment Method:</b></td> <td class=3D"main">Check/Money Order</td> =

</tr> </table></td> </tr> <tr> <td><img src=3D"http://shop.my=

domain.com/images/pixel_trans.gif" border=3D"0" alt=3D"" width=3D"1" he=

ight=3D"10"></td> </tr> <tr> <td><table border=3D"0" width=3D"100%" ce=

llspacing=3D"0" cellpadding=3D"2"> <tr class=3D"dataTableHeadingRow"> =

<td class=3D"dataTableHeadingContent" colspan=3D"2">Products</td> =

<td class=3D"dataTableHeadingContent">Model</td> <td class=3D"d=

ataTableHeadingContent" align=3D"right">Tax</td> <td class=3D"dataTa=

bleHeadingContent" align=3D"right">Price (Ex. Tax)</td> <td class=3D=

"dataTableHeadingContent" align=3D"right">Price (Inc. Tax)</td> <td =

class=3D"dataTableHeadingContent" align=3D"right">Total (Ex. Tax)</td> =

<td class=3D"dataTableHeadingContent" align=3D"right">Total (Inc. Tax)</=

td> </tr> <tr class=3D"dataTableRow"> <td class=3D"dataTab=

leContent" valign=3D"top" align=3D"right">1 x</td> <td class=3D=

"dataTableContent" valign=3D"top">Set of 8 Official Bags<br><nobr>=

<small> <i> - Color Option 1 :: Black</i></small></nobr><br><nobr><sma=

ll> <i> - Color Option 2 :: Hunter Green</i></small></nobr> </t=

d> <td class=3D"dataTableContent" valign=3D"top">8bags</td> <=

td class=3D"dataTableContent" align=3D"right" valign=3D"top">0%</td> =

<td class=3D"dataTableContent" align=3D"right" valign=3D"top"><b>$16.99</b=

 

>></td> <td class=3D"dataTableContent" align=3D"right" valign=3D"top"=

>><b>$16.99</b></td> <td class=3D"dataTableContent" align=3D"right" v=

 

align=3D"top"><b>$16.99</b></td> <td class=3D"dataTableContent" alig=

n=3D"right" valign=3D"top"><b>$16.99</b></td> </tr> <tr> <=

td align=3D"right" colspan=3D"8"><table border=3D"0" cellspacing=3D"0" cell=

padding=3D"2"> <tr> <td align=3D"right" class=3D"smallT=

ext">Sub-Total:</td> <td align=3D"right" class=3D"smallText">$16=

.99</td> </tr> <tr> <td align=3D"right" class=

=3D"smallText">Standard USPS 2-10 Day Delivery ($1.00 Insurance Included) (=

($9.00 first item, $4.00 each additional)):</td> <td align=3D"ri=

ght" class=3D"smallText">$10.00</td> </tr> <tr> =

<td align=3D"right" class=3D"smallText">Total:</td> <td align=

=3D"right" class=3D"smallText"><b>$26.99</b></td> </tr> </t=

able></td> </tr> </table></td> </tr></table><!-- body_text_eof //-=

-><br></body></html>

--=_3ec2452f74ea6758ea6858befcd722f0--

 

I am not sure what I am doing wrong... I have double checked whati have edited...

 

//------insert customer choosen option eof ----
$total_weight += ($order->products[$i]['qty'] * $order->products[$i]['weight']);
$total_tax += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty'];
$total_cost += $total_products_price;

$products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";
 }

// lets start with the email confirmation
/****************************************************** 
* Email Invoice 1.0.
* Author Contact: [email protected]
******************************************************/

if (EMAIL_INVOICE == 'true') {

	require(DIR_WS_MODULES . EMAIL_INVOICE_DIR . FILENAME_EMAIL_INVOICE);

} else {

/**** End of Email Invoice Mod Snippet ****/
/*========================================*/


 $email_order = STORE_NAME . "\n" .
			 EMAIL_SEPARATOR . "\n" .
			 EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
			 EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" .
			 EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
 if ($order->info['comments']) {
$email_order .= tep_db_output($order->info['comments']) . "\n\n";
 }
 $email_order .= EMAIL_TEXT_PRODUCTS . "\n" .
			  EMAIL_SEPARATOR . "\n" .
			  $products_ordered .
			  EMAIL_SEPARATOR . "\n";

 for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
$email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
 }

 if ($order->content_type != 'virtual') {
$email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" .
				EMAIL_SEPARATOR . "\n" .
				tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";
 }

 $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .
			  EMAIL_SEPARATOR . "\n" .
			  tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
 if (is_object($$payment)) {
$email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" .
				EMAIL_SEPARATOR . "\n";
$payment_class = $$payment;
$email_order .= $payment_class->title . "\n\n";
if ($payment_class->email_footer) {
  $email_order .= $payment_class->email_footer . "\n\n";
}
 }


tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

// send emails to other people
 if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
 }

/*=======================================================================*/
/**** Email Invoice Mod Snippet ****/

}

/**** End of Email Invoice Mod Snippet ****/
/*=======================================================================*/

// load the after_process function from the payment modules
 $payment_modules->after_process();

 

Can anyone help me out or is anyone having the same problem?

Link to comment
Share on other sites

  • 2 weeks later...

I've installed the Oscommerce IPN, as I'm having issues with Paypal customers not waiting 3 seconds to be returned to my site, and I'm getting payment, but not the details of their order.

 

So, the IPN is supposed to take care of that, giving me the order details in a table, before sending them off to paypal.

 

But, when I use the IPN solution, the customer nor I receive the email invoice...

 

Are these not compatible? Not sure what it would take to make compatible...

Link to comment
Share on other sites

  • 7 months later...

Anybody still use this mod? Is there a better one out there?

 

I just want something simple where I can manually email the invoice to the customer at some point AFTER the order. (ie. not automatically as soon as the order is complete.)

Its there a way to make this one send the email when the status is sent to "processing" or "delivered"?

 

Or better yet, have a button somewhere I click to send the email when I'm good and ready.

 

Thanks

Edited by yomama360

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself.

Therefore, all progress depends upon the unreasonable man."

-- George Bernard Shaw

Link to comment
Share on other sites

  • 1 month later...

I installed this contribution, and find one problem.

When enabled HTML via admin, not send user comments! :'(

 

I used : invoice.php template

Please can somebody help me?

 

peter

Comments were not added to that template, you need to use the other template of you want the order comments.

I'd like the customers comments (from the check out process) shown on the vendors email.

 

Where will I find the 'other template' referred to above, or can any one supply a bit of code to insert the customers comments just below the delivery address.

 

Thanks

 

Steve

____________________________________________________________________

____________________________________________________________________

Link to comment
Share on other sites

I'm wondering what other peoples emails are like, as the email sent to the vendor is a formatted html layout with a table detailing the goods, :) however the email sent to the customer is non formatted. Is this the same as everyone else? :'( If not, any ideas on what's gone wrong please?

 

I've only installed Email Invoice 1.0 (no editing contribs) but I'm also using MVS and Easy Populate

 

 

Thanks

 

Steve

____________________________________________________________________

____________________________________________________________________

Link to comment
Share on other sites

I'm wondering what other peoples emails are like, as the email sent to the vendor is a formatted html layout with a table detailing the goods, :) however the email sent to the customer is non formatted. Is this the same as everyone else? :'( If not, any ideas on what's gone wrong please?

 

I've only installed Email Invoice 1.0 (no editing contribs) but I'm also using MVS and Easy Populate

Thanks

 

Steve

 

I do believe that it sends the email out in 2 formats.... one for customers that can get HTML or are set up to receive HTML emails, and then the HTML format.

 

If you are set up for HTML, you get (displayed) the HTML version. If you are set up for text only, you get the text version.

 

Regarding the comments, I believe I modified it to include comments. I'll see if I can find where I changed this and post back.

Link to comment
Share on other sites

Comments were not added to that template, you need to use the other template of you want the order comments.

 

I'd like the customers comments (from the check out process) shown on the vendors email.

 

Where will I find the 'other template' referred to above, or can any one supply a bit of code to insert the customers comments just below the delivery address.

 

Thanks

 

Steve

 

This is what I have on my email... Not sure what you mean by "VENDOR", but in any case, this text adds the customer comments to the invoice (/includes/modules/email_invoice/templates/invoice.php):

 

<!-- added to try and add comments to invoice-->

<tr>

<td><table border="0" cellspacing="0" cellpadding="2">

<tr>

<td class="main"><b>Order Comments:</b></td>

<td class="main"> <?php

 

$orders_comments_query = tep_db_query("select comments from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . tep_db_input($oID) . "' order by date_added");

 

if (tep_db_num_rows($orders_comments_query)) {

 

while ($orders_comments = tep_db_fetch_array($orders_comments_query)) {

 

if(tep_not_null($orders_comments['comments'])){

 

echo '<tr><td align="left" class="smallText" colspan="8">' . nl2br(tep_db_output($orders_comments['comments'])) . ' </td></tr>';

 

}

 

}

 

}

 

?> </td>

</tr>

</table></td>

</tr>

<!--- added to try and add comments to invoice-->

Link to comment
Share on other sites

I do believe that it sends the email out in 2 formats.... one for customers that can get HTML or are set up to receive HTML emails, and then the HTML format.

 

If you are set up for HTML, you get (displayed) the HTML version. If you are set up for text only, you get the text version.

 

Regarding the comments, I believe I modified it to include comments. I'll see if I can find where I changed this and post back.

Hi Varn,

 

Thanks for your reply.

 

I've currently set the customers and vendors emails to be sent to me whilst testing. The vendor emails arrive in HTML format, but the customers arrive in plain text. Hence my question.

 

In MVS the customer places an order on site, then OsC sends out email orders are sent to the vendors (suppliers of the goods)

 

As far as I know the information in the customer and vendor emails are processed in checkout_process.php. Having said that, I'm going to compare your information with my files, and hopefully come back with a positive result :)

 

Steve

____________________________________________________________________

____________________________________________________________________

Link to comment
Share on other sites

Wow guys I just realized this thread was here, I apologize for not answering some of your questions sooner.

 

@Stevis2002

 

Make sure that in your admin under

 

Configuration -> E-mail Options -> Email Invoice to Customer

 

Make sure that is set to 'true'

 

I am uploading an update that will correct that in the sql statement, I believe it is making it a 1 by default which is incorrect.

 

Sorry about that, it was a typo

 

Well this blows monkey spew.

 

I do not have this 'Email Invoice to Customer' feature in my config options. No wonder I have been pulling my hair out trying to figure out how to change the email info...

 

Anyone got any ideas on which email contributions would allow me to control the outgoing email text better/easier?

 

Also since I am a newbie to the forums and to oscommerce, any suggestions on how to implement contributions would be real swell.

 

Bonkie

Link to comment
Share on other sites

Well this blows monkey spew.

 

I do not have this 'Email Invoice to Customer' feature in my config options. No wonder I have been pulling my hair out trying to figure out how to change the email info...

 

Anyone got any ideas on which email contributions would allow me to control the outgoing email text better/easier?

 

Also since I am a newbie to the forums and to oscommerce, any suggestions on how to implement contributions would be real swell.

 

Bonkie

Hi,

 

In catalog/checkout_process.php there's lost of code. About 3/4 way down I found you can edit the way the vendors email looks (I'm running MVS, with html emails set in admin), a bit lower down is the code for the customers email.

 

So far I've managed to get my vendors emails to be sent out in formatted html, however my customers emails remain in plain text, theough I have got both emails to display information in the way I want... well almost - as I'm still trying to get the customers comments (from the checkout stage of the purchase) to appear in the vendors emails.

 

Whilst you can edit the emails as above, you may need to enter instructions in to other files.

 

I use a free download called wingrep which quickly identifies where bits of text/code is hidden, very useful for project like yours.

 

Steve

____________________________________________________________________

____________________________________________________________________

Link to comment
Share on other sites

Hi,

 

In catalog/checkout_process.php there's lost of code. About 3/4 way down I found you can edit the way the vendors email looks (I'm running MVS, with html emails set in admin), a bit lower down is the code for the customers email.

 

So far I've managed to get my vendors emails to be sent out in formatted html, however my customers emails remain in plain text, theough I have got both emails to display information in the way I want... well almost - as I'm still trying to get the customers comments (from the checkout stage of the purchase) to appear in the vendors emails.

 

Whilst you can edit the emails as above, you may need to enter instructions in to other files.

 

I use a free download called wingrep which quickly identifies where bits of text/code is hidden, very useful for project like yours.

 

Steve

 

E-Mail Transport Method smtp

E-Mail Linefeeds LF

Use MIME HTML When Sending Emails false

Verify E-Mail Addresses Through DNS false

Send E-Mails true

 

Is this the correct setting for the email adn I am using Dreamweaver for updates...

Is Wingrep better? Different?

Link to comment
Share on other sites

E-Mail Transport Method smtp

E-Mail Linefeeds LF

Use MIME HTML When Sending Emails false

Verify E-Mail Addresses Through DNS false

Send E-Mails true

 

Is this the correct setting for the email

Hi,

I tried your settings, however the only change in the customers email, is the link becomes clickable (rather than plain text). The vendors email becomes a mess, as its turns to plain text (as the setting indicates), rather than formatted html. :(

adn I am using Dreamweaver for updates...
Updates for what?
Is Wingrep better? Different?
Better than? It works for me :)

 

Steve

____________________________________________________________________

____________________________________________________________________

Link to comment
Share on other sites

  • 4 months later...

I have just installed this contrib but am geting this error, anyone got any ideas? Have doubled checked everything but can pinpoint the fault.

 

Warning: main(C:/hsphere/local/home/deviltro/asifmohammed.com/admin/includes/languages/english/invoice.php): failed to open stream: No such file or directory in /hsphere/local/home/deviltro/asifmohammed.com/includes/modules/email_invoice/email_invoice.php on line 26

 

Warning: main(C:/hsphere/local/home/deviltro/asifmohammed.com/admin/includes/languages/english/invoice.php): failed to open stream: No such file or directory in /hsphere/local/home/deviltro/asifmohammed.com/includes/modules/email_invoice/email_invoice.php on line 26

 

Fatal error: main(): Failed opening required 'C:/hsphere/local/home/deviltro/asifmohammed.com/admin/includes/languages/english/invoice.php' (include_path='.:/usr/local/lib/php:/usr/local/lib/php/PEAR:/usr/local/share/pear') in /hsphere/local/home/deviltro/asifmohammed.com/includes/modules/email_invoice/email_invoice.php on line 26

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...