Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

PayPal_Shopping_Cart_IPN


devosc

Recommended Posts

The latest contrib version 'still' does use the original osCommerce 'tep_mail' function.

 

Why not post the email stuff you have in the catalog/checkout_process.php, also look in catalog/includes/application_top.php and search for anything to do with including/require email.php and mime.php and post those bits here too.

"Any fool can know. The point is to understand." -- Albert Einstein

Link to comment
Share on other sites

  • Replies 1.1k
  • Created
  • Last Reply

Top Posters In This Topic

:) Oh ok, I'll look into that, change 'MODULE_PAYMENT_PAYPAL_STORE_LOGO_IMAGE_NAME' to 'MODULE_PAYMENT_PAYPAL_STORE_LOGO'

"Any fool can know. The point is to understand." -- Albert Einstein

Link to comment
Share on other sites

post the code here that you inserted in catalog/application_top.php it should say:

// begin PayPal_Shopping_Cart_IPN
  require_once DIR_WS_MODULES . 'payment/paypal/functions.php';
  paypal_check_order_status();
// end PayPal_Shopping_Cart_IPN

"Any fool can know. The point is to understand." -- Albert Einstein

Link to comment
Share on other sites

It is explained in the documentation the reasons for upgrading. However you are free to do as you wish; I've followed the install notes multiple times on multiple different installations on multiple servers, none of which gave that error.

 

Try hard coding the path, instead of require_once DIR_WS_MODULES . 'payment/paypal/functions.php' try

require_once 'includes/modules/payment/paypal/functions.php';

"Any fool can know. The point is to understand." -- Albert Einstein

Link to comment
Share on other sites

In the Paypal configs (at paypal) there is a Payment Data Transfer (on/off) that I don't remember seeing back in the 2.0 days. Now I have upgraded to 2.2, and I dub-checked my paypal settings, and saw this "New(?)" option (or my memory is REALLY bad).

What is the recommened setting, on or off?

--Jeff

Link to comment
Share on other sites

So, off? ;)

Greg the politician. Answers questions without actually answering them. :D

You actually would NOT be a good politician. You do too good a job of supporting your folk (us) and doing what you say you will (supporting IPN). Politicians would never meet up to your standards.

Thanks--

--Jeff

Link to comment
Share on other sites

Why not post the email stuff you have in the catalog/checkout_process.php, also look in catalog/includes/application_top.php and search for anything to do with including/require email.php and mime.php and post those bits here too.

OK here is the stuff from checkout_process.php

 

// lets start with the email confirmation
 $email_order = STORE_NAME . "\n" . 
                EMAIL_SEPARATOR . "\n" . 
                EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
                EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n" .
                EMAIL_TEXT_IP . ' ' . $ip . '   ' . $order->customer['email_address'] . "\n" .
                EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\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);
 }

 

The IP is in the same file from this code

// ADDED BY BURT
 if (getenv('HTTP_X_FORWARDED_FOR')) {
     $ip=getenv('HTTP_X_FORWARDED_FOR');
 }
 else {
     $ip=getenv('REMOTE_ADDR');
 }
// END BURT

 

OK and here is the code from application_top.php

 

// include the mail classes
 require(DIR_WS_CLASSES . 'mime.php');
 require(DIR_WS_CLASSES . 'email.php');

 

Thats all

 

Here is the mime.php

 

