View Single Post
  #1  
Old 07-29-2005, 10:47 AM
 
Tuner Tuner is offline
 

eXpert
  
Join Date: Jan 2003
Location: Scottsdale Arizona
Posts: 245
 

Default Disabled Javascript Support

I just wanted to share with people my Journey into the world of making x-cart more compatible when Javascript is Disabled.

1. OK First off I found this thread and I modified it to make a big Link for uses to tell x-cart their java is disabled.
Thread: http://forum.x-cart.com/viewtopic.php?t=20533&highlight=blank

Place this code under the body Tag in skin1/customer/home.tpl
(for easycheckout people also for skin1/customer/home_checkout.tpl just change the href to "cart.php?js=n")

Code:
<noscript> <center><table bgcolor="#FFFFFF" width="100%"><tr><td align=center> <FONT COLOR="#FF0000" size="+4" color="#FF9900">***JAVA Is Disable Click Hear To Continue*** </td></tr></table> </center> </noscript>

!!Warning Search Engines will Index this as your site description most likely So I recommend inserting something like this between the above code and the <body> tag.
Quote:
<h1>Model Car | Scale Car Model | Diecast cars</h1>


Scalecars.com has a model car for any collector. Our Scale model cars are Diecast cars made with great precision.</p>


Finding a model car that fits your style is easy when you look for that diecast car at our model car web site.

We have a huge inventory of scale model cars, take time to look through our model car inventory to find the diecast cars you need today.</p>
<h2>Model Car</h2>


Simply put, a metal model car from our inventory is sure to meet your collectible standards, a model car with high detail.</p>
<h2>Scale Car Model</h2>


These Scle model Diecast cars, bikes, and other collectibles are fully detailed, from the undercarrige to the interior.</p>
<h2>Diecast cars</h2>


These Diecast cars range in scale from 1/18 to 1/43, from 1/8 to 1/12, and cover the full specrum of diecast cars for Formula 1 model cars and many others.</p>
</noscript>

2. If you use the Java Selector for States and Country try this:
------------------------------------------------------------------------
With this mod if a person disables java "and does not tell x-cart" this will now allow them to fill out the Address info Only Issue is the Payment method step wont submit becuase it uses a button rather than a <input type="submit'> or <a href="">... see #3 to fix this.


OK the Main Part of this Mod is to display a text box when the Users Javascript is disabled on their browser, they have not told x-cart they arent using java by clicking on the link and the Java Country State selector is enabled.
Currently it just shows an empty space for County and State.


Find skin1/main/register_states.tpl
Between these Lines of Code:
Code:
<TD nowrap><SPAN id="{$county_name}_value"></SPAN> {if $reg_error ne "" and $userinfo.$county_name eq "" && $default_fields.$county_name.required eq 'Y'}<FONT class="Star">&lt;&lt;</FONT>{/if}

Insert this line:
Code:
<noscript><INPUT type="text" id="{$county_name}" size="32" maxlength="65" name="{$county_name}" value="{$county}"></noscript>

Just below this,
Between these Lines of code:
Code:
<TD nowrap><SPAN id="{$state_name}_value"></SPAN> {if $reg_error ne "" and $userinfo.$state_name eq "" && $default_fields.$state_name.required eq 'Y'}<FONT class="Star">&lt;&lt;</FONT>{/if}

Insert This line:
Code:
<noscript><INPUT type="text" id="{$state_name}" size="32" maxlength="65" name="{$state_name}" value="{$state}"></noscript>




When I Disable the Java Country State Selector.
I want to disable the STATE Drop Down List because if I do not have their state then all they can select is OTHER.

Find skin1/main/states.tpl
Line:2
Replace:
Code:
{if $states ne ""}

With:
Code:
{if $states ne "" && $config.General.use_js_states eq 'Y'}

This disable the drop down list, When Java Selector is disabled and when their is states in the DBase.

Not Everyone will want this mod I know but those who do international and can't possible input every stat for every country OR dont want to.
----------------------------------------------------------------------


3. Now Last but not least, and unfortunately this is an easy to say hard to do thing and x-cart has to many areas that need this modification to list hear.
If you implement this concept correctly you can elliminate the need for a User to Click on the link that Tells x-cart Javacript is disabled.

In x-cart they built support for Disabled Javascript. In the .tpl files you will see If then else statement like this that are ment two switch between java and html elements.
Code:
{if js_enabled} javascript {else} html element{/if}

Thier may be other elements that dont use the $js_enabled variable to switch between support for java and no java.

All you do is replace:
Code:
{if js_enabled} javascript {else} html element{/if}
With "this is an example from the subscribe button in news.tpl"
Code:
<script type="text/javascript"> document.write('[img]{$ImagesDir}/newsletter.gif[/img]') </script> <noscript><input type="submit" value="Subscribe!"> </noscript>
__________________
\"Then again it could all be horse crap\"
by some old Guy.
4.013
Reply With Quote