If this is your first visit, check our documentation. To post, register or login.

CSS buttons v2.x

Started by paulm on 19 Sep 2006, 7:55 PM · Views: 41,343

Results 121 to 140 of 159
30 Mar 2010, 6:24 PM
#121
chadderuski avatar

chadderuski

Totally Zenned

Join Date:
Apr 2006
Location:
Dark Side of the Moon
Posts:
986
Plugin Contributions:
0

Post #121 by chadderuski

Hi Paul!

Remember way back when I was working on getting 3-state CSS rollover buttons to work (sliding door method)?
Well, I seem to have them working now.

Pardon the current "mess" of this site. Still working on the graphical layout, and other pages still need refining, but you may find the buttons interesting!

http://ubuysupply.com/zentest/

Some minor modifications to core code were needed, but seems to be working correctly. I used Steed's button generator to make the buttons then "merged" them for the 3-state effect.

-chadderuski

30 Mar 2010, 8:37 PM
#122
sawhorse avatar

sawhorse

Zen Follower

Join Date:
Oct 2007
Location:
Kentucky - USA
Posts:
425
Plugin Contributions:
0

Post #122 by sawhorse

Great looking buttons.

I understand that you used http://www.zen-cart.com/index.php?main_page=product_contrib_info&cPath=40_44&products_id=743 to generate your buttons. But, it would be nice to let us know how you > "merged" them for the 3-state effect. and what > minor modifications to core code were necessary to get this great effect.

Sawhorse

ZC 1.3.8a; Addons: Admin Profiles, Ty Package Tracker; Swap Images via MouseOver or Click, Smart Backgrounds; Printable Price List; CSS buttons; Contact Us - Add Subject; Template: Self Constructed; Site: http://sawhorsejewelry.com

31 Mar 2010, 12:14 AM
#123
chadderuski avatar

chadderuski

Totally Zenned

Join Date:
Apr 2006
Location:
Dark Side of the Moon
Posts:
986
Plugin Contributions:
0

Post #123 by chadderuski

Hi Sawhorse,

This is my first test using this method, and shows what the button looks like unwindowed.

http://chicagophoto.net/btest/

The main core change was to /includes/functions/html_output.php

/**
 * generate CSS buttons in the current language
 * revised code and concepts by Chadderuski and Sir John Steed
 * Allows full control of all link and form buttons through CSS stylesheet.
 * This revised function replaces the standard zenCssButton() above.
**/
function zenCssButton($image = '', $text, $type, $sec_class , $parameters ) {
   if (strrpos($image, '.') !== false) $sec_class = substr($image, 0, strrpos($image, '.'));
   if (!empty($parameters)) $parameters = ' ' . $parameters;

   // form input button
   if ($type == 'submit'){
      //$css_button = '<input class="cssButton ' . $sec_class . '" ' . ' type="submit" value="' . '"' . $parameters . ' />';
       // $css_button = '<input class="cssButton ' . $sec_class . '" ' . ' type="submit" value="' .$text . '"' . $parameters . ' />';
     $css_button = '<button class="cssButton ' . $sec_class . '" ' . ' type="submit" ' . $parameters . ' >' .$text . '</button>';
   }
   // link button
   if ($type=='button'){
      $css_button = '<div class="cssButton ' . $sec_class . '"' . $parameters . '>'. $text . '</div>';
   }
   return $css_button;
}

I may have made changes to zen_image_submit() also ... will have to look at clean code.

placement of the css buttons is not always "right" out of the box, so you may have to modify those pages to get the look you want. Mostly, I've found I've had to use some relative positioning to get them where I want them.

Note that I haven't necessarily honored zencarts css/picture button switches here... a lot of testing and experimentation went into this... but so far working.

I also used the sliding door method on the horizontal navigation. This did require adding a <span></span> in the menu generation code under /includes/classes/categories_ul_generator.php. Those tabs use two images for left/right sides of the button so you can +/- the page and not break them.

Of course, inspiration for this is from Paul's CSS Horizontal Dynamic Menu and this great tutorial:

http://www.alistapart.com/articles/slidingdoors/

I'm sure a more knowledgeable CSS pro could really clean this up. My drop menu's CSS is a bit garish, but works! You can link those direct and see what I did. I sort of hacked away at it until I got it to do what I wanted. But I'm certain there is a cleaner way more elegant way! And there aren't any IE hacks in here to fix IE's bugs (so far they are working though).

