Results 1 to 9 of 9
  1. #1
    Join Date
    Oct 2007
    Posts
    241
    Plugin Contributions
    0

    Default Referrals Mod (HowDidUHearAboutUs) Alterations

    Finally...I managed to get the module working with my ZC 1.3.8A set-up!!!!

    It seems to work 100%


    But now, I'm wondering....

    I would like to change the way user entered data is dealt with.

    Instead of having a pulldown option of OTHER which then allows entry of text at the blank......

    I would actually rather have pulldown with various options, as well as a blank.

    The data entered in the blank could be displayed on the customer admin page, while the canned pulldown option would go to the Extras-->Referral Sources list.


    I'm going to start looking at the files, to see what I can figure out.

    I expect that I will be able to isolate the code...

    To start..in referral_functions.php...

    Line 60:

    Code:
    if ($show_other == 'true') {
    		$sources_array[] = array('id' => '9999', 'text' => PULL_DOWN_OTHER);
    	}
    I'm sure that this can be removed, as I never want an 'other option' for this menu--ever.

    Off to find more relevant code in the other module files!! This seems complex, but even if I can't do this, I want to at least learn as much as I can about how this COULD be done!

    ~Donn

  2. #2
    Join Date
    Oct 2007
    Posts
    241
    Plugin Contributions
    0

    Default Re: Referrals Mod (HowDidUHearAboutUs) Alterations

    OK....I see this is not so difficult...

    In create_account.php

    around line 78:

    Code:
    //rmh referral start
        $source = zen_db_prepare_input($_POST['source']);
        if (isset($_POST['source_other'])) $source_other = zen_db_prepare_input($_POST['source_other']);
    //rmh referral end
    What if I take the conditional out?

    and just make it:

    Code:
    //rmh referral start
        $source = zen_db_prepare_input($_POST['source']);
        $source_other = zen_db_prepare_input($_POST['source_other']);
    //rmh referral end
    I know iM on the right track, so far.....

  3. #3
    Join Date
    Oct 2007
    Posts
    241
    Plugin Contributions
    0

    Default Re: Referrals Mod (HowDidUHearAboutUs) Alterations

    OK, in create_account.php

    Around line 449:

    Code:
     if ($source == '9999') {
            zen_db_perform(TABLE_SOURCES_OTHER, array('customers_id' => $_SESSION['customer_id'], 'sources_other_name' => $source_other));
          }
    This code seems to write data (spirces_Other) to the table IF and ONLY IF $source == "9999")

    This is only executed if the Source_other is selected by user....

    So what if I remove the conditional:

    Code:
    $db->Execute($sql);
    	 
            zen_db_perform(TABLE_SOURCES_OTHER, array('customers_id' => $_SESSION['customer_id'], 'sources_other_name' => $source_other));
    As the cart ALWAYS saves the TYPE of referral (Google, Yahoo, 'other'), that's ALWAYS saved....

    Now, with the removeal of the conditional, the cart will ALWAYS save to the database table sources_other with EVERY referral, I *believe*.

  4. #4
    Join Date
    Oct 2007
    Posts
    241
    Plugin Contributions
    0

    Default Re: Referrals Mod (HowDidUHearAboutUs) Alterations

    STILL thinking about this....

    OK...first..checking my install of the 'How Did You Hear About Us' module, I notice in the admin, there is NO option for 'Display "Other" Referral option', only 'Require Referral'.

    I executed the SQL by cutting-and-pasting into the admin Install SQL Patches area. The rest of the script seemed to work.

    Should I leave this alone? There is ALWAYS a blank displayed, even when I don't select 'other'. This is more of what I need, anyway...

    Another file to mod: tpl_modules_create_account.php

    Line 185--

    Code:
    <!-- //rmh referral start -->
    
    
    <?php
     if (DISPLAY_REFERRAL_OTHER == 'true') {
    ?>
    <label class="inputLabel" for="source_other" ><?php echo ENTRY_SOURCE_OTHER; ?></label>
    <?php echo zen_draw_input_field('source_other', '', 'id="sources_other_name"') .  (zen_not_null(ENTRY_SOURCE_OTHER_TEXT) ? '<span class="inputRequirement">' . ENTRY_SOURCE_OTHER_TEXT . '</span>': ''); ?>
    <br class="clearBoth" />
    
    </fieldset>
    <?php
    }
    ?>
    <!-- //rmh referral end -->
    Here, another conditional. If I take the IF part out, but leave the code that executes if true, the blank should ALWAYS display. As there is no option to set this on my admin, I guess it should be left as is, since the blank ALWAYS displays right now.

    Im guessing, if my cart just HAPPENS to not have the option for 'other' set, I should really just change the file that will post the data to the sources_other tables, from sometimes to all the time.

  5. #5
    Join Date
    Oct 2007
    Posts
    241
    Plugin Contributions
    0

    Default Re: Referrals Mod (HowDidUHearAboutUs) Alterations

    Addendum...

    I think an 'other' option on the pulldown is essential, even if I require both a pulldown value AND a string of text at the blank.

    So the above statement that I will NEVER need an option of 'other' in the pulldown should be that I will ALWAYS need it.

    OK..that's it....




    Donn

  6. #6
    Join Date
    Oct 2007
    Posts
    241
    Plugin Contributions
    0

    Default Re: Referrals Mod (HowDidUHearAboutUs) Alterations

    It seems that

    AS IS,

    Without the ability to set 'Other Sources' to ON in admin,
    The module ALWAYS features the 'other' option in the pull down, as well as the blank

    and

    will actually SAVE both sets of data, both the category, and the text string.

    (I guess the 'isset' in one of the code examples above just means that if the string is defined.....if 'it's set' or somethig....

    SO--I don't have to do ANYthing to get the functionality I wanted!!!



    As of now, I believe I only have to modify the template output in Admin Customers, I guess, so I can see both sources, and sources_other for ALL customers.

    As of now, if there is a source value, but no source_other text, it will display the text corresponding to the value in the admin Customers area.

    If there IS a string of text defined, then THAT displays.

  7. #7
    Join Date
    Oct 2007
    Posts
    241
    Plugin Contributions
    0

    Default Re: Referrals Mod (HowDidUHearAboutUs) Alterations

    Different ways to approach this:

    -Have both referral and referral_other display in Customer info area.

    -Have both display in Referral_Sources in admin extras menu, with clickable list, as there is now for 'other' referrals (only).

    -Define referrals_other to include the first five characters of the name assigned to each referral value for the pulldown menu. This way, every instance of referrals_other will also include a part of the text of the type of referral.



    Which is the best way to proceed?



    The third option seems best....

  8. #8
    Join Date
    Oct 2007
    Posts
    241
    Plugin Contributions
    0

    Default Re: Referrals Mod (HowDidUHearAboutUs) Alterations

    To change 'source_other' to include 'source' (I *think*)

    In create_account.php

    around line 78:

    Code:
    //rmh referral start
        $source = zen_db_prepare_input($_POST['source']);
        if (isset($_POST['source_other'])) $source_other = zen_db_prepare_input($_POST['source_other']);
    //rmh referral end
    CAN I just change this to:

    Code:
    //rmh referral start
        $source = zen_db_prepare_input($_POST['source']);
        if (isset($_POST['source_other'])) $source_other = zen_db_prepare_input($_POST['source' , 'source_other']);
    //rmh referral end
    Can anyone please tell me if this is legit PHP syntax, and further, if it may work.

    Thanks in advance..sorry for talking to myself in here all this time.....hope it helps SOMEone, some time in future!!
    Last edited by Donn; 19 Feb 2009 at 02:48 AM.

  9. #9
    Join Date
    Oct 2007
    Posts
    241
    Plugin Contributions
    0

    Default Re: Referrals Mod (HowDidUHearAboutUs) Alterations

    Dear Moderator,

    Please move this post, as I did not realize that there is a specific section of the forum dedicated to just this sort of thing.
    (Features Wish List)

    Thank you,

    Donn

    --------------------------------------------------------------------
    OK, I hope it's acceptable culture on this site to just discuss ideas like this, without really knowing how to code them. I'm just thinking aloud, here.....

    I've been playing around with this, and realized....

    What's REALLY needed are DIFFERENT SQL entries like there are for 'sources_other', for each and every source.

    Otherwise, even if I get this working, EVERY contact who visits will be listed in the admin controls along with the ppl who found the site by selecting 'other'. That gets lame.

    So, I have to look at the sql script and figure out how to array other data categories to also hold 'other' data. (text entry)

    I see that 'other' is defined as '9999' and so I assume other categories listed in the pulldown are just assigned a number corresponding to their row-position in the table?

    Obviously, they are not assigned by alphabetical ordering, as I can change the name of a source and it will move up or down the pulldown, and I doubt the database moves data around every time....

    The EASIEST way to go about this ....I think....

    Is to:

    NOT create any other database columns for new data....

    Save ALL text entry from ALL selections into the 'other folder', as well as incrementing the correct 'sources' entry by one.

    This will skew results for 'other', though I think that can be fixed as well.

    Still, I'm not so concerned about figuring out how many users came to the site from 'other' sources. That sort of data is best investigated further....as it is not really useful, statistically speaking...

    To make this solution (of not creating additional SQL columns) work....

    The 'sources_other' data MUST also contain the 'source' name associated with that particular source, saved as text, within the sources_other database entry, else looking at the data will be meaningless. Having that data there makes it useful.

    Also, the customers report should then ALWAYS display the sources_other data, and not just source name corresponding to that source number.
    Last edited by Donn; 20 Feb 2009 at 10:22 PM.

 

 

Similar Threads

  1. How Did You Hear About Us? Referrals Mod [Support Thread]
    By martyndw2005 in forum All Other Contributions/Addons
    Replies: 364
    Last Post: 30 Mar 2026, 02:40 PM
  2. v151 Alterations to files for PHP5.4 Compatability
    By CandleMan in forum General Questions
    Replies: 0
    Last Post: 24 Feb 2014, 06:15 PM
  3. Replies: 2
    Last Post: 1 Aug 2010, 04:08 PM
  4. Update w/o too much alterations possible?
    By dvenzo in forum Upgrading from 1.3.x to 1.3.9
    Replies: 3
    Last Post: 10 Nov 2006, 09:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg