X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Weird States Dropdown Problem (https://forum.x-cart.com/showthread.php?t=48927)

presson83 07-31-2009 04:34 AM

Weird States Dropdown Problem
 
Hi All,

I'm having a strange issue with my state dropdown menu on my registration form. It shows the correct states, but then after the last state you can select two strange options.. "forEach" and "array". There's also a bunch of blank spaces after those weird options at the bottom. Here's the link:

http://eternitywebdev.com/~klingers/register.php

I've checked the database multiple times and definitely don't see either array or foreach in my states table. Any ideas?

cowsdonthack 09-01-2009 08:44 AM

Re: Weird States Dropdown Problem
 
Quote:

Originally Posted by presson83
Hi All,

I'm having a strange issue with my state dropdown menu on my registration form. It shows the correct states, but then after the last state you can select two strange options.. "forEach" and "array". There's also a bunch of blank spaces after those weird options at the bottom. Here's the link:

http://eternitywebdev.com/~klingers/register.php

I've checked the database multiple times and definitely don't see either array or foreach in my states table. Any ideas?


Foreach is used to load your options in the first place

Post the Code for the page. What's probably happening is that your list isn't ENDING and includes the ending statements as options

presson83 09-01-2009 09:15 AM

Re: Weird States Dropdown Problem
 
Here's my register_billing_addres.tpl file which displays the states dropdown (not sure if this is what you are asking for though.. I'm not sure what php file the states stuff is programmed into):

Code:

{*
$Id: register_billing_address.tpl,v 1.4 2008/11/28 07:56:12 cray Exp $
vim: set ts=2 sw=2 sts=2 et:
*}
{if $is_areas.B eq 'Y'}
{if $hide_header eq ""}
            <tr>
        <td colspan="3" class="register-section-title">
          <label>{$lng.lbl_billing_address}</label>
        </td>
            </tr>
{/if}

{if $action eq "cart"}
      <tr style="display: none;">
        <td>
          <input type="hidden" name="action" value="cart" />
          <input type="hidden" name="paymentid" value="{$paymentid}" />
                </td>
            </tr>
{/if}

{if $default_fields.b_title.avail eq 'Y'}
            <tr>
                <td class="data-name">{$lng.lbl_title}</td>
                <td class="data-required">{if $default_fields.b_title.required eq 'Y'}*{/if}</td>
                <td>
          <select id="b_title" name="b_title">
{include file="main/title_selector.tpl" field=$userinfo.b_titleid}
          </select>
                </td>
            </tr>
{/if}

{if $default_fields.b_firstname.avail eq 'Y'}
            <tr>
                <td class="data-name">{$lng.lbl_first_name}</td>
                <td class="data-required">{if $default_fields.b_firstname.required eq 'Y'}*{/if}</td>
                <td>
          <input type="text" id="b_firstname" name="b_firstname" size="32" maxlength="32" value="{$userinfo.b_firstname|escape}" />
{if $reg_error ne "" and $userinfo.b_firstname eq "" && $default_fields.b_firstname.required eq 'Y'}<span class="error-message">&lt;&lt;</span>{/if}
                </td>
            </tr>
{/if}

{if $default_fields.b_lastname.avail eq 'Y'}
            <tr>
                <td class="data-name">{$lng.lbl_last_name}</td>
                <td class="data-required">{if $default_fields.b_lastname.required eq 'Y'}*{/if}</td>
                <td>
          <input type="text" id="b_lastname" name="b_lastname" size="32" maxlength="32" value="{$userinfo.b_lastname|escape}" />
{if $reg_error ne "" and $userinfo.b_lastname eq "" && $default_fields.b_lastname.required eq 'Y'}<span class="error-message">&lt;&lt;</span>{/if}
                </td>
            </tr>
{/if}

{if $default_fields.b_address.avail eq 'Y'}
            <tr>
                <td class="data-name">{$lng.lbl_address}</td>
                <td class="data-required">{if $default_fields.b_address.required eq 'Y'}*{/if}</td>
                <td>
          <input type="text" id="b_address" name="b_address" size="32" maxlength="64" value="{$userinfo.b_address|escape}" />
{if $reg_error ne "" and $userinfo.b_address eq "" and $default_fields.b_address.required eq 'Y'}<span class="error-message">&lt;&lt;</span>{/if}
                </td>
            </tr>
{/if}

{if $default_fields.b_address_2.avail eq 'Y'}
            <tr>
                <td class="data-name">{$lng.lbl_address_2}</td>
                <td class="data-required">{if $default_fields.b_address_2.required eq 'Y'}*{/if}</td>
                <td>
          <input type="text" id="b_address_2" name="b_address_2" size="32" maxlength="64" value="{$userinfo.b_address_2|escape}" />
{if $reg_error ne "" and $userinfo.b_address_2 eq "" and $default_fields.b_address_2.required eq 'Y'}<span class="error-message">&lt;&lt;</span>{/if}
                </td>
            </tr>
{/if}

{if $default_fields.b_city.avail eq 'Y'}
            <tr>
                <td class="data-name">{$lng.lbl_city}</td>
                <td class="data-required">{if $default_fields.b_city.required eq 'Y'}*{/if}</td>
                <td>
          <input type="text" id="b_city" name="b_city" size="32" maxlength="64" value="{$userinfo.b_city|escape}" />
{if $reg_error ne "" and $userinfo.b_city eq "" and $default_fields.b_city.required eq 'Y'}<span class="error-message">&lt;&lt;</span>{/if}
                </td>
            </tr>
{/if}

{if $default_fields.b_county.avail eq 'Y' and $config.General.use_counties eq "Y"}
            <tr>
                <td class="data-name">{$lng.lbl_county}</td>
                <td class="data-required">{if $default_fields.b_county.required eq 'Y'}*{/if}</td>
                <td>
{include file="main/counties.tpl" counties=$counties name="b_county" default=$userinfo.b_county country_name="b_country"}
{if ($reg_error ne "" and $userinfo.b_county eq "" and $default_fields.b_county.required eq 'Y') or $error eq "b_county"}<span class="error-message">&lt;&lt;</span>{/if}
                </td>
            </tr>
{/if}

{if $default_fields.b_state.avail eq 'Y'}
            <tr>
                <td class="data-name">{$lng.lbl_state}</td>
                <td class="data-required">{if $default_fields.b_state.required eq 'Y'}*{/if}</td>
                <td>
{include file="main/states.tpl" states=$states name="b_state" default=$userinfo.b_state|default:$config.General.default_state default_country=$userinfo.b_country|default:$config.General.default_country country_name="b_country"}
{if $error eq "b_statecode" || ($reg_error ne "" && $userinfo.b_state eq "" && $default_fields.b_state.required eq 'Y' && $userinfo.s_display_states)}<span class="error-message">&lt;&lt;</span>{/if}
                </td>
            </tr>
{/if}

{if $default_fields.b_country.avail eq 'Y'}
            <tr>
                <td class="data-name">{$lng.lbl_country}</td>
                <td class="data-required">{if $default_fields.b_country.required eq 'Y'}*{/if}</td>
                <td>
          <select name="b_country" id="b_country" onchange="check_zip_code()">
{foreach from=$countries item=c}
            <option value="{$c.country_code}"{if $userinfo.b_country eq $c.country_code || ($c.country_code eq $config.General.default_country && $userinfo.b_country eq "")} selected="selected"{/if}>{$c.country|amp}</option>
{/foreach}
          </select>
{if $reg_error ne "" and $userinfo.b_country eq "" and $default_fields.b_country.required eq 'Y'}<span class="error-message">&lt;&lt;</span>{/if}
                </td>
            </tr>
{/if}

{if $default_fields.b_state.avail eq 'Y' && $default_fields.b_country.avail eq 'Y' && $js_enabled eq 'Y'}
      <tr style="display: none;">
          <td>
{include file="main/register_states.tpl" state_name="b_state" country_name="b_country" county_name="b_county" state_value=$userinfo.b_state|default:$config.General.default_state county_value=$userinfo.b_county}
          </td>
            </tr>
{/if}

{if $default_fields.b_zipcode.avail eq 'Y'}
            <tr>
                <td class="data-name">{$lng.lbl_zip_code}</td>
                <td class="data-required">{if $default_fields.b_zipcode.required eq 'Y'}*{/if}</td>
                <td>
          <input type="text" id="b_zipcode" name="b_zipcode" size="32" maxlength="32" value="{$userinfo.b_zipcode|escape}" onchange="javascript: check_zip_code();" />
{if $reg_error ne "" and $userinfo.b_zipcode eq "" and $default_fields.b_zipcode.required eq 'Y'}<span class="error-message">&lt;&lt;</span>{/if}
                </td>
            </tr>
{/if}

{include file="customer/main/register_additional_info.tpl" section="B"}

{/if}


cowsdonthack 09-01-2009 09:26 AM

Re: Weird States Dropdown Problem
 
Please include these files, I think this is where you'd be able to find the problem

main/states.tpl
main/register_states.tpl

presson83 09-01-2009 09:34 AM

Re: Weird States Dropdown Problem
 
Here's my states.tpl:

HTML Code:


{*
$Id: states.tpl,v 1.15 2008/08/21 09:52:51 max Exp $
vim: set ts=2 sw=2 sts=2 et:
*}
{if $states ne ""}
<select name="{$name}" id="{$name|replace:"[":"_"|replace:"]":""}" {$style}>
{if $required eq "N"}
    <option value="">[{$lng.lbl_please_select_one}]</option>
{/if}
    <option value="{if $value_for_other ne "no"}Other{/if}"{if $default eq "Other"} selected="selected"{/if}>{$lng.lbl_other}</option>
{section name=state_idx loop=$states}
{if $config.General.default_country eq $states[state_idx].country_code || $country_name eq '' || $default_fields.$country_name.avail eq 'Y'}
    <option value="{$states[state_idx].state_code|escape}"{if $default eq $states[state_idx].state_code && (!$default_country || $default_country eq $states[state_idx].country_code)} selected="selected"{/if}>{$states[state_idx].country_code}: {$states[state_idx].state|amp}</option>
{/if}
{/section}
</select>
{else}
<input type="text"{if $name ne ''} id="{$name|replace:"[":"_"|replace:"]":""}"{/if} size="32" maxlength="65" name="{$name}" value="{$default|escape}" />
{/if}


And here's my register_states.tpl:

HTML Code:


{*
$Id: register_states.tpl,v 1.15 2008/11/17 12:47:42 max Exp $
vim: set ts=2 sw=2 sts=2 et:
*}
{if $country_id eq ''}
  {assign var="country_id" value=$country_name}
{/if}
<script type="text/javascript">
<!--
init_js_states(document.getElementById('{$country_id}'), '{$state_name}', '{$county_name}', '{$state_value|wm_remove|escape:javascript}', '{$county_value|wm_remove|escape:javascript}');
-->

</script>


I don't think I've touched either of those (although when I installed xcart I did forget to add the states table so I had to add it later to my DB.. perhaps something happened when i created it, but I definitley make the table exactly as it is in my other stores via a mysql import.)

Thanks so much for your help on this.

cowsdonthack 09-01-2009 10:09 AM

Re: Weird States Dropdown Problem
 
Maybe it copied over differently. It doesn't seem to be a problem in any of these files. I would play around with the foreach tags inside of your register_billing_addres.tpl and seeing how it changes your page. If anything changes you'll know what is causing the change.

If nothing changes than this is a dead end :(


All times are GMT -8. The time now is 02:15 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.