-Chadderuski

31 Mar 2010, 1:10 AM
#124
sawhorse avatar

sawhorse

Zen Follower

Join Date:
Oct 2007
Location:
Kentucky - USA
Posts:
425
Plugin Contributions:
0

Post #124 by sawhorse

Thank you for providing all this information. I think that some may be able to duplicate your work. And if you find that you did make > changes to zen_image_submit() please let us know.

Since I am not a programmer I know full well the "hacked away" method of programing. That is my most used method. It takes lots of time but when you have a product functioning as you would like, it just make my day!!!

I an currently using CSS buttons and I also have "adjusted" size and location. My worry (and I bet others) is that if I start with additional modification, it may take me awhile. I need to think about that concern. The buttons I have now work very well (not as nice as yours) but are very functional.

Again, nice work.

Sawhorse

ZC 1.3.8a; Addons: Admin Profiles, Ty Package Tracker; Swap Images via MouseOver or Click, Smart Backgrounds; Printable Price List; CSS buttons; Contact Us - Add Subject; Template: Self Constructed; Site: http://sawhorsejewelry.com

31 Mar 2010, 7:08 PM
#125
chadderuski avatar

chadderuski

Totally Zenned

Join Date:
Apr 2006
Location:
Dark Side of the Moon
Posts:
986
Plugin Contributions:
0

Post #125 by chadderuski

Hi Sawhorse,

The changes I made are mostly in the template files which you should be using and not editing the default. I thinks I had to adjust one of the side boxes, the header (ofcourse!) and also the product detail pages (which I have yet to complete). I have been using these as a "two state" button on the company site for a solid year, but now that I have a new project I decided to finish them and get them polished.

I forgot to mention how to merge the images. After you make each state, I stack these together in photoshop and then export them as a single image. Then you need to work up the css for each button. Because they are all different lenghts, you need an entry for each:

/* only include this once */
body {behavior:url(includes/csshover.htc);}

/* General Button Styling Definitions */
.cssButton {
	border:0px; padding:0px; margin:0px;
	height:22px;
	text-indent:-500em;
	background-position:0 0; 
	display:block;
	overflow:hidden;
	}

/* Primary Class :hover and :active states */
.cssButton:hover { background-position:0 -22px}
.cssButton:active { background-position:0 -44px}

/* standard buttons */
.button_add_address {width:113px; background:url(../buttons/english/button_add_address.gif)}
.button_add_to_cart {width:123px; background:url(../buttons/english/button_add_to_cart.gif)}
.button_back {	width:61px; background:url(../buttons/english/button_back.gif)}

This method does require the csshover.htc class. And you have to specify the width of each button and the background image to use.

Glad you like them!

31 Mar 2010, 10:22 PM
#126
sawhorse avatar

sawhorse

Zen Follower

Join Date:
Oct 2007
Location:
Kentucky - USA
Posts:
425
Plugin Contributions:
0

Post #126 by sawhorse

Thanks for the added info.

Sawhorse

ZC 1.3.8a; Addons: Admin Profiles, Ty Package Tracker; Swap Images via MouseOver or Click, Smart Backgrounds; Printable Price List; CSS buttons; Contact Us - Add Subject; Template: Self Constructed; Site: http://sawhorsejewelry.com

6 May 2010, 5:03 AM
#127
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,880
Plugin Contributions:
7

Post #127 by torvista

In /includes/extra_functions/css_buttons.php
line 13 has

  if(CSS_BUTTONS_FROM_ADMIN === true){

Where is this constant CSS_BUTTONS_FROM_ADMIN set?

thanks
Steve

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

19 May 2010, 2:48 AM
#128
kernheimer avatar

kernheimer

Zen Follower

Join Date:
Jul 2009
Posts:
126
Plugin Contributions:
0

Post #128 by kernheimer

I was wondering if anybody has used this on the new 1.3.9 jet?? i would love to input it, but am affraid to, since it say's 1.3.5 :no:

26 May 2010, 2:00 AM
#129
australican avatar

australican

Zen Follower

Join Date:
Jan 2009
Location:
Victoria Australia
Posts:
100
Plugin Contributions:
0

Post #129 by australican

Hi all, has anyone got the css sprite/sliding door method to work on all the buttons. I've managed it for the link buttons, but having great difficulty getting it to work with the form buttons.
I hacked away at css_buttons.php and made some progress, but it makes a mess of things.

I basically need to add a class to the button element.

You can see my mess here

http://countrytothecore.net

On the product info pages, you'll see where its working on the prev/next navigation area and the shopping cart button. The tell a friend will show the worse of my efforts and if you hover over the add to cart, you'll see how it falls apart.

I can see that some people have addressed the issue for main navigation menus, and if the answer is in there somewhere, as a newbie, I can't see it. As in, I just don't get it yet.
Any help would be much appreciated.
David

26 May 2010, 8:35 AM
#130
australican avatar

australican

Zen Follower

Join Date:
Jan 2009
Location:
Victoria Australia
Posts:
100
Plugin Contributions:
0

Post #130 by australican

Hi again, I've got this to work for the most part. (Although the buttons still need some alignment.)
In my css_buttons.php file, I made this change...

 // replaced <input />s by <button></button>s
    //$css_button = '<input' . $class . ' type="submit" value="' .$text . '"' . $parameters . ' />';
    $css_button = '<a class="button">' . '<button' . $class . ' type="submit" value="' .$text . '"' . $parameters . '>' . $text . '</button>' . '</a>';
  }

This works with some extra css but shows quite a few errors when trying validate, aside from the fact that it's not a very kosher way of doing things.

I'd appreciate it if anyone had any better ideas.

Also when mousing over the long image in my two image sliding door, the whole button changes to the correct slice of the sprite, but when mousing over the smaller portion, only the smaller portion changes. Any ideas?

Thanks,
David

26 May 2010, 1:27 PM
#131
chadderuski avatar

chadderuski

Totally Zenned

Join Date:
Apr 2006
Location:
Dark Side of the Moon
Posts:
986
Plugin Contributions:
0

Post #131 by chadderuski

australican:

Hi again, I've got this to work for the most part. (Although the buttons still need some alignment.)
In my css_buttons.php file, I made this change...

Australican:

I do not want to hijack Paul's support thread! Sorry Paul!

But I have fully functional 2 and 3 state CSS buttons using the sliding door method as mentioned above. Also working here:
http://www.royalindustriesinc.com

I did this with a minimal amount of core changes - actually just one function replacement if I remember correctly, and a couple edits.
The real work was in the button creation and css markup. I can send you my sample buttons, css files, and <few> core mods.

Send me a PM...
-chadderuski

23 Feb 2011, 2:41 PM
#132
athena avatar

athena

Totally Zenned

Join Date:
Jan 2006
Location:
NM
Posts:
740
Plugin Contributions:
0

Post #132 by athena

Hope someone is monitoring this thread..I have an ongoing issue that I hoped css_buttons_v2.64 would solve:

This in both zencart 1.3.8 and 1.3.9h

First, my goal is use my custom image buttons with easy_rollovers, but that mod does not allow the form buttons to be replaced with my image buttons or to roll.

css_buttons_v2.64 does allow the replacement of the form buttons with my custom image buttons, but not implement the roll effect.

So, i re-installed easy_rollovers and am back to the original problem of form or input buttons not rolling however they are being replaced with my custom image buttons properly thanks to css_buttons_v2.64

My dilemma:

1.I either need to learn how to get image buttons to roll in css_buttons_v2.64 or
2. or figure out how to modify the css_buttons_style to have those input image buttons unaffected by easy_rollovers to use my rollover function as happens with the other buttons. I have two button images for each button as required by easy_rolloevers.

This is demonstrated on this page: GeoOdyssey Publications - Sitemap

Notice the "search" button vs the back "button."

Thank you for any help.

23 Feb 2011, 3:19 PM
#133
athena avatar

athena

Totally Zenned

Join Date:
Jan 2006
Location:
NM
Posts:
740
Plugin Contributions:
0

Post #133 by athena

I just uploaded some test products and the hover effect goes crazy on the images....suggestions, please...thank you.

23 Feb 2011, 3:26 PM
#134
athena avatar

athena

Totally Zenned

Join Date:
Jan 2006
Location:
NM
Posts:
740
Plugin Contributions:
0

Post #134 by athena

I also lost my image buttons when i uninstalled and ran again the sql file.

I think the first time i ran it it did not take...but now my images are gone!

23 Feb 2011, 3:39 PM
#135
athena avatar

athena

Totally Zenned

Join Date:
Jan 2006
Location:
NM
Posts:
740
Plugin Contributions:
0

Post #135 by athena

ok...turned that to true in admin...there is the admin/config/css thingy

ther are my buttons....now to get them to hover or toggle between the two images.....suggestions?

24 Feb 2011, 3:23 AM
#136
sawhorse avatar

sawhorse

Zen Follower

Join Date:
Oct 2007
Location:
Kentucky - USA
Posts:
425
Plugin Contributions:
0

Post #136 by sawhorse

athena:

ok...turned that to true in admin...there is the admin/config/css thingy

ther are my buttons....now to get them to hover or toggle between the two images.....suggestions?

It looks like you have done it. Congratulations.

ZC 1.3.8a; Addons: Admin Profiles, Ty Package Tracker; Swap Images via MouseOver or Click, Smart Backgrounds; Printable Price List; CSS buttons; Contact Us - Add Subject; Template: Self Constructed; Site: http://sawhorsejewelry.com

24 Feb 2011, 4:44 PM
#137
athena avatar

athena

Totally Zenned

Join Date:
Jan 2006
Location:
NM
Posts:
740
Plugin Contributions:
0

Post #137 by athena

Thanks sawhorse....actually, i went back to the stock stylesheet_css_button.css and am using a background image with a bit of java that rounds corners using width:auto ....works great, (called curvycorners)

however, looks great in Firefox...it is all over the place in IE

I used a suggestion in another thread to add a style to the input image in functions/html_output.php

IE ignors this completely and only styles my buttons background on the non-submit links.

currently working to get ie to see my styles.

page seems to validate just fine.

24 Feb 2011, 5:27 PM
#138
sawhorse avatar

sawhorse

Zen Follower

Join Date:
Oct 2007
Location:
Kentucky - USA
Posts:
425
Plugin Contributions:
0

Post #138 by sawhorse

athena:

IE ignors this completely and only styles my buttons background on the non-submit links.

Yes, when I looked at your page in FF it was fine, but when I looked at it in IE I got the following warning.

Sorry I can not help. I am a hunt, peck and hope programmer.

Best of luck.

Sawhorse

ZC 1.3.8a; Addons: Admin Profiles, Ty Package Tracker; Swap Images via MouseOver or Click, Smart Backgrounds; Printable Price List; CSS buttons; Contact Us - Add Subject; Template: Self Constructed; Site: http://sawhorsejewelry.com

25 Feb 2011, 5:07 PM
#139
athena avatar

athena

Totally Zenned

Join Date:
Jan 2006
Location:
NM
Posts:
740
Plugin Contributions:
0

Post #139 by athena

just to report back, still working with the stock style sheet...did find a mod for IE problems that works when I start with zeroing out everything by setting global variables to none or zero. I think a lot of newzenners get distracted with the input button not obeying styles and i think the answers they get assume that the stock buttons styles sheet does not fulfill their needs. Not sure why the input button needs another class attached in html_output.php, but that is all that worked for me.

after a weeks adventure in button land....whew! I guess the zenteam did it right with just leaning how to work the style sheet for individual buttons styling and using background images for the roll over.

"chadderuski's" post above to his site was very helpful in getting my style sheet back under control.

Gotta love zencart....never knew I could be so tenacious about anything.

25 Feb 2011, 5:39 PM
#140
sawhorse avatar

sawhorse

Zen Follower

Join Date:
Oct 2007
Location:
Kentucky - USA
Posts:
425
Plugin Contributions:
0

Post #140 by sawhorse

chadderuski:

But I have fully functional 2 and 3 state CSS buttons using the sliding door method as mentioned above. Also working here:
http://www.royalindustriesinc.com

I did this with a minimal amount of core changes - actually just one function replacement if I remember correctly, and a couple edits.
The real work was in the button creation and css markup. I can send you my sample buttons, css files, and <few> core mods.
athena:

"chadderuski's" post above to his site was very helpful in getting my style sheet back under control.

Could either chadderuski or yourself share your process etc.?

Sawhorse.

ZC 1.3.8a; Addons: Admin Profiles, Ty Package Tracker; Swap Images via MouseOver or Click, Smart Backgrounds; Printable Price List; CSS buttons; Contact Us - Add Subject; Template: Self Constructed; Site: http://sawhorsejewelry.com