<?php
/*
 $Id: mime.php,v 1.8 2003/06/17 17:29:44 dgw_ Exp $

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

 Copyright (c) 2003 osCommerce

 mime.php - a class to assist in building mime-HTML eMails

 The original class was made by Richard Heyes <[email protected]>
 and can be found here: http://www.phpguru.org

 Renamed and Modified by Jan Wildeboer for osCommerce
*/

 class mime {
   var $_encoding;
   var $_subparts;
   var $_encoded;
   var $_headers;
   var $_body;

/**
* Constructor.
* 
* Sets up the object.
*
* @param $body   - The body of the mime part if any.
* @param $params - An associative array of parameters:
*                  content_type - The content type for this part eg multipart/mixed
*                  encoding     - The encoding to use, 7bit, base64, or quoted-printable
*                  cid          - Content ID to apply
*                  disposition  - Content disposition, inline or attachment
*                  dfilename    - Optional filename parameter for content disposition
*                  description  - Content description
* @access public
*/

   function mime($body, $params = '') {
     if ($params == '') $params = array();

// Make sure we use the correct linfeed sequence
     if (EMAIL_LINEFEED == 'CRLF') {
       $this->lf = "\r\n";
     } else {
       $this->lf = "\n";
     }

     reset($params);
     while (list($key, $value) = each($params)) {
       switch ($key) {
         case 'content_type':
           $headers['Content-Type'] = $value . (isset($charset) ? '; charset="' . $charset . '"' : '');
           break;
         case 'encoding':
           $this->_encoding = $value;
           $headers['Content-Transfer-Encoding'] = $value;
           break;
         case 'cid':
           $headers['Content-ID'] = '<' . $value . '>';
           break;
         case 'disposition':
           $headers['Content-Disposition'] = $value . (isset($dfilename) ? '; filename="' . $dfilename . '"' : '');
           break;
         case 'dfilename':
           if (isset($headers['Content-Disposition'])) {
             $headers['Content-Disposition'] .= '; filename="' . $value . '"';
           } else {
             $dfilename = $value;
           }
           break;
         case 'description':
           $headers['Content-Description'] = $value;
           break;
         case 'charset':
           if (isset($headers['Content-Type'])) {
             $headers['Content-Type'] .= '; charset="' . $value . '"';
           } else {
             $charset = $value;
           }
           break;
       }
     }

// Default content-type
     if (!isset($_headers['Content-Type'])) {
       $_headers['Content-Type'] = 'text/plain';
     }

// Assign stuff to member variables
     $this->_encoded = array();
/* HPDL PHP3 */
//      $this->_headers  =& $headers;
     $this->_headers = $headers;
     $this->_body = $body;
   }

/**
* encode()
* 
* Encodes and returns the email. Also stores
* it in the encoded member variable
*
* @return An associative array containing two elements,
*         body and headers. The headers element is itself
*         an indexed array.
* @access public
*/

   function encode() {
/* HPDL PHP3 */
//      $encoded =& $this->_encoded;
     $encoded = $this->_encoded;

     if (tep_not_null($this->_subparts)) {
       $boundary = '=_' . md5(uniqid(tep_rand()) . microtime());
       $this->_headers['Content-Type'] .= ';' . $this->lf . chr(9) . 'boundary="' . $boundary . '"';

// Add body parts to $subparts
       for ($i=0; $i<count($this->_subparts); $i++) {
         $headers = array();
/* HPDL PHP3 */
//          $tmp = $this->_subparts[$i]->encode();
         $_subparts = $this->_subparts[$i];
         $tmp = $_subparts->encode();

         reset($tmp['headers']);
         while (list($key, $value) = each($tmp['headers'])) {
           $headers[] = $key . ': ' . $value;
         }

         $subparts[] = implode($this->lf, $headers) . $this->lf . $this->lf . $tmp['body'];
       }

       $encoded['body'] = '--' . $boundary . $this->lf . implode('--' . $boundary . $this->lf, $subparts) . '--' . $boundary.'--' . $this->lf;
     } else {
       $encoded['body'] = $this->_getEncodedData($this->_body, $this->_encoding) . $this->lf;
     }

// Add headers to $encoded
/* HPDL PHP3 */
//      $encoded['headers'] =& $this->_headers;
     $encoded['headers'] = $this->_headers;

     return $encoded;
   }

/**
* &addSubPart()
* 
* Adds a subpart to current mime part and returns
* a reference to it
*
* @param $body   The body of the subpart, if any.
* @param $params The parameters for the subpart, same
*                as the $params argument for constructor.
* @return A reference to the part you just added. It is
*         crucial if using multipart/* in your subparts that
*         you use =& in your script when calling this function,
*         otherwise you will not be able to add further subparts.
* @access public
*/

/* HPDL PHP3 */
//    function &addSubPart($body, $params) {
   function addSubPart($body, $params) {
     $this->_subparts[] = new mime($body, $params);

     return $this->_subparts[count($this->_subparts) - 1];
   }

/**
* _getEncodedData()
* 
* Returns encoded data based upon encoding passed to it
*
* @param $data     The data to encode.
* @param $encoding The encoding type to use, 7bit, base64,
*                  or quoted-printable.
* @access private
*/

   function _getEncodedData($data, $encoding) {
     switch ($encoding) {
      case '7bit':
        return $data;
        break;
      case 'quoted-printable':
        return $this->_quotedPrintableEncode($data);
        break;
      case 'base64':
        return rtrim(chunk_split(base64_encode($data), 76, $this->lf));
        break;
     }
   }

/**
* quoteadPrintableEncode()
* 
* Encodes data to quoted-printable standard.
*
* @param $input    The data to encode
* @param $line_max Optional max line length. Should 
*                  not be more than 76 chars
*
* @access private
*/

   function _quotedPrintableEncode($input , $line_max = 76) {
     $lines = preg_split("/\r\n|\r|\n/", $input);
     $eol = $this->lf;
     $escape = '=';
     $output = '';

     while (list(, $line) = each($lines)) {
       $linlen = strlen($line);
       $newline = '';

       for ($i = 0; $i < $linlen; $i++) {
         $char = substr($line, $i, 1);
         $dec = ord($char);

// convert space at eol only
         if ( ($dec == 32) && ($i == ($linlen - 1)) ) {
           $char = '=20';
         } elseif ($dec == 9) {
// Do nothing if a tab.
         } elseif ( ($dec == 61) || ($dec < 32 ) || ($dec > 126) ) {
           $char = $escape . strtoupper(sprintf('%02s', dechex($dec)));
         }

// $this->lf is not counted
         if ((strlen($newline) + strlen($char)) >= $line_max) {
// soft line break; " =\r\n" is okay
           $output .= $newline . $escape . $eol;
           $newline = '';
         }
         $newline .= $char;
       }
       $output .= $newline . $eol;
     }
// Don't want last crlf
     $output = substr($output, 0, -1 * strlen($eol));

     return $output;
   }
 }
