Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

nixona

Archived
  • Posts

    26
  • Joined

  • Last visited

Profile Information

  • Real Name
    Alex Nixon

nixona's Achievements

  1. I've been posting over in the installation and support forum, but maybe the guys who deal more indepth with this stuff can shed some light. I installed the SMTP Authentication mod and all the mail sends. Only the contact us emails have issues, and it's just that something somewhere is cutting off the first line of the emails. So if I use the contact us form and make an email that says: Line 1 Line 2 Line 3 Line 4 etc etc etc Everything but Line 1 shows up. In the admin config email options I have mail transport method at SMTP, Email Linefeeds are CRLF, Use MIME is false, Verify Email is false, Send Email is true. Here's my email.php I feel like the problem is in there: <?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 = '') { if ((strstr($to_name, "\n") != false) || (strstr($to_name, "\r") != false)) { return false; } if ((strstr($to_addr, "\n") != false) || (strstr($to_addr, "\r") != false)) { return false; } if ((strstr($subject, "\n") != false) || (strstr($subject, "\r") != false)) { return false; } if ((strstr($from_name, "\n") != false) || (strstr($from_name, "\r") != false)) { return false; } if ((strstr($from_addr, "\n") != false) || (strstr($from_addr, "\r") != false)) { return false; } $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') { include_once("Mail.php"); $headers["From"] = $from; $headers["To"] = $to_addr; $headers["Subject"] = $subject; $params["host"] = "xxxxxxxxxxx"; $params["port"] = "80"; $params["auth"] = true; $params["username"] = "xxxxxxxxxxxxx"; $params["password"] = "xxxxxxxxxxx"; // Create the mail object using the Mail::factory method $mail_object =& Mail::factory("smtp", $params); return $mail_object->send($to_addr, $headers, $this->output); } } /** * 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; } } ?> Interestingly enough if I change it to MIME I get the entire message with the junk MIME header at the bottom. Any help would be much appreciated. Thanks.
  2. Hi, I've got half of this contribution working. But the admin side is not. Using Compare and Merge I copied everything from the latest version over to email.php in /catalog/admin/includes/classes and filled in the server and login information. Unfortunately I'm getting: Fatal error: Cannot redeclare tep_db_connect() (previously declared in C:\web\catalog\admin\includes\functions\database.php:13) in C:\web\catalog\admin\includes\functions\database.php on line 25 Everything else is working fine, I think I'm just missing something VERY basic in the email.php file...anybody have experience with this contrib that can help with this? Here's my email.php code: <?php /* $Id: email.php,v 1.8 2003/06/11 22:24:34 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') { include_once("Mail.php"); $user_contact = '[email protected]'; $headers["From"] = $from; $headers["To"] = $to_addr; $headers["Subject"] = $subject; $headers["Bcc"] = ""; $params["host"] = "xxxxx.smtpserver"; $params["port"] = "xx"; $params["auth"] = true; $params["username"] = "username"; $params["password"] = "password"; // Create the mail object using the Mail::factory method $mail_object =& Mail::factory("smtp", $params); return $mail_object->send("$to_addr, ", $headers, $this->output); } } /** * 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; } } ?>
  3. Sorry to get off topic here. My new products are not displaying correctly. The box shows up but there are no images or titles, simply $0.00. I swear I've seen this talked about before but can't find it now...I double checked products_new and it matches the version from 4.1.4, I'm probably missing something stupid again... <?php /* $Id: products_new.php,v 1.27 2003/06/09 22:35:33 hpdl Exp $ adapted for Separate Pricing Per Customer v3.6 2005/02/09 osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCTS_NEW); $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_PRODUCTS_NEW)); ?> <!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> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" width="100%" cellspacing="3" cellpadding="3"> <tr> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table></td> <!-- body_text //--> <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_products_new.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php $products_new_array = array(); $products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name"; $products_new_split = new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW); if (($products_new_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3'))) { ?> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="smallText"><?php echo $products_new_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS_NEW); ?></td> <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $products_new_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } ?> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <?php if ($products_new_split->number_of_rows > 0) { // BOF Separate Price Per Customer // global variable (session): $sppc_customers_group_id -> local variable $customer_group_id if(!tep_session_is_registered('sppc_customer_group_id')) { $customer_group_id = '0'; } else { $customer_group_id = $sppc_customer_group_id; } $products_new_query = tep_db_query($products_new_split->sql_query); $no_of_products_new = tep_db_num_rows($products_new_query); while ($_products_new = tep_db_fetch_array($products_new_query)) { $products_new[] = $_products_new; $list_of_prdct_ids[] = $_products_new['products_id']; } $select_list_of_prdct_ids = "products_id = '".$list_of_prdct_ids[0]."' "; if ($no_of_products_new > 1) { for ($n = 1; $n < count($list_of_prdct_ids); $n++) { $select_list_of_prdct_ids .= "or products_id = '".$list_of_prdct_ids[$n]."' "; } } // get all customers_group_prices for products with the particular customer_group_id // however not necessary for customer_group_id if ($customer_group_id != '0') { $pg_query = tep_db_query("select pg.products_id, customers_group_price as price from " . TABLE_PRODUCTS_GROUPS . " pg where (".$select_list_of_prdct_ids.") and pg.customers_group_id = '".$customer_group_id."'"); while ($pg_array = tep_db_fetch_array($pg_query)) { $new_prices[] = array ('products_id' => $pg_array['products_id'], 'products_price' => $pg_array['price'], 'specials_new_products_price' => ''); } for ($x = 0; $x < $no_of_products_new; $x++) { // replace products prices with those from customers_group table // originally they would be obtained with an extra query for every new product: // if ($new_price = tep_get_products_special_price($products_new['products_id'])) { if(!empty($new_prices)) { for ($i = 0; $i < count($new_prices); $i++) { if( $products_new[$x]['products_id'] == $new_prices[$i]['products_id'] ) { $products_new[$x]['products_price'] = $new_prices[$i]['products_price']; } } } // end if(!empty($new_prices) } // end for ($x = 0; $x < $no_of_products_new; $x++) } // end if ($customer_group_id != '0') // an extra query is needed for all the specials $specials_query = tep_db_query("select s.products_id, specials_new_products_price from " . TABLE_SPECIALS . " s where (".$select_list_of_prdct_ids.") and status = '1' and s.customers_group_id = '" .$customer_group_id. "'"); while ($specials_array = tep_db_fetch_array($specials_query)) { $new_prices[] = array ('products_id' => $specials_array['products_id'], 'products_price' => '', 'specials_new_products_price' => $specials_array['specials_new_products_price']); } // replace specials_new_products_price with those those for the customers_group_id for ($x = 0; $x < $no_of_products_new; $x++) { if(!empty($new_prices)) { for ($i = 0; $i < count($new_prices); $i++) { if( $products_new[$x]['products_id'] == $new_prices[$i]['products_id'] ) { $products_new[$x]['specials_new_products_price'] = $new_prices[$i]['specials_new_products_price']; } } } // end if(!empty($new_prices) // } // end for ($x = 0; $x < $no_of_products_new; $x++) if (tep_not_null($products_new[$x]['specials_new_products_price'])) { $products_price = '<s>' . $currencies->display_price($products_new[$x]['products_price'], tep_get_tax_rate($products_new[$x]['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($products_new[$x]['specials_new_products_price'], tep_get_tax_rate($products_new[$x]['products_tax_class_id'])) . '</span>'; } else { $products_price = $currencies->display_price($products_new[$x]['products_price'], tep_get_tax_rate($products_new[$x]['products_tax_class_id'])); } ?> <tr> <td width="<?php echo SMALL_IMAGE_WIDTH + 10; ?>" valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $products_new[$x]['products_image'], $products_new[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; ?></td> <td valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new[$x]['products_id']) . '"><b><u>' . $products_new[$x]['products_name'] . '</u></b></a><br>' . TEXT_DATE_ADDED . ' ' . tep_date_long($products_new[$x]['products_date_added']) . '<br>' . TEXT_MANUFACTURER . ' ' . $products_new[$x]['manufacturers_name'] . '<br><br>' . TEXT_PRICE . ' ' . $products_price; ?></td> <td align="right" valign="middle" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_new[$x]['products_id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a>'; ?></td> </tr> <tr> <td colspan="3"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php // EOF Separate Pricing Per Customer } // end for ($x = 0; $x < $products_new_split->number_of_rows; $x++) } else { ?> <tr> <td class="main"><?php echo TEXT_NO_NEW_PRODUCTS; ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } ?> </table></td> </tr> <?php if (($products_new_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) { ?> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="smallText"><?php echo $products_new_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS_NEW); ?></td> <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $products_new_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td> </tr> </table></td> </tr> <?php } ?> </table></td> <!-- body_text_eof //--> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- right_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?> <!-- right_navigation_eof //--> </table></td> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> <br> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
  4. AHA! After a few more minor changes it now works like a charm! Attention everyone, here's the code to add to \catalog\admin\includes\functions\html_output.php //draw products multiselect box function tep_draw_products_mselect($name, $parameters = '', $selected_vals) { global $currencies, $languages_id; if ($exclude == '') { $exclude = array(); } $select_string = '<select name="' . $name . '"'; if ($parameters) $select_string .= ' ' . $parameters; $select_string .= ' multiple>'; // BOF - Separate_Pricing_Per_Customer_v4.1.x $all_groups=array(); $customers_groups_query = tep_db_query("select customers_group_name, customers_group_id from " . TABLE_CUSTOMERS_GROUPS . " order by customers_group_id "); while ($existing_groups = tep_db_fetch_array($customers_groups_query)) { $all_groups[$existing_groups['customers_group_id']]=$existing_groups['customers_group_name']; } $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_price, p.products_model from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by products_model"); while ($products = tep_db_fetch_array($products_query)) { // BOF - Separate_Pricing_Per_Customer_v3.5 // Next lines were original code // if (!in_array($products['products_id'], $exclude)) { // $select_string .= '<option value="' . $products['products_id'] . '">' . $products['products_name'] . ' (' . $currencies->format($products['products_price']) . ')</option>'; // } $price_query=tep_db_query("select customers_group_price, customers_group_id from " . TABLE_PRODUCTS_GROUPS . " where products_id = " . $products['products_id']); $product_prices=array(); while($prices_array=tep_db_fetch_array($price_query)){ $product_prices[$prices_array['customers_group_id']]=$prices_array['customers_group_price']; } reset($all_groups); $price_string=""; $sde=0; while(list($sdek,$sdev)=each($all_groups)){ //if (!in_array((int)$products['products_id'].":".(int)$sdek, $exclude)) { if($sde) $price_string.=", "; $price_string.=$sdev.": ".$currencies->format(isset($product_prices[$sdek]) ? $product_prices[$sdek]:$products['products_price']); $sde=1; } //} if (!in_array($products['products_id'], $exclude)) { $select_string .= '<option value="' . $products['products_id'] . '">' . $products['products_model'] . ' ' . $products['products_name'] . ' (' . $price_string . ')</option>\n'; } else { $select_string .= '<option value="' . $products['products_id'] . '" SELECTED>' . $products['products_model'] . ' ' . $products['products_name'] . ' (' . $price_string . ')</option>\n'; } // EOF - Separate_Pricing_Per_Customer_v3.5 } $select_string .= '</select>'; return $select_string; } //draw products multiselect delete box function tep_draw_products_delete_mselect($name, $parameters = '', $selected_vals) { global $currencies, $languages_id; if ($exclude == '') { $exclude = array(); } $select_string = '<select name="' . $name . '"'; if ($parameters) $select_string .= ' ' . $parameters; $select_string .= ' multiple>'; $products_query = tep_db_query("select p.products_id, pd.products_name, s.featured_id, s.featured_date_added, s.featured_last_modified, s.expires_date, s.date_status_change, s.status from " . TABLE_PRODUCTS . " p, " . TABLE_FEATURED . " s, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_id = s.products_id order by pd.products_name"); while ($products = tep_db_fetch_array($products_query)) { $select_string .= '<option value="' . $products['featured_id'] . '">' . $products['products_model'] . ' ' . $products['products_name'].'</option>\n'; } $select_string .= '</select>'; return $select_string; } I have SPPC 4.1.3 and Featured Products 1.5.6 loaded and it all seems to be happily working together now on that end. I still need to go through and test everything else to see what other problems crop up...
  5. UGH, I restored the wrong backup and screwed up a bunch of stuff. OK, now I've gone through and loaded the SPPC 4.1.3, the changes in code on index.php and advanced_search_result.php, loaded the Featured Products 1.5.6, changed the two featured files you mentioned and loaded the altered code you posted earlier this morning. When trying to add featured products in the admin panel my error is now: 1054 - Unknown column 'p.products_code' in 'field list' select p.products_id, pd.products_name, p.products_price, p.products_code from products p, products_description pd where p.products_id = pd.products_id and pd.language_id = '1' order by products_code [TEP STOP] What did I miss?
  6. So I'm starting a computer store and am in need of a configurator. I've looked at the big 3 (Customer PC Creator, PC Pro Creator and CCC) and was just looking for a little advice from a veteran. I'm a total newbie to all of this, but would like several different configurations (ie Budget AMD, Budget Intel, Gaming AMD, Gaming Intel and so on) So let's say I only offer one option for my budget AMD motherboard, whereas my Gaming AMD motherboard would consist of probably 12 different choices. Which contrib would work best with this type of setup?
  7. Yes I've replaced those two files. I added your modified code and now the error is: 1146 - Table 'pcg.table_customers_groups' doesn't exist select customers_group_name, customers_group_id from TABLE_CUSTOMERS_GROUPS order by customers_group_id [TEP STOP] I feel like I'm in SO far over my head...
  8. OK, The main feature I was after here was the ability to have a multiselect box for adding featured product. The contrib had me add the following code to \catalog\admin\includes\functions\html_output.php //draw products multiselect box function tep_draw_products_mselect($name, $parameters = '', $selected_vals) { global $currencies, $languages_id; if ($exclude == '') { $exclude = array(); } $select_string = '<select name="' . $name . '"'; if ($parameters) $select_string .= ' ' . $parameters; $select_string .= ' multiple>'; // BOF - Separate_Pricing_Per_Customer_v3.5 $all_groups=array(); $customers_groups_query = tep_db_query("select distinct customers_group_name, customers_group_id from " . TABLE_CUSTOMERS . " order by customers_group_id "); while ($existing_groups = tep_db_fetch_array($customers_groups_query)) { $all_groups[$existing_groups['customers_group_id']]=$existing_groups['customers_group_name']; } $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_price, p.products_code from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by products_code"); while ($products = tep_db_fetch_array($products_query)) { // BOF - Separate_Pricing_Per_Customer_v3.5 // Next lines were original code // if (!in_array($products['products_id'], $exclude)) { // $select_string .= '<option value="' . $products['products_id'] . '">' . $products['products_name'] . ' (' . $currencies->format($products['products_price']) . ')</option>'; // } $price_query=tep_db_query("select customers_group_price, customers_group_id from " . TABLE_PRODUCTS_GROUPS . " where products_id = " . $products['products_id']); $product_prices=array(); while($prices_array=tep_db_fetch_array($price_query)){ $product_prices[$prices_array['customers_group_id']]=$prices_array['customers_group_price']; } reset($all_groups); $price_string=""; $sde=0; while(list($sdek,$sdev)=each($all_groups)){ //if (!in_array((int)$products['products_id'].":".(int)$sdek, $exclude)) { if($sde) $price_string.=", "; $price_string.=$sdev.": ".$currencies->format(isset($product_prices[$sdek]) ? $product_prices[$sdek]:$products['products_price']); $sde=1; } //} if (!in_array($products['products_id'], $selected_vals)) { $select_string .= '<option value="' . $products['products_id'] . '">' . $products['products_model'] . ' ' . $products['products_name'] . ' (' . $price_string . ')</option>\n'; } else { $select_string .= '<option value="' . $products['products_id'] . '" SELECTED>' . $products['products_model'] . ' ' . $products['products_name'] . ' (' . $price_string . ')</option>\n'; } // EOF - Separate_Pricing_Per_Customer_v3.5 } $select_string .= '</select>'; return $select_string; } //draw products multiselect delete box function tep_draw_products_delete_mselect($name, $parameters = '', $selected_vals) { global $currencies, $languages_id; if ($exclude == '') { $exclude = array(); } $select_string = '<select name="' . $name . '"'; if ($parameters) $select_string .= ' ' . $parameters; $select_string .= ' multiple>'; $products_query = tep_db_query("select p.products_id, pd.products_name, s.featured_id, s.featured_date_added, s.featured_last_modified, s.expires_date, s.date_status_change, s.status from " . TABLE_PRODUCTS . " p, " . TABLE_FEATURED . " s, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_id = s.products_id order by pd.products_name"); while ($products = tep_db_fetch_array($products_query)) { $select_string .= '<option value="' . $products['featured_id'] . '">' . $products['products_model'] . ' ' . $products['products_name'].'</option>\n'; } $select_string .= '</select>'; return $select_string; } Is there any way to modify this to make it work properly with the new version SPPC?
  9. Hey guys, I have a similar issue. Afer installing V1.5.6 everything in the catalog is working correctly, but in admin when I click New Product I get 1054 - Unknown column 'customers_group_name' in 'field list' select distinct customers_group_name, customers_group_id from customers order by customers_group_id [TEP STOP] I tried the 1054 SQL error fix listed on the contrib, trying it in both catalog/includes/modules/featured.php and catalog/admin/includes/modules/featured.php with no luck. I must be totally missing something here...
  10. DOH, makes much more sense the morning after. Thanks Janz, you are my hero!
  11. I did that, now I'm able to use the manufacturers box but the quick find and advanced search are still acting up. When I quick find I get: 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 'from products p left join manufacturers m using(manufacturers_id) left join spec' at line 1 from products p left join manufacturers m using(manufacturers_id) left join specials s on p.products_id = s.products_id, products_description pd, categories c, products_to_categories p2c where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and ((pd.products_name like '%benq%' or p.products_model like '%benq%' or m.manufacturers_name like '%benq%') ) order by pd.products_name limit 0, 20 [TEP STOP] Array ( [0] => Array ( [file] => C:\web\catalog\includes\functions\database.php [line] => 45 [function] => tep_db_error [args] => Array ( [0] => from products p left join manufacturers m using(manufacturers_id) left join specials s on p.products_id = s.products_id, products_description pd, categories c, products_to_categories p2c where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and ((pd.products_name like '%benq%' or p.products_model like '%benq%' or m.manufacturers_name like '%benq%') ) order by pd.products_name limit 0, 20 [1] => 1064 [2] => 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 'from products p left join manufacturers m using(manufacturers_id) left join spec' at line 1 ) ) [1] => Array ( [file] => C:\web\catalog\includes\modules\product_listing.php [line] => 77 [function] => tep_db_query [args] => Array ( [0] => from products p left join manufacturers m using(manufacturers_id) left join specials s on p.products_id = s.products_id, products_description pd, categories c, products_to_categories p2c where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and ((pd.products_name like '%benq%' or p.products_model like '%benq%' or m.manufacturers_name like '%benq%') ) order by pd.products_name limit 0, 20 ) ) [2] => Array ( [file] => C:\web\catalog\advanced_search_result.php [line] => 391 [args] => Array ( [0] => C:\web\catalog\includes\modules\product_listing.php ) [function] => require ) ) the error on advanced search is the same. Do I have something that needs to be added to the SQL database?
  12. Hey guys, I installed SPPC V413 and it seemed to all go smoothly. I used Compare and Edit and all the MAJOR parts are functioning. However in playing with things I've noticed I've got errors when I do a couple things. I'm thinking it's something simple I mixed up and was hoping for some insight. When I try to select a manufacturer to see products I get the following error: 1054 - Unknown column 'p.products_id' in 'on clause' select count(p.products_id) as total from products p, products_description pd, manufacturers m left join specials_retail_prices s on p.products_id = s.products_id where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '13' [TEP STOP] When searching using Quick Find for say the brand Antec, I get: 1066 - Not unique table/alias: 'pd' select count(distinct p.products_id) as total from products p left join manufacturers m using(manufacturers_id), products_description pd left join specials s on p.products_id = s.products_id, categories c, products_to_categories p2c, products_description pd, categories c, products_to_categories p2c where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and ((pd.products_name like '%antec%' or p.products_model like '%antec%' or m.manufacturers_name like '%antec%') ) [TEP STOP] And I also get a similar error when using the advanced search. Any ideas? I'd be happy to post code if I knew where the source of the problem was.
×
×
  • Create New...