| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Use Javascript and CSS to hid / flip visibilty of elements | ||||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Use Javascript and CSS to hid / flip visibilty of elements
I use this trick on a few different places on my site. It came about after using some less computer savvy people here at work to try to use the site. Mostly to hide parts of a form that a user doesn't need to see unless some criteria is met. Helps so they don't get confused as we know most users don't read.
Examples. Gift Certificate page http://www.aerostich.com/giftcert.php The registration / checkout pages (shipping address is hidden) https://www.aerostich.com/register.php All we are doing is making a block of html code visible or hiding it. I'll go through the process for the gift certificate page. Step 1 This javascript function should be either in your javascript page or in the head or somewhere on the page. Code:
Step 2 skin1/modules/Gift_Certificates/giftcert.tpl Starting at about line 188 Code:
In the above code you will notice a few things that are essential to making it work. 1. The table tag containing the differnt deliver fields are as follows: The email table tag Code:
Code:
Send Via Email radio button Code:
Code:
That's it, you can use it to hid several things on a page and make them appear. Have fun!
__________________
No longer using Xcart, was good while it lasted. |
|||||||
|
#2
|
|||||||||
|
|||||||||
nicely done
__________________
Looking for a reliable X-cart host ? You wont go wrong with either of these. EWD Hosting Hands On Hosting |
|||||||||
#3
|
|||||||
|
|||||||
This is great. I really appreciate this mod. Looks good and very user friendly.
Will you be posting the code for the registration / checkout pages (shipping address is hidden)? Unfortunately when I comes to java I am a complete novice. Thanks
__________________
CopperB XCart Gold -> v4.0.11 PHP -> v4.3.10 MySQL -> v4.0.22 Apache -> v1.3.33 Smarty -> v2.6.3 |
|||||||
#4
|
|||||||
|
|||||||
Quote:
CopperB, I've modded my skin1/customer/main/register.tpl a bit. Here is what I have. Code:
That's it, along with the essential javascript flipdiv function you can do that to most any block type HTML tags. I would give more advice, but like I said, I have changed the layout of my register forms which changes the HTML from the default install. Also, just an FYI, it's JavaScript. It's completely different from Java, why it was named JavaScript is beyond me, but it is not Java at all. I think when it first came out it was called Livescript by Netscape but someone changed it to JavaScript to jump on the then Java Band Wagon.
__________________
No longer using Xcart, was good while it lasted. |
|||||||
#5
|
|||||||
|
|||||||
Once again great mod. I have the register working just fine but am having some trouble with the Gift Certificate page.
If the customer chooses send via Email the form cannot be sent because the code is looking for the required fields of the postal address. Any ideas? I haven't changed the code you posted for the giftcert template at all. Thanks
__________________
CopperB XCart Gold -> v4.0.11 PHP -> v4.3.10 MySQL -> v4.0.22 Apache -> v1.3.33 Smarty -> v2.6.3 |
|||||||
#6
|
|||||||
|
|||||||
Quote:
If customers are selecting "Send via Email" and they are getting prompted to fill in the postal info, then you have some problems with the code you altered. We are not changing the logic, just the display of those fields. Post your code and maybe we can give you a hand.
__________________
No longer using Xcart, was good while it lasted. |
|||||||
#7
|
|||||||
|
|||||||
Sorry I should have been more clear. They are not getting prompted for Postal info. I tested it out and found that even though Email was selected it wouldn't send without the Postal info included.
Here is my giftcert code. Code:
Here is a link to the page: http://www.copperboppers.com/xcart/giftcert.php Thanks for the help.
__________________
CopperB XCart Gold -> v4.0.11 PHP -> v4.3.10 MySQL -> v4.0.22 Apache -> v1.3.33 Smarty -> v2.6.3 |
|||||||
#8
|
|||||||
|
|||||||
Is it possible to have the "No" selected if the shipping address is already filled in once the customer is registered?
__________________
Core version: 5.3.2.7 PHP: 5.6.29 MySQL server: 5.5.5-10.0.27-MariaDB-cll-lve (InnoDB engine support enabled) Web server: Apache Operating system: Linux XML parser: found GDLib: found (0) Translation driver: Database Curl version: 7.29.0 |
|||||||
#9
|
|||||||
|
|||||||
Bump...
Any idea why when Email is selected it won't send without the Postal info included. I have posted my Giftcert code above. Thanks
__________________
CopperB XCart Gold -> v4.0.11 PHP -> v4.3.10 MySQL -> v4.0.22 Apache -> v1.3.33 Smarty -> v2.6.3 |
|||||||
#10
|
|||||||
|
|||||||
Sorry, CopperB, I took a brief look at your code and didn't see anything glaringly wrong. Maybe start over and implement very small changes until you see what is breaking it.
__________________
No longer using Xcart, was good while it lasted. |
|||||||
|
|||
X-Cart forums © 2001-2020
|