fixion Posted January 5, 2005 Posted January 5, 2005 (edited) Hi guys, I was heavily missing a forum for discussing the "newsindex" aka. Multiple Newsletters contribution. http://www.oscommerce.com/community/contributions,2445 This contribution allows you to create an arbitrary amount of newsletters, with an indication of a type. This type indication, makes it a good candidate for further developments, such as creating a newsletter of the type "MailMan List" - which when you send a mail to that list, it will do it through mailman (I'm going to code this feature - cause I need it :) Also - one might consider merging this, and the contrib that allows none-users to subscribe to your newsletter http://www.oscommerce.com/community/contributions,535 I currently have a "small" problem with this contrib, as it does NOT show the newsletters in the account_newsletters.php file as it should (it simply returns blank). everything else seems(!) to work fine. All help is appreciated. Edited January 5, 2005 by fixion Quote
fixion Posted January 5, 2005 Author Posted January 5, 2005 I currently have a "small" problem with this contrib, as it does NOT show the newsletters in the account_newsletters.php file as it should (it simply returns blank). everything else seems(!) to work fine. I found the problem. The contribution creates lists with the language ID chosen in the admin. But when the admin is in english - and the user is in danish - they don't see the newsletters (as they don't exist for the chosen language). IMHO my proposed solution, would be to add a "language selection" box, to the newsletter - which would contain the enabled languages, AND a "All Languages" having the value of 0 - indicating it was valid for all languages. Quote
Guest Posted January 8, 2005 Posted January 8, 2005 FYI, I've uploaded a new version which cleans up most of the outstanding issues. It also offers a method of handling multilingual sites using the existing code. NOT as convenient as your proposed solution, I'm sorry to say, but it does work, and hacking language_id support directly into the page promises more headaches than that with which I can cope just now. If someone else wanted to improve the multi-lingual support, that would be great. I do hope to address it at some point, but ' .. the best laid plans of mice and men aft gang agly', as they say... Quote
AWWWW.WAHWAH Posted January 8, 2005 Posted January 8, 2005 (edited) Man, I was reading the instructions. Link what file to what? Too lazy to do what? I figured if you're going to make such a great contribution, why not complete it with a 'dummy' set of instructions? I could not get it run for the life of me because of the instructions. Either way, this sounds like something I would really like to use unfortunately my limited knowledge, nOOb skillz and lack of understanding makes this difficult. Edited January 8, 2005 by Young Tae Byun Quote
fixion Posted January 8, 2005 Author Posted January 8, 2005 If you could post exactly(!) what part of the install.txt (linenumbers pls.) you have problems with, perhaps we can help. Also - you do know how to use diff? (or some windows diff program if you use windows). That's how I did it. diff with -bduNr options. Quote
AWWWW.WAHWAH Posted January 8, 2005 Posted January 8, 2005 "Create a symbolic link from [...]/admin/includes/classes/newsletters.php to [...]/catalog/includes/classes/newsletters.php. If you cannot create symbolic links, simply copy the file to both places - I'm too lazy to write two." What? Maybe this is where I got confused? symbolic links? Just copy the files in both locations. Does the zip files already include both files? I think so or are we supposed to copy one of the files to both locations. Quote
Guest Posted January 8, 2005 Posted January 8, 2005 What? Maybe this is where I got confused? symbolic links? Just copy the files in both locations. Does the zip files already include both files? I think so or are we supposed to copy one of the files to both locations. <{POST_SNAPBACK}> Hmmm, sorry about that; I'm definitely a unix-centric guy, and I love symbolic links. Yes, just copy the file to both locations, particularly on Windows boxen which don't support links. I believe that the .zip file contains a link entry for the .../admin side, although linkless unzippers probably just copy the original. For those with link capabilities, but unfamiliar with the mechanism, you can: cd .../admin/includes/classes ln -s .../catalog/includes/classes/newsletters.php newsletters.php Change "..." to the full path in each case. The affect of this command is to create a copy of the original file (in this case with the same name) - only one which always changes when you modify the original. </soapbox> Quote
Guest Posted January 12, 2005 Posted January 12, 2005 Hi WCDW: First of all, thanks for you great contribution to OsCommerce. I?m trying to add it to my store, but I?m getting the following error when I select Newsletter Type from Tools in the left menu of the admin zone: -------------- Warning: Variable passed to each() is not an array or object in /home/gamezone/public_html/tienda/admin/includes/classes/newsletters.php on line 115 -------------- Line 115 is: while (list($id, $ary) = each($this->letters)) I guess the problem is that I need to define $this as an array somewhere, or that it?s trying to read data from a table that has not been created or filled. Could you please let me know what could be the problem and how to solve it?? Thanks in advance!!!! Quote
gregy Posted January 12, 2005 Posted January 12, 2005 i have two questions is this contribution whole package in contribution part, and if this contribution is now ready for nonmembers subscribe? thanx Quote
Guest Posted January 13, 2005 Posted January 13, 2005 Hi again! My previous problem was solved, but now when I go to view (edit, etc.) any customers from my store I'm getting a new error below the "gender" selection: Warning: Missing argument 6 for tep_draw_selection_field() in /home/gamezone/public_html/tienda/admin/includes/functions/html_output.php on line 209 Warning: Missing argument 6 for tep_draw_selection_field() in /home/gamezone/public_html/tienda/admin/includes/functions/html_output.php on line 209 yeah... twice. this is line 209: function tep_draw_selection_field($name, $type, $value = '', $checked = false, $compare = '', $parameters) { Could you please let me know what could be the problem and how to solve it?? Thanks in advance!!!! Quote
Guest Posted February 3, 2005 Posted February 3, 2005 Hi again! My previous problem was solved, but now when I go to view (edit, etc.) any customers from my store I'm getting a new error below the "gender" selection: yeah... twice. this is line 209: Could you please let me know what could be the problem and how to solve it?? Thanks in advance!!!! <{POST_SNAPBACK}> How did you fix this please? Debs Quote
Guest Posted February 3, 2005 Posted February 3, 2005 Hi Everyone I'm getting this error: Fatal error: Call to undefined function: set_type() in /admin/newsletters.php on line 249 any help would be appreciated Debs Quote
Guest Posted February 3, 2005 Posted February 3, 2005 -------------- Warning: Variable passed to each() is not an array or object in /home/gamezone/public_html/tienda/admin/includes/classes/newsletters.php on line 115 -------------- Line 115 is: while (list($id, $ary) = each($this->letters)) I guess the problem is that I need to define $this as an array somewhere, or that it?s trying to read data from a table that has not been created or filled. Could you please let me know what could be the problem and how to solve it?? -------- Hello all, and sorry I don't hang out here often enough. This error sounds like there are no newsletters defined; an exception condition this code does not handle well. $this->letters should be defined in the first 'var' line of the class, so what is probably happening is that the array is simply not getting filled, as there is nothing to put in it. Try using the admin side to define a newsletter, and see if you still get the error; if so I may need to look at your code. Ultimately the 'while' loop in question should be wrappered with an 'if (is_array($this->letters)) to prevent this error when no newsletters are defined. - bill Quote
Guest Posted February 3, 2005 Posted February 3, 2005 i have two questions is this contribution whole package in contribution part, and if this contribution is now ready for nonmembers subscribe? ----------------- The last upload I posted contains the entire contribution, as well as pre-edited versions of the stock osC (2.2 MS) files. No work has been done to allow non-members to subscribe, unfortunately. Although it shouldn't be too hard to snip the newsletter guts from the create_account.php screen into a new screen and add a button for it somewhere, the issue then comes up of where to store that data. Nominally it goes in the customer table, but I'm not sure how well osC would handle having a bunch of mostly-blank records in that table! Even if the system can cope with the blank records a better inteface for non-members might be to enable an subscribe/unsubscribe option via e-mail instead. (It's actually probably less work than hacking up create_account.php. ;) Quote
Guest Posted February 3, 2005 Posted February 3, 2005 Hi again! My previous problem was solved, but now when I go to view (edit, etc.) any customers from my store I'm getting a new error below the "gender" selection: yeah... twice. this is line 209: Could you please let me know what could be the problem and how to solve it?? ------ Hmm, I thought that was solved in the latest version... The fix is to change "$parameters" to "$parameters=''" in the defintiion for the tep_draw_ function. Otherwise, any call to this function which does not include the 6th parameter will cause an error. Adding the ='' says to use null as a default if nothing is passed in the function call. Quote
Guest Posted February 3, 2005 Posted February 3, 2005 Hi Everyone I'm getting this error: Fatal error: Call to undefined function: set_type() in /admin/newsletters.php on line 249 any help would be appreciated Debs ----- Hi, Debbie, and thanks for the e-mail; looks like I need to get back here more often. The set_type function should appear in ../admin/includes/modules/newsletters/newsletters.php. If your copy does not have that function, you might want to replace it with the version from the latest upload (if it IS the latest version, please let me know!). Otherwise, you can just add the function to the end of that file (before the closing '}'!). It should read like this: function set_type($type) { $this->type = $type; } Hope this helps! Quote
irishmystic Posted February 7, 2005 Posted February 7, 2005 It should read like this: function set_type($type) { $this->type = $type; } Hope this helps! <{POST_SNAPBACK}> Hi there, Thanks, for the contribution! I am still trying to get it to work properly. The above function was missing from the newsletter class in (newsindex_v05_1.zip). Just thought you would like to know. My difficulty is with the account creation. I can create an account and the check boxes appear, but the newsletter subscription is not making it to the data base upon success. I can add the newsletters from the admin and from the account_newsletter.php, just not from the creat_account.php. No errors reported, just no subscription. Any thoughts? Thanks for your help! Peace, Erin :) Quote
irishmystic Posted February 7, 2005 Posted February 7, 2005 Hi there,Thanks, for the contribution! I am still trying to get it to work properly. The above function was missing from the newsletter class in (newsindex_v05_1.zip). Just thought you would like to know. <{POST_SNAPBACK}> Just a correction. I meant ../admin/includes/modules/newsletters/newsletters.php. not newsletter class... brain dead, sorry. :blush: Quote
Guest Posted February 8, 2005 Posted February 8, 2005 Just a correction. I meant ../admin/includes/modules/newsletters/newsletters.php. not newsletter class... brain dead, sorry. :blush: <{POST_SNAPBACK}> I'm still not sure how I missed that one, but that module also has some other required changes that may be affecting your results. I've uploaded a complete replacement for .../newsletter.php (note the lack of the 's' in the module name itself); also an earlier typo of mine). Please give it a try and let me know if you still have problems... Quote
irishmystic Posted February 8, 2005 Posted February 8, 2005 I'm still not sure how I missed that one, but that module also has some other required changes that may be affecting your results. I've uploaded a complete replacement for .../newsletter.php (note the lack of the 's' in the module name itself); also an earlier typo of mine). Please give it a try and let me know if you still have problems... <{POST_SNAPBACK}> Hi WCDW, Thanks, for the quick reply! Your newsletter.php is the same as mine, now that I have the "function set_type" added. As I said, my real problem seems to be in create_acount.php, the class it calls, or the way it is being called. I can create a new account, no problem, but it does not insert the newsletter preference in the database. However, once I have created the account, I can add a newsletter from the admin OR from the newsletter settings in account_newsletter.php. I just can't figure out why it is not inserting the info from create_account.php into the database. The changes as you instructed in install were: (3b) create_account.php - Allow new customers to set newsletter preferences when creating their account LOCATE this line (very top of file:) require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CREATE_ACCOUNT); INSERT these lines just below it: require(DIR_WS_CLASSES . 'newsletters.php'); $myLetters = new newsletters(); -+-+-+-+-+-+-+-+-+ REMOVE these lines: if (isset($HTTP_POST_VARS['newsletter'])) { $newsletter = tep_db_prepare_input($HTTP_POST_VARS['newsletter']); } else { $newsletter = false; } -+-+-+-+-+-+-+-+-+ LOCATE these lines: if ($error == false) { $sql_data_array = array('customers_firstname' => $firstname, ... INSERT the following line as indicated: if ($error == false) { $newsletter = $myLetters->process(); // insert me $sql_data_array = array('customers_firstname' => $firstname, ... -+-+-+-+-+-+-+-+-+ REPLACE these lines: <tr> <td class="main"><?php echo ENTRY_NEWSLETTER; ?></td> <td class="main"><?php echo tep_draw_checkbox_field('newsletter', '1') . ' ' . (tep_not_null(ENTRY_NEWSLETTER_TEXT) ? '<span class="inputRequirement">' . ENTRY_NEWSLETTER_TEXT . '</span>': ''); ?></td> </tr> with these: <?php $myLetters->listit(0); ?> --------------------------------------------------------------------------------- The list of available newsletters shows up just fine in create_account.php, along with the checkboxes. I really wish I could get the newsletter selections to insert from this page, as many people are not going to bother going to their account page to add a newsletter unless they happen to be there for something else... Just don't have a clue as to what I should try next. Thanks, for your time. I do appreciate it! Peace, Erin :) Quote
Guest Posted February 8, 2005 Posted February 8, 2005 As I said, my real problem seems to be in create_acount.php, the class it calls, or the way it is being called. I can create a new account, no problem, but it does not insert the newsletter preference in the database. I have the same problem - have just tested the process and when you create a new account the newsletter preferences are NOT inserted into the database. Changing preferences after log-in does work Debs Quote
Guest Posted February 10, 2005 Posted February 10, 2005 I just can't figure out why it is not inserting the info from create_account.php into the database. The changes as you instructed in install were: (3b) create_account.php LOCATE these lines: if ($error == false) { $sql_data_array = array('customers_firstname' => $firstname, ... INSERT the following line as indicated: if ($error == false) { $newsletter = $myLetters->process(); // insert me $sql_data_array = array('customers_firstname' => $firstname, ... <{POST_SNAPBACK}> You posted too quickly! I do have topic tracking enable for this thread, but apparently if I a) get notified, B) post a reply and c) receive a new reply all in the same day, I don't get a follow up notification. :-( In any event, I see the exact problem -- I fixed the sample code, but apparently neglected to fix the instructions. The fix for tis is to locate the following two lines in create_account.php: $newsletter = $myLetters->process(); ... 'customers_newsletter' => $newsletter, Replace these lines with this: $myLetters->process(); ... 'customers_newsletter' => $myLetters->selected, My bad, and sorry for not getting back here sooner - guess I shouldn't reply on topic tracking... Quote
irishmystic Posted February 10, 2005 Posted February 10, 2005 You posted too quickly! I do have topic tracking enable for this thread, but apparently if I a) get notified, B) post a reply and c) receive a new reply all in the same day, I don't get a follow up notification. :-( <{POST_SNAPBACK}> Hi William, You are a doll!! Thank you, so much for this. I have been having trouble with some other contributions and it has been getting quite frustrating trying to find the errors and solutions. I made the changes you suggest, checked it out, and everything works with your contribution now. This is a wonderful help to me, as I offer newsletters AND special coupons, but many people do not want both. Now it is all taken care of by your great contribution. Do not worry about missing the notification about topic reply. This happens to me, also. I just check back every day or 2 to the topics I am keeping up on, just in case I missed something. If you turn it off, you will not know that 3 months down the road, somebody new has a question. :-" Perhaps, soon, you can make the little changes to the code and upload a new set. It will save many people time and frustration. In the meantime, the answers are here. Again, many thanks. You saved me hours of work, every month. Peace, Erin :) Quote
Guest Posted February 10, 2005 Posted February 10, 2005 Perhaps, soon, you can make the little changes to the code and upload a new set. It will save many people time and frustration. In the meantime, the answers are here. Again, many thanks. You saved me hours of work, every month. <{POST_SNAPBACK}> Glad that got things working for you, Erin. And coincidentally enough, I did spent some time earlier today cleaning up the contribution and posting a new - hopefully complete and correct - version. (I also posted a new contrib, which prevents customers from using open proxies for purchases as a fraud-prevention measure. That one is a LOT simpler than this one. :D ) I appreciate your patience, particularly with my lackluster reponse times, and am always am flattered that people enjoy the contribution. (And flabbergasted that no one had ever written one before. ;) Quote
Guest Posted February 11, 2005 Posted February 11, 2005 thanks Bill, this works really well, going to install it on my production server now! Debs Quote
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.
Note: Your post will require moderator approval before it will be visible.