?>

 

And here is the email.php

 

<?php
/*
 $Id: email.php,v 1.12 2003/06/17 17:29:44 dgw_ Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License

 mail.php - a class to assist in building mime-HTML eMails

 The original class was made by Richard Heyes <[email protected]>
 and can be found here: http://www.phpguru.org

 Renamed and Modified by Jan Wildeboer for osCommerce
*/

 class email {
   var $html;
   var $text;
   var $output;
   var $html_text;
   var $html_images;
   var $image_types;
   var $build_params;
   var $attachments;
   var $headers;

   function email($headers = '') {
     if ($headers == '') $headers = array();

     $this->html_images = array();
     $this->headers = array();

     if (EMAIL_LINEFEED == 'CRLF') {
       $this->lf = "\r\n";
     } else {
       $this->lf = "\n";
     }

/**
* If you want the auto load functionality
* to find other mime-image/file types, add the
* extension and content type here.
*/

     $this->image_types = array('gif' => 'image/gif',
                                'jpg' => 'image/jpeg',
                                'jpeg' => 'image/jpeg',
                                'jpe' => 'image/jpeg',
                                'bmp' => 'image/bmp',
                                'png' => 'image/png',
                                'tif' => 'image/tiff',
                                'tiff' => 'image/tiff',
                                'swf' => 'application/x-shockwave-flash');

     $this->build_params['html_encoding'] = 'quoted-printable';
     $this->build_params['text_encoding'] = '7bit';
     $this->build_params['html_charset'] = constant('CHARSET');
     $this->build_params['text_charset'] = constant('CHARSET');
     $this->build_params['text_wrap'] = 998;

/**
* Make sure the MIME version header is first.
*/

     $this->headers[] = 'MIME-Version: 1.0';

     reset($headers);
     while (list(,$value) = each($headers)) {
       if (tep_not_null($value)) {
         $this->headers[] = $value;
       }
     }
   }

/**
* This function will read a file in
* from a supplied filename and return
* it. This can then be given as the first
* argument of the the functions
* add_html_image() or add_attachment().
*/

   function get_file($filename) {
     $return = '';

     if ($fp = fopen($filename, 'rb')) {
       while (!feof($fp)) {
         $return .= fread($fp, 1024);
       }
       fclose($fp);

       return $return;
     } else {
       return false;
     }
   }

/**
* Function for extracting images from
* html source. This function will look
* through the html code supplied by add_html()
* and find any file that ends in one of the
* extensions defined in $obj->image_types.
* If the file exists it will read it in and
* embed it, (not an attachment).
*
* Function contributed by Dan Allen
*/

   function find_html_images($images_dir) {
// Build the list of image extensions
     while (list($key, ) = each($this->image_types)) {
       $extensions[] = $key;
     }

     preg_match_all('/"([^"]+\.(' . implode('|', $extensions).'))"/Ui', $this->html, $images);

     for ($i=0; $i<count($images[1]); $i++) {
       if (file_exists($images_dir . $images[1][$i])) {
         $html_images[] = $images[1][$i];
         $this->html = str_replace($images[1][$i], basename($images[1][$i]), $this->html);
       }
     }

     if (tep_not_null($html_images)) {
// If duplicate images are embedded, they may show up as attachments, so remove them.
       $html_images = array_unique($html_images);
       sort($html_images);

       for ($i=0; $i<count($html_images); $i++) {
         if ($image = $this->get_file($images_dir . $html_images[$i])) {
           $content_type = $this->image_types[substr($html_images[$i], strrpos($html_images[$i], '.') + 1)];
           $this->add_html_image($image, basename($html_images[$i]), $content_type);
         }
       }
     }
   }

/**
* Adds plain text. Use this function
* when NOT sending html email
*/

   function add_text($text = '') {
     $this->text = tep_convert_linefeeds(array("\r\n", "\n", "\r"), $this->lf, $text);
   }

/**
* Adds a html part to the mail.
* Also replaces image names with
* content-id's.
*/

   function add_html($html, $text = NULL, $images_dir = NULL) {
     $this->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);
   }

