jonlai9 Posted October 11, 2006 Share Posted October 11, 2006 Check post #51. I never added the price to the first version of this so that is the best advice I can give you without doing it myself. I think there may be a join missing from the original sql statement to make the specials_price field work. Try this: "select p.products_id, pd.products_name, p.products_image, if(s.status, s.specials_new_products_price, NULL) as specials_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on s.products_id = p.products_id where pd.products_id = p.products_id and p.products_id in(" . $this->products . ")" Can you tell me exactly where to put that? And is that the only line I need to alter? I tried changing $products_query with that line and it doesn't work. I'm not that good with PHP.. if you can, please do those find/replace things! I really hope to get this module working asap! Thanks scottyb and others! Quote Link to comment Share on other sites More sharing options...
scottyb Posted October 11, 2006 Author Share Posted October 11, 2006 Can you tell me exactly where to put that? And is that the only line I need to alter? I tried changing $products_query with that line and it doesn't work. I'm not that good with PHP.. if you can, please do those find/replace things! I really hope to get this module working asap! Thanks scottyb and others! Alright Jon, let's see if we can get this for you. $images_query: $images_query = tep_db_query("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, if(s.status, s.specials_new_products_price, NULL) as specials_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where pd.products_id = p.products_id and p.products_id in(" . $this->products . ") and pd.language_id=" . $languages_id); Then for your $html_content (watch your table cells): $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>'; $price = ($this->productsInfo[$i]['specials_price']) ? '<s>' . $currencies->display_price($this->productsInfo[$i]['products_price'], tep_get_tax_rate($this->productsInfo[$i]['products_tax_class_id'])) . '</s> ' . $currencies->display_price($this->productsInfo[$i]['specials_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'])); $html_content .= $price . '</td>'; To make this work correctly, you need to have the currencies class established before this code is called Put this in /admin/newsletters.php after require('includes/application_top.php); //newsletter products //currenices class required for price display in newsletter require(DIR_WS_CLASSES . 'currencies.php'); $currencies = new currencies(); //newsletter products Then after the function html_content(){ in admin/includes/modules/newsletters/newsletter_products.php add: global $currencies, $languages_id; That's about as specific as I can get. Good Luck Quote Link to comment Share on other sites More sharing options...
jonlai9 Posted October 11, 2006 Share Posted October 11, 2006 (edited) Thanks scottyb. It seems like there's a problem with: global $currencies, $languages_id; I get the following error: Parse error: parse error, unexpected T_GLOBAL, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /mnt/w0402/d35/s04/b0290a30/www/emvee.ca/shop/admin/includes/modules/newsletters/newsletter_products.php on line 138 Just to confirm, this goes AFTER the function, ie. after the function's ending brace, correct? It seems like there is also something wrong with the $images_query. I tried commenting the above line to see what comes up, and I get this: 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 '' at line 1 select p.products_id, pd.products_name, 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(386,116) and pd.language_id= Is there something wrong here? Edit: The above error occurs when I try to preview the newsletter. Edited October 11, 2006 by jonlai9 Quote Link to comment Share on other sites More sharing options...
scottyb Posted October 11, 2006 Author Share Posted October 11, 2006 Your sql is failing because $lanugage_id is not present. The two global declarations do go AFTER the function statment. Once you get those working the sql should take care of itself. It should look something like this: function html_content() { global $currencies, $languages_id; Quote Link to comment Share on other sites More sharing options...
jonlai9 Posted October 11, 2006 Share Posted October 11, 2006 Okay, now it works, but I get a screen with each product being $0.00... no product name, no product image... something wrong? Quote Link to comment Share on other sites More sharing options...
scottyb Posted October 11, 2006 Author Share Posted October 11, 2006 Okay, now it works, but I get a screen with each product being $0.00... no product name, no product image... something wrong? Oops, that was me trying to mix and match 2 versions again (for some reason I don't have the option to edit my posts today). Anyways, change every $this->productsInfo[$i] to $images in the code I provided in post #77 I also noticed that I left a style="' . $cssLink . '" in there too. You're going to want to take that out as well. Sorry for the sloppy post Quote Link to comment Share on other sites More sharing options...
jonlai9 Posted October 11, 2006 Share Posted October 11, 2006 Oops, that was me trying to mix and match 2 versions again (for some reason I don't have the option to edit my posts today). Anyways, change every $this->productsInfo[$i] to $images in the code I provided in post #77 I also noticed that I left a style="' . $cssLink . '" in there too. You're going to want to take that out as well. Sorry for the sloppy post Thanks! The prices and slashed prices where special price is evident is now appearing, however, the product's picture is appearing as it's caption in words, so now instead of pic+product name, I simply have the product name appear twice. How would you fix this? Quote Link to comment Share on other sites More sharing options...
scottyb Posted October 11, 2006 Author Share Posted October 11, 2006 Thanks! The prices and slashed prices where special price is evident is now appearing, however, the product's picture is appearing as it's caption in words, so now instead of pic+product name, I simply have the product name appear twice. How would you fix this? Two images are coming up because more than one language is in use. I have never used more than one, so I don't have a definite solution to this. Others have talked about that in this thread. If you only want to send out the email in one language, just hack it and set $language_id = 1 (or whatever language_id). Make sure that you're using this code: tep_image(HTTP_CATALOG_SERVER . DIR_WS_CATALOG_IMAGES . $images['products_image'], $images['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) Images need to have the absolute reference to your site. i.e. it should look something like <img src="http://www.yoursite.com/images/product.jpg" alt="Product Name" width="xx" height="xx"> Quote Link to comment Share on other sites More sharing options...
jonlai9 Posted October 12, 2006 Share Posted October 12, 2006 Two images are coming up because more than one language is in use. I have never used more than one, so I don't have a definite solution to this. Others have talked about that in this thread. If you only want to send out the email in one language, just hack it and set $language_id = 1 (or whatever language_id). Make sure that you're using this code: tep_image(HTTP_CATALOG_SERVER . DIR_WS_CATALOG_IMAGES . $images['products_image'], $images['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) Images need to have the absolute reference to your site. i.e. it should look something like <img src="http://www.yoursite.com/images/product.jpg" alt="Product Name" width="xx" height="xx"> I'm using that code. The image is not appearing, it's X-ed out. When I check the properties, it just links to my /images/ directory, it doesn't link to the name of the file.jpg Quote Link to comment Share on other sites More sharing options...
scottyb Posted October 12, 2006 Author Share Posted October 12, 2006 I'm using that code. The image is not appearing, it's X-ed out. When I check the properties, it just links to my /images/ directory, it doesn't link to the name of the file.jpg First, you need to make sure that the absolute path is set by the defined variables (HTTP_CATALOG_SERVER and DIR_WS_CATALOG_IMAGES). Check your admin/includes/config.php file to see if they are properly defined. Next try to see what you are getting from your images query. Put var_dump($images) after while($images = tep_db_fetch_array($images_query)){ That will show you what you are retrieving from the sql query. Quote Link to comment Share on other sites More sharing options...
xavism Posted October 20, 2006 Share Posted October 20, 2006 Hi Scott when i try to make a newsletters, i select the newsletters_products and my template but when i preview it i don't see my template. Can you help me? First, you need to make sure that the absolute path is set by the defined variables (HTTP_CATALOG_SERVER and DIR_WS_CATALOG_IMAGES). Check your admin/includes/config.php file to see if they are properly defined. Next try to see what you are getting from your images query. Put var_dump($images) after while($images = tep_db_fetch_array($images_query)){ That will show you what you are retrieving from the sql query. Quote Link to comment Share on other sites More sharing options...
gecko Posted October 26, 2006 Share Posted October 26, 2006 Thanks for an awesome contribution. I have this working sweet. I would like to know if it is possible to personalize the subject and in the newsletter itself? ie; First_name, It's may madness! can anyone help? Quote this time it'll go :-) Link to comment Share on other sites More sharing options...
gecko Posted October 26, 2006 Share Posted October 26, 2006 Also where do you find the drop down select box in admin/newsletters.php?action=new so i can edit it so it is set to newsletter_products as default selected. I also need to find where that funky little sending graphic is so i can change it. any help well appreciated. thnx gecko Quote this time it'll go :-) Link to comment Share on other sites More sharing options...
scottyb Posted October 27, 2006 Author Share Posted October 27, 2006 Gecko, Since each individual customer message is not stored, you're going to have to figure out a way to add it during the sending process which is the send() function at the end of the modules/newsletters/newsletter_products.php file. This could be tricky depending upon your html_content(); You could try passing $mail_query['customers_firstname'] & $mail_query['customers_lastname'] inside the $this->html_content() function. Around line 216 in the newsletters.php file youll seee the pull down menu function, and around 364 you'll see the image. Quote Link to comment Share on other sites More sharing options...
Guest Posted November 30, 2006 Share Posted November 30, 2006 Hi I have installed this mod on several shops, and it always works. BUT When I try to install it this time I get this error: Catchable fatal error: Object of class newsletter_products could not be converted to string in //admin/includes/functions/html_output.php on line 300 I have checked the code, and it finishes the code in view source if I remove ' <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" . from newsletter_products. Does anyone know what causes this error? Quote Link to comment Share on other sites More sharing options...
petsk Posted December 13, 2006 Share Posted December 13, 2006 I get the following sql error. Does anyone have a solution? :) The problem occurs using MySQL 5, version 4 doesn't give any errors. 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(738,990,938,855,175,353,1059,1043,874,895,884,749,350) and pd.language_id=1 [TEP STOP] Quote Link to comment Share on other sites More sharing options...
petsk Posted December 14, 2006 Share Posted December 14, 2006 I belive it's the "left join " . TABLE_SPECIALS . "" that needs to be changed in $images_query... My code: $images_query = tep_db_query("select p.products_id, pd.language_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 " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where pd.language_id = '1' and pd.products_id = p.products_id and p.products_id in(" . $this->products . ")"); Quote Link to comment Share on other sites More sharing options...
petsk Posted December 17, 2006 Share Posted December 17, 2006 A missing () caused the problem: $images_query = tep_db_query("select p.products_id, pd.language_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 (" . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd) left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where pd.language_id = '1' and pd.products_id = p.products_id and p.products_id in(" . $this->products . ")"); Quote Link to comment Share on other sites More sharing options...
fengpi Posted December 23, 2006 Share Posted December 23, 2006 Hey Scott, I'm getting this error after clicking on the save button: 1054 - Unknown column 'products' in 'field list' insert into newsletters (title, content, module, products, template, date_added, status, locked) values ('test', '', 'newsletter_products', '73', '', now(), '0', '0') [TEP STOP] Wonder if you could help me out. Quote Link to comment Share on other sites More sharing options...
scottyb Posted December 24, 2006 Author Share Posted December 24, 2006 Hey Scott, I'm getting this error after clicking on the save button:1054 - Unknown column 'products' in 'field list' insert into newsletters (title, content, module, products, template, date_added, status, locked) values ('test', '', 'newsletter_products', '73', '', now(), '0', '0') [TEP STOP] Wonder if you could help me out. The "products" field in the DB is either missing or mispelled. Quote Link to comment Share on other sites More sharing options...
CraXyOW3 Posted February 3, 2007 Share Posted February 3, 2007 HiI have installed this mod on several shops, and it always works. BUT When I try to install it this time I get this error: Catchable fatal error: Object of class newsletter_products could not be converted to string in //admin/includes/functions/html_output.php on line 300 I have checked the code, and it finishes the code in view source if I remove ' <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" . from newsletter_products. Does anyone know what causes this error? I do not know what causes the error nor do i know what the fix i did is doing -.- but it seems to work now. i compared the upper row, the one you mentioned to the third one, the main difference i could see was that the code on the third line had a [] in it. Like this: "menu('chosen[]', $current" So i changed the part looking like this: n_menu('products', $products To this: n_menu('products[]', $products Quote Link to comment Share on other sites More sharing options...
CraXyOW3 Posted February 4, 2007 Share Posted February 4, 2007 Could not find any "EDIT" button for my previous post, but anyway! I have still the same problem and the fix i tried removed the issue regarding that particular error, but it aslo creates anotherone. Now i cant move my products from the left box to the right one. I get a javascript error now, could someone help with this issue ?? Quote Link to comment Share on other sites More sharing options...
Guest Posted February 11, 2007 Share Posted February 11, 2007 Hi I have converted to php5 and mysql 5 but have this problem. Catchable fatal error: Object of class newsletter_products could not be converted to string in ..../admin/includes/functions/html_output.php on line 300 This is the tep_draw_pull_down_menu function. Anyone know how to fix this, I really don't want to loose this great contribution. Quote Link to comment Share on other sites More sharing options...
Guest Posted February 11, 2007 Share Posted February 11, 2007 Sorry, I didn't read the posts above. I did what you suggested, and got the same error you get. I'll have a look at it, I'm better at this kind of errors. Quote Link to comment Share on other sites More sharing options...
Guest Posted February 11, 2007 Share Posted February 11, 2007 Hi Change the function below in admin/includes/modules/newsletters/newsletter_products.php to: $choose_products_string = '<script language="javascript"><!-- function mover(move) { if (move == \'remove\') { for (x=0; x<(document.newsletter.elements[\'products[]\'].length); x++) { if (document.newsletter.elements[\'products[]\'].options[x].selected) { with(document.newsletter.elements[\'chosen[]\']) { options[options.length] = new Option(document.newsletter.elements[\'products[]\'].options[x].text,document.newsletter.elements[\'products[]\'].options[x].value); } document.newsletter.elements[\'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.elements[\'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>'; 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.