Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Disabled Javascript Support

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #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
  #2  
Old 07-29-2005, 03:57 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

Does this supercede your other post on JS or is it in addition to....?
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 07-29-2005, 04:00 PM
 
Tuner Tuner is offline
 

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

Default

If you want I can copy and past it hear in place of the link I used but it is in addition.

Thanks For asking!!!
Scott
__________________
\"Then again it could all be horse crap\"
by some old Guy.
4.013
Reply With Quote
  #4  
Old 07-29-2005, 04:00 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

That would be great....less confusing
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #5  
Old 07-29-2005, 04:16 PM
 
Tuner Tuner is offline
 

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

Default

Done I will work on making this be more organized but its hard I did my best I hope people understand what I am trying to do.

I wounder Has anyone esle delt with these issues??
__________________
\"Then again it could all be horse crap\"
by some old Guy.
4.013
Reply With Quote
  #6  
Old 01-26-2006, 07:00 PM
 
youngvet1 youngvet1 is offline
 

eXpert
  
Join Date: Aug 2005
Posts: 245
 

Default

do other major ecommerce sites assume java script??


As of right now if someone does not have java script enabled they would not be able to order with x-cart?
__________________
x-cart version 4.0.14
Reply With Quote
  #7  
Old 01-26-2006, 07:23 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

If someone has JavaScript turned off in their browser (most people DO NOT know how to do this) they are going to have issues on all sorts of sites.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #8  
Old 01-27-2006, 08:12 AM
 
magnumkp magnumkp is offline
 

eXpert
  
Join Date: Apr 2003
Location: England
Posts: 304
 

Default

Users with javascript disabled is currently at about 10%.
__________________
Version 3.4.8
Reply With Quote
  #9  
Old 03-22-2006, 05:22 AM
  JWait's Avatar 
JWait JWait is offline
 

X-Man
  
Join Date: Nov 2005
Location: California
Posts: 2,440
 

Default

Is there a simple way to check if the customer has Javascript disabled and display a notice informing them that it should be enabled? Something like "Javascript needs to be enabled in your web browser for proper operation of your shopping cart".
__________________
Two Separate X-Cart Stores
Version 4.4.4 Gold - X-AOM - Vivid Dreams Aquamarine (modified) - Linux
Mods - Newest Products - View All -, and a few others. Numerous upgrades from 4.0.x series.
Integrated with Stone Edge Order Manager + POS

Version 4.1.12 Gold (fresh install) - X-AOM - Linux
Mods - XCSEO free
Reply With Quote
  #10  
Old 03-26-2006, 06:28 PM
  rubyaryat's Avatar 
rubyaryat rubyaryat is offline
 

eXpert
  
Join Date: Feb 2003
Location: Canada
Posts: 289
 

Default

You can set up a simple detection script by adding the following code to your customer/home.tpl template, within the <head> tag:
Code:
<noscript> {if $smarty.get.pageid ne "1"} <meta http-equiv="refresh" content="0;URL={$http_location}/pages.php?pageid=1"> {/if} </noscript>

In this example I created a static page with pageid=1 that contains info about enabling javascript. Note that in the above code I test to make sure that the current page isn't the redirect destination page by checking the "pageid" get variable before including the meta refresh. Otherwise else you'll end up in an infinate refresh loop.

You can see this script in action by browsing to my home page with javascript disabled in your browser.

Tested on IE6, Firefox 1.5 and Opera 8.02 on the PC.

Rubyaryat
__________________
Rubymods.com - Your X-Cart services partner for over 9 years.
Modules offered: FedEx labels, Live currency rates, GeoIP, Order Audit, Multiple e-goods.
X-Cart Store Hosting, project management and affiliates program available.
4.2.3 gold [Unix]
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 02:34 PM.

   

 
X-Cart forums © 2001-2020