/**
* Adds an image to the list of embedded
* images.
*/

   function add_html_image($file, $name = '', $c_type='application/octet-stream') {
     $this->html_images[] = array('body' => $file,
                                  'name' => $name,
                                  'c_type' => $c_type,
                                  'cid' => md5(uniqid(time())));
   }

/**
* Adds a file to the list of attachments.
*/

   function add_attachment($file, $name = '', $c_type='application/octet-stream', $encoding = 'base64') {
     $this->attachments[] = array('body' => $file,
                                  'name' => $name,
                                  'c_type' => $c_type,
                                  'encoding' => $encoding);
   }

/**
* Adds a text subpart to a mime_part object
*/

/* HPDL PHP3 */
//    function &add_text_part(&$obj, $text) {
   function add_text_part(&$obj, $text) {
     $params['content_type'] = 'text/plain';
     $params['encoding'] = $this->build_params['text_encoding'];
     $params['charset'] = $this->build_params['text_charset'];

     if (is_object($obj)) {
       return $obj->addSubpart($text, $params);
     } else {
       return new mime($text, $params);
     }
   }

/**
* Adds a html subpart to a mime_part object
*/

/* HPDL PHP3 */
//    function &add_html_part(&$obj) {
   function add_html_part(&$obj) {
     $params['content_type'] = 'text/html';
     $params['encoding'] = $this->build_params['html_encoding'];
     $params['charset'] = $this->build_params['html_charset'];

     if (is_object($obj)) {
       return $obj->addSubpart($this->html, $params);
     } else {
       return new mime($this->html, $params);
     }
   }

/**
* Starts a message with a mixed part
*/

/* HPDL PHP3 */
//    function &add_mixed_part() {
   function add_mixed_part() {
     $params['content_type'] = 'multipart/mixed';

     return new mime('', $params);
   }

/**
* Adds an alternative part to a mime_part object
*/

/* HPDL PHP3 */
//    function &add_alternative_part(&$obj) {
   function add_alternative_part(&$obj) {
     $params['content_type'] = 'multipart/alternative';

     if (is_object($obj)) {
       return $obj->addSubpart('', $params);
     } else {
       return new mime('', $params);
     }
   }

/**
* Adds a html subpart to a mime_part object
*/

/* HPDL PHP3 */
//    function &add_related_part(&$obj) {
   function add_related_part(&$obj) {
     $params['content_type'] = 'multipart/related';

     if (is_object($obj)) {
       return $obj->addSubpart('', $params);
     } else {
       return new mime('', $params);
     }
   }

/**
* Adds an html image subpart to a mime_part object
*/

/* HPDL PHP3 */
//    function &add_html_image_part(&$obj, $value) {
   function add_html_image_part(&$obj, $value) {
     $params['content_type'] = $value['c_type'];
     $params['encoding'] = 'base64';
     $params['disposition'] = 'inline';
     $params['dfilename'] = $value['name'];
     $params['cid'] = $value['cid'];

     $obj->addSubpart($value['body'], $params);
   }

/**
* Adds an attachment subpart to a mime_part object
*/

/* HPDL PHP3 */
//    function &add_attachment_part(&$obj, $value) {
   function add_attachment_part(&$obj, $value) {
     $params['content_type'] = $value['c_type'];
     $params['encoding'] = $value['encoding'];
     $params['disposition'] = 'attachment';
     $params['dfilename'] = $value['name'];

     $obj->addSubpart($value['body'], $params);
   }

/**
* Builds the multipart message from the
* list ($this->_parts). $params is an
* array of parameters that shape the building
* of the message. Currently supported are:
*
* $params['html_encoding'] - The type of encoding to use on html. Valid options are
*                            "7bit", "quoted-printable" or "base64" (all without quotes).
*                            7bit is EXPRESSLY NOT RECOMMENDED. Default is quoted-printable
* $params['text_encoding'] - The type of encoding to use on plain text Valid options are
*                            "7bit", "quoted-printable" or "base64" (all without quotes).
*                            Default is 7bit
* $params['text_wrap']     - The character count at which to wrap 7bit encoded data.
*                            Default this is 998.
* $params['html_charset']  - The character set to use for a html section.
*                            Default is iso-8859-1
* $params['text_charset']  - The character set to use for a text section.
*                          - Default is iso-8859-1
*/

