Guest Posted November 13, 2007 Share Posted November 13, 2007 Hi, it's because in your dsatabase, p.products_image2 don't exists.change in your files to p.products_image . Bye Sir I have a similar problem that is 1054 - Unknown column 'p.products_image2' in 'field list' select p.products_id, pd.products_name, p.products_image2, p.products_price, p.products_tax_class_id, if(s.status, s.specials_new_products_price, NULL) as specials_price from products p, products_description pd left join specials s on p.products_id = s.products_id where pd.products_id = p.products_id and p.products_id in(79) and pd.language_id=1 [TEP STOP] Can someone tell me what to do as I am a newbie in PHP and i really didnt understand what you want us to do in the above quotes thanks Quote Link to comment Share on other sites More sharing options...
Guest Posted November 13, 2007 Share Posted November 13, 2007 Hi, it's because in your dsatabase, p.products_image2 don't exists.change in your files to p.products_image . Bye Sir I have a similar problem that is 1054 - Unknown column 'p.products_image2' in 'field list' select p.products_id, pd.products_name, p.products_image2, p.products_price, p.products_tax_class_id, if(s.status, s.specials_new_products_price, NULL) as specials_price from products p, products_description pd left join specials s on p.products_id = s.products_id where pd.products_id = p.products_id and p.products_id in(79) and pd.language_id=1 [TEP STOP] Can someone tell me what to do as I am a newbie in PHP and i really didnt understand what you want us to do in the above quotes thanks Quote Link to comment Share on other sites More sharing options...
NekoSign Posted November 22, 2007 Share Posted November 22, 2007 Sir I have a similar problem that is Can someone tell me what to do as I am a newbie in PHP and i really didnt understand what you want us to do in the above quotes thanks You must change "products_image2" by "products_image" in admin/includes/modules/newsletter/newsletter_products.php : $product_query = tep_db_query("select p.products_id, pd.products_name, p.products_image2 by $product_query = tep_db_query("select p.products_id, pd.products_name, p.products_image and in a few lines after 'products_image' => $product['products_image2'], by 'products_image' => $product['products_image'], ;) Quote Link to comment Share on other sites More sharing options...
Stin_ Posted November 25, 2007 Share Posted November 25, 2007 Hello, I heve this problem wen i try to make a new newsletter_products You need only select products and a template if you are using the newsletter_products module Catchable fatal error: Object of class newsletter_products could not be converted to string in /home/djstools/public_html/admin/includes/functions/html_output.php on line 282 this is the line 282 if (empty($default) && isset($GLOBALS[$name])) $default = stripslashes($GLOBALS[$name]); for ($i=0, $n=sizeof($values); $i<$n; $i++) { $field .= '<option value="' . tep_output_string($values[$i]['id']) . '"'; if ($default == $values[$i]['id']) { $field .= ' SELECTED'; } $field .= '>' . tep_output_string($values[$i]['text'], array('"' => '"', '\'' => ''', '<' => '<', '>' => '>')) . '</option>'; } $field .= '</select>'; if ($required == true) $field .= TEXT_FIELD_REQUIRED; return $field; } ?> also wen i go to preview a old newsletter i get this error 1054 - Unknown column 'p.products_id' in 'on clause' select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, if(s.status, s.specials_new_products_price, NULL) as specials_price from products p, products_description pd left join specials s on p.products_id = s.products_id where pd.products_id = p.products_id and p.products_id in(1143, 1144) and pd.language_id=4 [TEP STOP] all this becouse naw I have PHP5 but also I edit the index php end the advanced serch result php i ceck this http://www.oscommerce.com/forums/index.php?showtopic=263592 ... but nothing to do so pls what i have to do more .... (Apologize for my English) Thank YOU! Cristian Quote Link to comment Share on other sites More sharing options...
Vmotion Posted November 26, 2007 Share Posted November 26, 2007 You must change "products_image2" by "products_image" in admin/includes/modules/newsletter/newsletter_products.php : $product_query = tep_db_query("select p.products_id, pd.products_name, p.products_image2 by $product_query = tep_db_query("select p.products_id, pd.products_name, p.products_image and in a few lines after 'products_image' => $product['products_image2'], by 'products_image' => $product['products_image'], ;) I tried your solution and I'm still having the same Error Message. HELP! Quote Link to comment Share on other sites More sharing options...
Vmotion Posted November 27, 2007 Share Posted November 27, 2007 can anyone help me with this error message Thanks. Fatal error: Cannot redeclare class newsletter_products in /home/public_html/admin/includes/languages/english/modules/newsletters/newsletter_products.php on line 0 Quote Link to comment Share on other sites More sharing options...
Vmotion Posted November 28, 2007 Share Posted November 28, 2007 can anyone help me with this error message Thanks. Fatal error: Cannot redeclare class newsletter_products in /home/public_html/admin/includes/languages/english/modules/newsletters/newsletter_products.php on line 0 Anybody? Quote Link to comment Share on other sites More sharing options...
NekoSign Posted November 29, 2007 Share Posted November 29, 2007 I tried your solution and I'm still having the same Error Message. HELP! I give you my code of admin/includes/languages/english/modules/newsletters/newsletter_products.php <?php /* $Id: newsletter_products.php,v 2.0 2007/05/17 scottyb Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2002 osCommerce Released under the GNU General Public License //newsletter products */ class newsletter_products { function newsletter_products($title, $content, $products, $template) { $this->title = $title; $this->content = $content; $this->products = $products; $this->template = $template; } function choose_products() { global $HTTP_GET_VARS, $languages_id; //first let's get the products that have been added to newsletter if($HTTP_GET_VARS['nID']){ $newsletter_products_query = tep_db_query("select products_id from " . TABLE_NEWSLETTERS_TO_PRODUCTS . " where newsletters_id ='" . $HTTP_GET_VARS['nID'] . "'"); $newsletter_products_string = ''; while($newsletter_products = tep_db_fetch_array($newsletter_products_query)){ $newsletter_products_string .= $newsletter_products['products_id'] . ', '; } $newsletter_products_string = trim($newsletter_products_string, ', '); //$newsletter_products_string = tep_db_result($newsletter_products_query, 0, $newsletter_products_query['products']); $current_products_query = "select pd.products_id, pd.products_name, p.products_model from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.language_id = '" . $languages_id . "' and pd.products_id = p.products_id and p.products_status = '1'"; if($newsletter_products_string) $current_products_query .= " and pd.products_id in(" . $newsletter_products_string . ")"; $current_products_query .= " order by pd.products_name"; $current_products_query = tep_db_query($current_products_query); } if($newsletter_products_string){ $current_products_array = array(); while ($current_products = tep_db_fetch_array($current_products_query)){ $current_products_array[] = array('id' => $current_products['products_id'], 'text' => $current_products['products_name'] . ' - ' . $current_products['products_model']); } } $products_query = "select pd.products_id, pd.products_name, p.products_model from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.language_id = '" . $languages_id . "' and pd.products_id = p.products_id and p.products_status = '1'"; if($newsletter_products_string) $products_query .= " and pd.products_id not in(" . $newsletter_products_string . ")"; $products_query .= " order by pd.products_name"; $products_array = array(); $products_query = tep_db_query($products_query); while ($products = tep_db_fetch_array($products_query)) { $products_array[] = array('id' => $products['products_id'], 'text' => $products['products_name'] . ' - ' . $products['products_model']); } $choose_products_string = '<script language="javascript"><!-- function mover(move) { if (move == \'remove\') { for (x=0; x<(document.newsletter.products.length); x++) { if (document.newsletter.products.options[x].selected) { with(document.newsletter.elements[\'chosen[]\']) { options[options.length] = new Option(document.newsletter.products.options[x].text,document.newsletter.products.options[x].value); } document.newsletter.products.options[x] = null; x = -1; } } } if (move == \'add\') { for (x=0; x<(document.newsletter.elements[\'chosen[]\'].length); x++) { if (document.newsletter.elements[\'chosen[]\'].options[x].selected) { with(document.newsletter.products) { options[options.length] = new Option(document.newsletter.elements[\'chosen[]\'].options[x].text,document.newsletter.elements[\'chosen[]\'].options[x].value); } document.newsletter.elements[\'chosen[]\'].options[x] = null; x = -1; } } } return true; } function selectAll(FormName, SelectBox) { temp = "document." + FormName + ".elements[\'" + SelectBox + "\']"; Source = eval(temp); for (x=0; x<(Source.length); x++) { Source.options[x].selected = "true"; } } //--></script>'; $choose_products_string .= '<table border="0" width="100%" cellspacing="0" cellpadding="2">' . "\n" . ' <tr>' . "\n" . ' <td align="center" class="main"><b>' . TEXT_PRODUCTS . '</b><br>' . tep_draw_pull_down_menu('products', $products_array, '', 'size="20" style="width: 32em;" multiple') . '</td>' . "\n" . ' <td align="center" class="main"> <br><br><input type="button" value="' . BUTTON_SELECT . '" style="width: 8em;" onClick="mover(\'remove\');"><br><br><input type="button" value="' . BUTTON_UNSELECT . '" style="width: 8em;" onClick="mover(\'add\');"></td>' . "\n" . ' <td align="center" class="main"><b>' . TEXT_SELECTED_PRODUCTS . '</b><br>' . tep_draw_pull_down_menu('chosen[]', $current_products_array, '', 'size="20" style="width: 25em;" multiple') . '</td>' . "\n" . ' </tr>' . "\n" . '</table>'; return $choose_products_string; } function productInfo(){ global $languages_id; $this->productInfo = array(); $p_string = ''; for($i=0, $n=sizeof($this->products); $i<$n; $i++){ $p_string .= $this->products[$i] . ', '; } $p_string = trim($p_string, ', '); $product_query = tep_db_query("select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, if(s.status, s.specials_new_products_price, NULL) as specials_price from products p INNER JOIN products_description pd left join specials s on p.products_id = s.products_id where pd.products_id = p.products_id and p.products_id in(" . $p_string . ") and pd.language_id=" . $languages_id); //$this->productsInfo = array(); while($product = tep_db_fetch_array($product_query)){ $this->productsInfo[] = array('products_id' => $product['products_id'], 'products_name' => $product['products_name'], 'products_image' => $product['products_image'], 'products_price' => $product['products_price'], 'specials_price' => $product['specials_price'], 'products_tax_class_id' => $product['products_tax_class_id']); } } function html_content() { global $currencies, $languages_id; //create HTML string containing links & pics //define product columns here define('COLS', 3); $width = intval(100/COLS); $html_content = '<table border="0" width="100%" cellpadding="" cellspacing="3"><tr>'; $col = 0; $this->productInfo(); //change html body styles here $cssPrice = 'color: #000000;'; $cssSale = 'color: #ff0000;'; $cssMarkdown = 'color: #000000; text-decoration: line-through'; $cssLink = 'color: #000000; text-decoration: none; font-weight: bold;'; for($i=0, $n=sizeof($this->productsInfo); $i<$n; $i++){ if($col > COLS-1){ $html_content .= '</tr><tr><td align="center" width="' . $width . '%"><a href="' . tep_catalog_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $this->productsInfo[$i]['products_id']) . '" style="' . $cssLink . '">' . tep_image(HTTP_CATALOG_SERVER . DIR_WS_CATALOG_IMAGES . $this->productsInfo[$i]['products_image'], $this->productsInfo[$i]['products_name']) . '<br>' . $this->productsInfo[$i]['products_name'] . '</a><br></td>'; $col = 0; }else{ $html_content .= '<td align="center" width="' . $width . '%"><a href="' . tep_catalog_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $this->productsInfo[$i]['products_id']) . '" style="' . $cssLink . '">' . tep_image(HTTP_CATALOG_SERVER . DIR_WS_CATALOG_IMAGES . $this->productsInfo[$i]['products_image'], $this->productsInfo[$i]['products_name']) . '<br>' . $this->productsInfo[$i]['products_name'] . '</a><br></td>'; } $col++; } //uncomment & create your unsubscribe link in your includes/languages/YOUR LANGUAGE/modules/newsletters/newsletter_products.php $html_content .= '</tr></table>'; if(tep_not_null($this->template)){ //HTML page from template //$content = join('', file(DIR_WS_TEMPLATES . $this->template)); $content = file_get_contents(DIR_WS_TEMPLATES . $this->template); //remove all line breaks and spaces in template to ensure no spaces resulting from email class $content = str_replace("\n", '', $content); $content = str_replace("\r", '', $content); //$content = str_replace('> ', '>', $content); $content = addslashes($content); $email_title = $this->title; $email_message = nl2br($this->content); eval ("\$content = \"$content\";"); $html_content = $content; } return $html_content; } function text_content(){ global $currencies, $languages_id; $text_content = $this->content . "\r\n\r\n"; //var_dump($this->productsInfo); for($i=0, $n=sizeof($this->productsInfo); $i<$n; $i++){ $text_content .= $this->productsInfo[$i]['products_name'] . ' '; $price = ($this->productsInfo[$i]['specials_price']) ? 'Sale Price: ' . $currencies->display_price($this->productsInfo[$i]['specials_price'], tep_get_tax_rate($this->productsInfo[$i]['products_tax_class_id'])) . ' Down from: ' . $currencies->display_price($this->productsInfo[$i]['products_price'], tep_get_tax_rate($this->productsInfo[$i]['products_tax_class_id'])) : $currencies->display_price($this->productsInfo[$i]['products_price'], tep_get_tax_rate($this->productsInfo[$i]['products_tax_class_id'])); $text_content .= $price . "\n"; $text_content .= tep_catalog_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $this->productsInfo[$i]['products_id']) . "\r\r"; } //uncomment & create your unsubscribe link in your includes/languages/YOUR LANGUAGE/modules/newsletters/newsletter_products.php $text_content .= "\r\r" . TEXT_UNSUBSCRIBE; return $text_content; } function confirm() { global $HTTP_GET_VARS; $mail_query = tep_db_query("select count(*) as count from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'"); $mail = tep_db_fetch_array($mail_query); $confirm_string = '<table border="0" cellspacing="0" cellpadding="2">' . "\n" . ' <tr>' . "\n" . ' <td class="main"><font color="#ff0000"><b>' . sprintf(TEXT_COUNT_CUSTOMERS, $mail['count']) . '</b></font></td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td class="main"><b>' . $this->title . '</b></td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td class="main">' . $this->html_content() . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td align="right"><a href="' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $HTTP_GET_VARS['nID'] . '&action=confirm_send') . '">' . tep_image_button('button_send.gif', IMAGE_SEND) . '</a> <a href="' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $HTTP_GET_VARS['nID']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a></td>' . "\n" . ' </tr>' . "\n" . '</table>'; return $confirm_string; } function send($newsletter_id) { $mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'"); //create id for current mailing $messageId = "Message-Id: <" . time() . "@" . $_SERVER['SERVER_NAME'] . ">"; $mimemessage = new email(array('X-Mailer: osCommerce bulk mailer', $messageId)); //$mimemessage->add_text($this->content); //$text = $this->text_content(); $mimemessage->add_html($this->html_content(), $this->text_content(), HTTP_CATALOG_SERVER . DIR_WS_CATALOG_IMAGES); $mimemessage->build_message(); while ($mail = tep_db_fetch_array($mail_query)) { $mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, $this->title); } $newsletter_id = tep_db_prepare_input($newsletter_id); tep_db_query("update " . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1' where newsletters_id = '" . tep_db_input($newsletter_id) . "'"); } } ?> Quote Link to comment Share on other sites More sharing options...
actarus1011 Posted January 22, 2008 Share Posted January 22, 2008 Hello. I'm trying to install this nice contribution but get stuck by 2 updates to the /admin/newsletter.php file Indeed, when I try to send a newsletter_product, I got this message Fatal error: Call to undefined method: newsletter_products->send_fckeditor() in /home/httpd/vhosts/www.mt-performances.com/web/catalog/admin/newsletters.php on line 481 FCKeditor seems to be the reason, and here below are the 2 updates that cause problems... 1. <!-- ########## [Delaballe] ADD FCKeditor ########## //--> <!-- Effacer nl2br qui provoque des br suplémentaire à chaque ligne //--> <td><tt><?php echo $nInfo->content; ?></tt></td> <!-- ########## [Delaballe] END - ADD FCKeditor ########## //--> to be replaced by ? <td><tt><?php echo nl2br($nInfo->content); ?></tt></td> 2. // ########## [Delaballe] ADD FCKeditor ########## $module->send_fckeditor($nInfo->newsletters_id); // ########## [Delaballe] END - ADD FCKeditor ########## To be replaced by ? $module->send($nInfo->newsletters_id); This last one seems to be the most painful. Has anybody an Idea ? Thanks in advance Quote Link to comment Share on other sites More sharing options...
Rod_Miller Posted January 23, 2008 Share Posted January 23, 2008 Quote Link to comment Share on other sites More sharing options...
Trentide Posted March 6, 2008 Share Posted March 6, 2008 Hi Everyone. I'm thinking of using this contribution. Does it work? Is there any support for it? Just wondering. Thanks, Jason Quote Link to comment Share on other sites More sharing options...
azer Posted April 1, 2008 Share Posted April 1, 2008 I just installed newsletter2.0 as well because my newsletters.php was cutting off right after the text box, im now getting the following error: Unable to determine the page link! Function used: tep_href_link('', '', 'NONSSL') anyone found a solution to that ? Quote MS2 Link to comment Share on other sites More sharing options...
azer Posted April 1, 2008 Share Posted April 1, 2008 answering my own question around line 167 in admin/includes/modules/newsletters/newsletter_products.php : if(tep_not_null($this->template)){ //HTML page from template $content = join('', file(DIR_WS_TEMPLATES . $this->template)); // this was originally commented out //$content = file_get_contents(DIR_WS_TEMPLATES . $this->template); // this wasn't commented out. switcharoo fixed the template not being used . //remove all line breaks and spaces in template to ensure no spaces resulting from email class $content = str_replace("\n", '', $content); can somebody confirm that we have to uncomment first line and comment 2nd line ? Quote MS2 Link to comment Share on other sites More sharing options...
sunrise99 Posted April 3, 2008 Share Posted April 3, 2008 Dears: Would you please help to advise how to setup ununsubscribe asap? and give one example? To unsubscribe, follow this '. tep_href_link(HTTPS_CATALOG_SERVER /*. YOUR_UNSUBSCRIBE_LINK*/) .' link.' ?????? from Readme: define('TEXT_UNSUBSCRIBE', 'You are receiving this notice because you have subscribed to our newsletter. To unsubscribe, follow this '. tep_href_link(HTTPS_CATALOG_SERVER /*. YOUR_UNSUBSCRIBE_LINK*/) .' link.'); Thanks & Best Regards, Sunrise Quote Link to comment Share on other sites More sharing options...
emmetje Posted April 3, 2008 Share Posted April 3, 2008 Posted version 2.20 Fixed sql file Fixed error with content from textarea not showing up in html email Fixed php5 error "1054 - Unknown column" Enjoy ;) Quote Link to comment Share on other sites More sharing options...
skhuu Posted April 8, 2008 Share Posted April 8, 2008 Hi Guys Can someone help, there is no unsubscribe link on the newsletter. I only see this; You are receiving this notice because you have subscribed to our newsletter. To unsubscribe, follow this http://www.mzansimp3.co.za/admin/http://www.mzansimp3.co.za link. Where do I change and what, Thanks Quote Link to comment Share on other sites More sharing options...
x-plosiv Posted April 18, 2008 Share Posted April 18, 2008 anyone found a solution to that ? i have the same problem :-( Quote Link to comment Share on other sites More sharing options...
amadorbr Posted April 20, 2008 Share Posted April 20, 2008 I need of one help... Why i order by product..???? In the newsletter, show the old to new product... i want of new to old product list. The new products in top of Newsletter... Someone can help me? Thanks! Quote Link to comment Share on other sites More sharing options...
amadorbr Posted April 20, 2008 Share Posted April 20, 2008 (edited) please help Edited April 20, 2008 by amadorbr Quote Link to comment Share on other sites More sharing options...
random183 Posted April 24, 2008 Share Posted April 24, 2008 Hi patamu, to change the size of your pictures in your newsletter , just change into the module/newsletter/newsletter_product.php the osc function tep_image tep_image(HTTP_CATALOG_SERVER . DIR_WS_CATALOG_IMAGES . $this->productsInfo[$i]['products_image'], $this->productsInfo[$i]['products_name'], $imgWidth, $imgHeight) Hi, I've installed this contribution, and all seems to be working well, except for the image sizes. I currently have the "More_Pics_6 for 2.2 ms2" contribution installed, which appears not to create a thumbnail image and just resized the images on the fly. I've tried the mod above and it does'nt appear to have made much difference (I changed 2 lines to the above), all my pictures are coming out huge! Does anyone have a suggestion on how to fix this? I'm quite happy to have a fixed picture size on the newsletters by specifying the pixel size in the code if that would make life easier ! :) Cheers Mat Quote Link to comment Share on other sites More sharing options...
random183 Posted April 24, 2008 Share Posted April 24, 2008 Hi patamu, to change the size of your pictures in your newsletter , just change into the module/newsletter/newsletter_product.php the osc function tep_image tep_image(HTTP_CATALOG_SERVER . DIR_WS_CATALOG_IMAGES . $this->productsInfo[$i]['products_image'], $this->productsInfo[$i]['products_name'], $imgWidth, $imgHeight) Right, sort of fixed it... If I change the variables $imgWidth, $imgHeight for specific numbers and it works fine. So I've set them to a size I'm happy with which will do for the time being.. :) Now to sort out the template! Mat Quote Link to comment Share on other sites More sharing options...
amadorbr Posted May 5, 2008 Share Posted May 5, 2008 Quote Link to comment Share on other sites More sharing options...
sonictrip.net Posted May 19, 2008 Share Posted May 19, 2008 Hi, I saw something about this error earlier in the thread but it wasnt too specific on how to fix the problem: 1146 - Table 'independentoffers_ie.table_newsletters_to_products' doesn't exist select products_id from TABLE_NEWSLETTERS_TO_PRODUCTS where newsletters_id = '4' [TEP STOP] I tried making sure the define was added to database_tables.php but still that error pops up... any ideas? From ms2.2 on, is there another file other than database_tables.php that needs the db tables defined in it as well? Thanks. Quote Link to comment Share on other sites More sharing options...
sonictrip.net Posted May 20, 2008 Share Posted May 20, 2008 Hi, I saw something about this error earlier in the thread but it wasnt too specific on how to fix the problem: 1146 - Table 'independentoffers_ie.table_newsletters_to_products' doesn't exist select products_id from TABLE_NEWSLETTERS_TO_PRODUCTS where newsletters_id = '4' [TEP STOP] I tried making sure the define was added to database_tables.php but still that error pops up... any ideas? From ms2.2 on, is there another file other than database_tables.php that needs the db tables defined in it as well? Thanks. Got it to work by putting the define in application_top.php... Having problems trying to get it to work with MaxiDVD images mod, how would i get it to rip the imagecache images instead of the original images? Also, the links being generated on the images are linking to my admin site instead of the catalog site, how would i change that? Thanks, great mod! Quote Link to comment Share on other sites More sharing options...
gulshesh Posted May 21, 2008 Share Posted May 21, 2008 thank you for the reply $image_new = "images/logo.jpg"; copy($image,$image_new); $attachment = fread(fopen($image_new, "r"), filesize($image_new)); $mail->add_attachment("$attachment", $image_new, "image/jpeg"); $mail->send(); @unlink($iamge_new); i am looking for something like the above code, but it adds the images as a attachment... but to stop the message about unsecure blocked items in mail it needs to be embedded like if you insert images in outlook... did not work for me ;( MR-M Well, It worked marvelously for me... I'm designing a Shop for handelds/cellular phones. So a customer can buy a handheld with or without a contract. IF the customer chooses a contract then he receives the contract formular(s) as pdf in his confirmation email... so the following things ive altered: /catalog/checkout_process.php go to -> // lets start with the email confirmation 1st I had to create a function to check IF there's been a contract chosen within the shopping cart: $antrag_count = 0; $send_antrag_array = array(); aprox at line 224, beneath this code line: } else { $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix within the else { } brackets I've inserted: if($order->products[$i]['attributes'][$j]['option_id'] == '40' && $order->products[$i]['attributes'][$j]['value_id'] != 160) { $send_antrag_array[$antrag_count] = $order->products[$i]['attributes'][$j]['value_id']; $antrag_count++; } In this case option_id = '40' is the ID for that attribute (Simlock contract) and value_id != 160 is the ID for the value of the attribute (160 is 'without contract' and all others therefore are with a contract) later on ive added this code where the email text gets generated: if(count($send_antrag_array) >0) { ... for($i=0; $i<=count($send_antrag_array)-1; $i++) { ... extract pdf url path and name via SQL queries... array_push($pdf_url_array, $antrag_pdf_result['antrag_pdf_url']); array_push($pdf_name_array, $antrag_name_result['products_options_values_name']); } ... } ... if(count($pdf_url_array)>0) { // if there are pdf urls within that array send to MODIFIED function tep_mail_attachment($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $pdf_url_array, $pdf_name_array); } else { //send to ORIGINAL function tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); } Now within /includes/function/general.php copy the tep_mail function, rename it to tep_mail_attachment and alter it accordingly: //// //! Send email WITH the required Tarif-PDFs (text/html) using MIME in the order confirmation mail // This is the central mail function. The SMTP Server should be configured // correct in php.ini // Parameters: // $to_name The name of the recipient, e.g. "Jan Wildeboer" // $to_email_address The eMail address of the recipient, // e.g. [email protected] // $email_subject The subject of the eMail // $email_text The text of the eMail, may contain HTML entities // $from_email_name The name of the sender, e.g. Shop Administration // $from_email_adress The eMail address of the sender, // e.g. [email protected] // $pdf_url ADDED : The array with the urls to the desired PDFs // $pdf_name ADDED : The array with the names of the desired PDFs function tep_mail_attachment($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address, $pdf_url, $pdf_name) { if (SEND_EMAILS != 'true') return false; // Instantiate a new mail object $message = new email(array('X-Mailer: osCommerce Mailer')); // Build the text version $text = strip_tags($email_text); if (EMAIL_USE_HTML == 'true') { $message->add_html($email_text, $text); } else { $message->add_text($text); } // ALTERED NEW CODE FOR ADDING ATTACHMENTS: if(count($pdf_url)>0) { //Errorhandling : Only execute IF there's been URL transmitted for($i=0; $i<=count($pdf_url)-1; $i++) { //Errorhandling : IF /catalog/ is within the url string, remove it, and add it afterwards (to ensure consistency) if(stristr($pdf_url[$i], 'catalog/')) $explode_pdf_url_string = explode("catalog/", $pdf_url[$i]); else $explode_pdf_url_string[1] = $pdf_url[$i]; $pdf_file = DIR_FS_CATALOG.$explode_pdf_url_string[1]; //set absollute path to the file using the global DIR_FS_CATALOG variable if(file_exists($pdf_file)) { //Errorhandling : Only execute IF the file really exists $attachment = fread(fopen($pdf_file, "r"), filesize($pdf_file)); $message->add_attachment("$attachment", $pdf_name[$i], "application/pdf"); // ('file', 'name of file', 'content type') } } } // Send message $message->build_message(); $message->send($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject); } Notice that the url of the pdf and the name of the contract have been transmitted to the function (as array) It works great for me! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.