Changing a True / False Statement to Something Else

Discussion in 'JavaScript' started by brandonvd, Apr 20, 2008.

  1. #1
    First, I am sorry if this is a total newb question, but I know nothing about Javascript and so I am hoping that someone here might be able to help me.

    I have been trying to change my checkout page on my ecommerce site to have some drop downs so that people can choose to either login, register, or checkout as a guest.

    This is my entire checkout_login.tpl code:

    
    {* $Id: checkout_login.tpl 5099 2008-04-07 13:20:27Z zeke $ *}
    
    <script type="text/javascript" language="javascript 1.2">
    //<![CDATA[
    
    function fn_switch_checkout_type(status)
    {$ldelim}
    	{if $checkout_type == 'classic'}
    		{literal}
    		var elms = ['email','user_login_profile','password1','password2'];
    		var k;
    
    		for (k in elms) {
    			if (status) {
    				profiles_form.set_required_fields(elms[k]);
    				if (document.getElementById(elms[k])) {
    					//document.getElementById(elms[k]).value = '';
    				}
    			} else {
    				profiles_form.uset_required_fields(elms[k]);
    			}
    		}
    		fn_show_tag('profiles_auth', true);
    		fn_show_tag('profiles_box', false);
    		fn_show_tag('account_box', !status);
    		{/literal}
    	{else}
    		
    		
    		{literal}
    
    		if (status == true) {
    			fn_show_tag('step_one_register', false);
    		} else{
    			fn_show_tag('step_one_anonymous_checkout', false);
    		} 
    		fn_show_tag('step_one_login', true);
    		
    		{/literal}
    	{/if}
    {$rdelim}
    //]]>
    </script>
    
    <table width="100%" cellpadding="0" cellspacing="0" border="0">
    <tr>
    	<td width="50%" valign="top">
    	{assign var='result_ids' value="'sign_io', 'cart_items','checkout_totals','checkout_steps', 'cart_status'"}
    	{if $settings.Addons.promotions == 'Y'}
    		{assign var='result_ids' value=$result_ids|cat:",'convenient_promotion'"}
    	{/if}
    	<!--{include file="auth_pages/login.tpl" nothing_extra='Y' form_name='step_one_login_form' form_alias='solf' result_ids=$result_ids checkout_login='Y' on_login_click="solf.callback = function ()$ldelim window.location.hash = '#checkout_top' $rdelim;"}
    	</td>
    	<td width="50%" valign="top" style="padding-left: 10px;">-->
    		{if $settings.General.approve_user_profiles != 'Y'}
    		
            
            <div class="style45">{$lang.text_has_an_account}</div>
    		<div class="buttons-wrapper">{include file="buttons/button.tpl" but_onclick="fn_switch_checkout_type(true);" but_text=$lang.login}</div>
            <div style="height: 1px; background: #ffffff url('{$images_dir}/sidebox_delim.gif') repeat-x top; margin: 15px 0px 8px 0px;"></div>
            
            <div class="style45">{$lang.text_dont_have_an_account_full}</div>
    		<div class="buttons-wrapper">{include file="buttons/button.tpl" but_onclick="fn_switch_checkout_type(true);" but_text=$lang.register}</div>
    		{/if}
    		{if $settings.General.disable_anonymous_checkout != 'Y'}
    		<div style="height: 1px; background: #ffffff url('{$images_dir}/sidebox_delim.gif') repeat-x top; margin: 15px 0px 8px 0px;"></div>
    		<div class="style45">
            {$lang.text_dont_want_to_register_an_account}</div>
    		<div class="buttons-wrapper">{include file="buttons/button.tpl" but_onclick="fn_switch_checkout_type(false);" but_text=$lang.checkout_as_guest}</div>
    		{/if}
    	</td>
    </tr>
    </table>
    Code (markup):
    The part I am trying to change is:

    
    
    {literal}
    		
    		if (status == true) {
    			fn_show_tag('step_one_register', false);
    		} else{
    			fn_show_tag('step_one_anonymous_checkout', false);
    		} 
    		fn_show_tag('step_one_login', true);
    		
    		{/literal}
    Code (markup):
    and:

    
    
    <div class="style45">{$lang.text_has_an_account}</div>
    		<div class="buttons-wrapper">{include file="buttons/button.tpl" but_onclick="fn_switch_checkout_type(true);" but_text=$lang.login}</div>
            <div style="height: 1px; background: #ffffff url('{$images_dir}/sidebox_delim.gif') repeat-x top; margin: 15px 0px 8px 0px;"></div>
            
            <div class="style45">{$lang.text_dont_have_an_account_full}</div>
    		<div class="buttons-wrapper">{include file="buttons/button.tpl" but_onclick="fn_switch_checkout_type(true);" but_text=$lang.register}</div>
    		{/if}
    		{if $settings.General.disable_anonymous_checkout != 'Y'}
    		<div style="height: 1px; background: #ffffff url('{$images_dir}/sidebox_delim.gif') repeat-x top; margin: 15px 0px 8px 0px;"></div>
    		<div class="style45">
            {$lang.text_dont_want_to_register_an_account}</div>
    		<div class="buttons-wrapper">{include file="buttons/button.tpl" but_onclick="fn_switch_checkout_type(false);" but_text=$lang.checkout_as_guest}</div>
    Code (markup):
    The part that I am having troubles figuring out how to change is:

    
    
    <div class="style45">{$lang.text_has_an_account}</div>
    		<div class="buttons-wrapper">{include file="buttons/button.tpl" but_onclick="fn_switch_checkout_type(true);" but_text=$lang.login}</div>
            <div style="height: 1px; background: #ffffff url('{$images_dir}/sidebox_delim.gif') repeat-x top; margin: 15px 0px 8px 0px;"></div>
    Code (markup):
    Basically I need to change the fn_switch_checkout_type(true) to something else that won't conflict with the other 2 options.

    If any one can help I would really appreciate it. If anyone needs more info like a link or something I will be happy to provide one.

    Thank you in advance for your help,

    Brandon
     
    brandonvd, Apr 20, 2008 IP