/* HPDL PHP3 */
//    function build_message($params = array()) {
   function build_message($params = '') {
     if ($params == '') $params = array();

     if (count($params) > 0) {
       reset($params);
       while(list($key, $value) = each($params)) {
         $this->build_params[$key] = $value;
       }
     }

     if (tep_not_null($this->html_images)) {
       reset($this->html_images);
       while (list(,$value) = each($this->html_images)) {
         $this->html = str_replace($value['name'], 'cid:' . $value['cid'], $this->html);
       }
     }

     $null = NULL;
     $attachments = ((tep_not_null($this->attachments)) ? true : false);
     $html_images = ((tep_not_null($this->html_images)) ? true : false);
     $html = ((tep_not_null($this->html)) ? true : false);
     $text = ((tep_not_null($this->text)) ? true : false);

     switch (true) {
       case (($text == true) && ($attachments == false)):
/* HPDL PHP3 */
//          $message =& $this->add_text_part($null, $this->text);
         $message = $this->add_text_part($null, $this->text);
         break;
       case (($text == false) && ($attachments == true) && ($html == false)):
/* HPDL PHP3 */
//          $message =& $this->add_mixed_part();
         $message = $this->add_mixed_part();

         for ($i=0; $i<count($this->attachments); $i++) {
           $this->add_attachment_part($message, $this->attachments[$i]);
         }
         break;
       case (($text == true) && ($attachments == true)):
/* HPDL PHP3 */
//          $message =& $this->add_mixed_part();
         $message = $this->add_mixed_part();
         $this->add_text_part($message, $this->text);

         for ($i=0; $i<count($this->attachments); $i++) {
           $this->add_attachment_part($message, $this->attachments[$i]);
         }
         break;
       case (($html == true) && ($attachments == false) && ($html_images == false)):
         if (tep_not_null($this->html_text)) {
/* HPDL PHP3 */
//            $message =& $this->add_alternative_part($null);
           $message = $this->add_alternative_part($null);
           $this->add_text_part($message, $this->html_text);
           $this->add_html_part($message);
         } else {
/* HPDL PHP3 */
//            $message =& $this->add_html_part($null);
           $message = $this->add_html_part($null);
         }
         break;
       case (($html == true) && ($attachments == false) && ($html_images == true)):
         if (tep_not_null($this->html_text)) {
/* HPDL PHP3 */
//            $message =& $this->add_alternative_part($null);
           $message = $this->add_alternative_part($null);
           $this->add_text_part($message, $this->html_text);
/* HPDL PHP3 */
//            $related =& $this->add_related_part($message);
           $related = $this->add_related_part($message);
         } else {
/* HPDL PHP3 */
//            $message =& $this->add_related_part($null);
//            $related =& $message;
           $message = $this->add_related_part($null);
           $related = $message;
         }
         $this->add_html_part($related);

         for ($i=0; $i<count($this->html_images); $i++) {
           $this->add_html_image_part($related, $this->html_images[$i]);
         }
         break;
       case (($html == true) && ($attachments == true) && ($html_images == false)):
/* HPDL PHP3 */
//          $message =& $this->add_mixed_part();
         $message = $this->add_mixed_part();
         if (tep_not_null($this->html_text)) {
/* HPDL PHP3 */
//            $alt =& $this->add_alternative_part($message);
           $alt = $this->add_alternative_part($message);
           $this->add_text_part($alt, $this->html_text);
           $this->add_html_part($alt);
         } else {
           $this->add_html_part($message);
         }

         for ($i=0; $i<count($this->attachments); $i++) {
           $this->add_attachment_part($message, $this->attachments[$i]);
         }
         break;
       case (($html == true) && ($attachments == true) && ($html_images == true)):
/* HPDL PHP3 */
//          $message =& $this->add_mixed_part();
         $message = $this->add_mixed_part();

         if (tep_not_null($this->html_text)) {
/* HPDL PHP3 */
//            $alt =& $this->add_alternative_part($message);
           $alt = $this->add_alternative_part($message);
           $this->add_text_part($alt, $this->html_text);
/* HPDL PHP3 */
//            $rel =& $this->add_related_part($alt);
           $rel = $this->add_related_part($alt);
         } else {
/* HPDL PHP3 */
//            $rel =& $this->add_related_part($message);
           $rel = $this->add_related_part($message);
         }
         $this->add_html_part($rel);

         for ($i=0; $i<count($this->html_images); $i++) {
           $this->add_html_image_part($rel, $this->html_images[$i]);
         }

         for ($i=0; $i<count($this->attachments); $i++) {
           $this->add_attachment_part($message, $this->attachments[$i]);
         }
         break;
     }

     if ( (isset($message)) && (is_object($message)) ) {
       $output = $message->encode();
       $this->output = $output['body'];

       reset($output['headers']);
       while (list($key, $value) = each($output['headers'])) {
         $headers[] = $key . ': ' . $value;
       }

       $this->headers = array_merge($this->headers, $headers);

       return true;
     } else {
       return false;
     }
   }

/**
* Sends the mail.
*/

   function send($to_name, $to_addr, $from_name, $from_addr, $subject = '', $headers = '') {
     $to = (($to_name != '') ? '"' . $to_name . '" <' . $to_addr . '>' : $to_addr);
     $from = (($from_name != '') ? '"' . $from_name . '" <' . $from_addr . '>' : $from_addr);

     if (is_string($headers)) {
       $headers = explode($this->lf, trim($headers));
     }

     for ($i=0; $i<count($headers); $i++) {
       if (is_array($headers[$i])) {
         for ($j=0; $j<count($headers[$i]); $j++) {
           if ($headers[$i][$j] != '') {
             $xtra_headers[] = $headers[$i][$j];
           }
         }
       }

       if ($headers[$i] != '') {
         $xtra_headers[] = $headers[$i];
       }
     }

     if (!isset($xtra_headers)) {
       $xtra_headers = array();
     }

     if (EMAIL_TRANSPORT == 'smtp') {
       return mail($to_addr, $subject, $this->output, 'From: ' . $from . $this->lf . 'To: ' . $to . $this->lf . implode($this->lf, $this->headers) . $this->lf . implode($this->lf, $xtra_headers));
     } else {
       return mail($to, $subject, $this->output, 'From: '.$from.$this->lf.implode($this->lf, $this->headers).$this->lf.implode($this->lf, $xtra_headers));
     }
   }

/**
* Use this method to return the email
* in message/rfc822 format. Useful for
* adding an email to another email as
* an attachment. there's a commented
* out example in example.php.
*
* string get_rfc822(string To name,
*       string To email,
*       string From name,
*       string From email,
*       [string Subject,
*        string Extra headers])
*/

   function get_rfc822($to_name, $to_addr, $from_name, $from_addr, $subject = '', $headers = '') {
// Make up the date header as according to RFC822
     $date = 'Date: ' . date('D, d M y H:i:s');
     $to = (($to_name != '') ? 'To: "' . $to_name . '" <' . $to_addr . '>' : 'To: ' . $to_addr);
     $from = (($from_name != '') ? 'From: "' . $from_name . '" <' . $from_addr . '>' : 'From: ' . $from_addr);

     if (is_string($subject)) {
       $subject = 'Subject: ' . $subject;
     }

     if (is_string($headers)) {
       $headers = explode($this->lf, trim($headers));
     }

     for ($i=0; $i<count($headers); $i++) {
       if (is_array($headers[$i])) {
         for ($j=0; $j<count($headers[$i]); $j++) {
           if ($headers[$i][$j] != '') {
             $xtra_headers[] = $headers[$i][$j];
           }
         }
       }

       if ($headers[$i] != '') {
         $xtra_headers[] = $headers[$i];
       }
     }

     if (!isset($xtra_headers)) {
       $xtra_headers = array();
     }

     $headers = array_merge($this->headers, $xtra_headers);

     return $date . $this->lf . $from . $this->lf . $to . $this->lf . $subject . $this->lf . implode($this->lf, $headers) . $this->lf . $this->lf . $this->output;
   }
 }
?>

 

Forgotten anything ??

 

Sorry for the long posting :ph34r:

Thanks Matthias

Link to comment
Share on other sites

Hey, I installed this contribution and it works great, except for the order e-mail. When a customer places an order, the order process e-mail is sent with no customer information. Here is what it looks like:

 

Modstore.com
------------------------------------------------------
Order Number: 555555
Detailed Invoice: http://modstore.com/account_history_info.php?order_id=555555
Date Ordered: Saturday 01 May, 2004

Products
------------------------------------------------------
1 x test item () = $15.99
------------------------------------------------------
Sub-Total: $15.99
United States Postal Service (1 x 1.15lbs) (Priority (2 - 3 Days)): $3.95
Total: $19.94

Delivery Address
------------------------------------------------------


, 


Billing Address
------------------------------------------------------


, 


Payment Method
------------------------------------------------------
PayPal

 

Has anyone else experienced this problem or does anyone know how to fix it?

Link to comment
Share on other sites

Hi, when you checkout and get to the PayPal page, open up phpMyAdmin and look at that order in the 'orders_session_info' table, verify that the sendto and billto values correspond to the values associated to that customer in the address_book table.

Recently someone had a similar issue and the above seemed to be the cause, which was not resolved (due to time...), might seem strange but for some reason those session values where not being stored (they're used during the checkout sequence), what you could try instead of '$sendto' and '$billto' is $GLOBALS['sendto'] and $GLOBALS['billto'] in paypal/checkout_process.php.

"Any fool can know. The point is to understand." -- Albert Einstein

Link to comment
Share on other sites

Greg is there a way you could write an .sql file that would remove all previous unnecessary tables from other IPNs? I think my problems are coming from having the old IPN table info and all those files but I don't know what to remove. If you could write a set of uninstall instructions for previous versions (1.5 in my case) that would be awesome.

Link to comment
Share on other sites

Greg I am going back to 1.5 because I am having nothing but problems with this new IPN of yours. I don't know what you have going on but I followed it step by step and didnt miss anything and I'm getting errors out the wazoo. I'm sick of this. You definitely did not make it upgrade friendly.

Link to comment
Share on other sites

Recently someone had a similar issue and the above seemed to be the cause, which was not resolved (due to time...), might seem strange but for some reason those session values where not being stored (they're used during the checkout sequence), what you could try instead of '$sendto' and '$billto' is $GLOBALS['sendto'] and $GLOBALS['billto'] in paypal/checkout_process.php.

 

I have a problem with my installation not sending emails. I checked this, and in the order_session_info, it shows sento and billto as number 6, but the customer is number 5. (I know, becuase this is the only customer I have).

 

Exactly what should be changed in paypal/checkout_process.php ?

 

Otherwise, except from the mail not being sent, it works as expected (my IPN gets back etc...)

 

Regards,

 

Rune

Link to comment
Share on other sites

In theory you shouldn't have to change anything at all, what needs to be done is to debug/examine your environment, in particular when calling paypal/checkout_process.php a

print_r($GLOBALS); exit;

needs to be performed so that one can see the state and values of your local environemt including the session vars.

 

However in paypal/checkout_process.php what you could try is changing

  $sql_data_array = array('sendto' => $sendto,
                         'billto' => $billto,

to

  $sql_data_array = array('sendto' => $GLOBALS['sendto'],
                         'billto' => $GLOBALS['billto'],

"Any fool can know. The point is to understand." -- Albert Einstein

Link to comment
Share on other sites

I had V 2.0 working and decided to install V 2.2. Somewhere during that process, my host went down. When it came back up, my site was trashed. I finally got it straightened out, I hope, but I have no idea what the status if this conributions is. It doesn't seem to be working correctly but that may be that things have changed with the new version.

 

My main concern is that when I view an order in admin, the order number is not displayed. Is this normal? I can't remember what it normally looks like but I thought the order number used to be displayed.

 

Also, when I run the test I get the ipn.php page that says the test was completed successfully. Is this page meant to be displayed just for this test or will this be what customers see?

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Hi Jack,

 

I would suggest that you go through the install documentation of 2.2 again, and carefully verify that you have what is there. v2.2 will be the standard base for the near future (I tried to minimize the number of db queries required - although caching such queries is possible I think that this will now be left to MS3).

 

The order numbers are not really explicitly shown in the an actual page of that order in admin/orders.php, what you would normally have to do is try and identify the order # from the list of orders. You should see the order # in the list of IPNs too.

 

No your customer's will not see that 'Completed Test' results page, go through the checkout process to confirm.

"Any fool can know. The point is to understand." -- Albert Einstein

Link to comment
Share on other sites

Thanks for the reply Gregory. Then my install is pobably ok. I won't be able to test it live till next week. But I think I may have parts of both versions installed since I experienced the problem when it went down. It is probably ok to leave it as is but I guess I should go through and remove all of it and start from scratch. <groan>

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Hello,

 

I just installed PayPal_Shopping_Cart_IPN, everything went fine. Thanks a lot for this great contribution. I have a few questions.

 

1) How do I test paypal? When I tried to buy something, I get redirected to paypal and paypal asks me to login. If I login with my real user password , it will charge my actual credit card. so how do I test this IPN module?

 

2) Is there anyway, I can make the user to buy the products without having to create a paypal account?

 

3) Is there anyway we can hide the whole paypal thing from user and just make the user experience like they just enter the credit card and buy the products?

 

Thanks

Ben

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...