Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Case by case CSS button override. Possible?

Case by case CSS button override. Possible?

Views: 1,293

Results 1 to 5 of 5
2 Aug 2011, 3:46 AM
#1
runlikeagirl avatar

runlikeagirl

New Zenner

Join Date:
Jun 2011
Posts:
14
Plugin Contributions:
0

Case by case CSS button override. Possible?

Hello all,

I am using Zen Cart 1.3.9h.
I enabled CSS buttons but for some particular cases I would prefer to have an image button.

For example the "Send Gift Certificate" button is way to big for that small sidebox. So for that case, and maybe for some other buttons in the future, I would prefer to use an image.

I modified the CSS code and it worked but I would like to know if there is a cleaner solution.

Thanks

2 Aug 2011, 12:44 PM
#2
rstevenson avatar

rstevenson

Totally Zenned

Join Date:
Nov 2006
Location:
Dartmouth, NS Canada
Posts:
2,400
Plugin Contributions:
0

Re: Case by case CSS button override. Possible?

There is a CSS Buttons contribution which, IIRC, adds some functionality to the stock ZC's css buttons. In that contribution you can use image buttons mixed in with css buttons. I'm not sure if this will work with the stock css buttons, but here's their instructions for how to do it...

To over ride a single CSS button by an image button:

Copy the image button (from template_default, or created yourself) to:

includes/YOUR_TEMPLATE/buttons/english/

For example copy:
includes/template_default/buttons/english/button_update_cart.gif
to:
includes/YOUR_TEMPLATE/buttons/english/button_update_cart.gif

Rob

2 Aug 2011, 11:50 PM
#3
runlikeagirl avatar

runlikeagirl

New Zenner

Join Date:
Jun 2011
Posts:
14
Plugin Contributions:
0

Re: Case by case CSS button override. Possible?

thanks Rob,

Where did you get that quote from? Is it in the doc for the CSS Buttons contrib ?

It looks like the CSS Contrib was developed for an earlier version of Zen Cart, and I was hoping that that maybe they did include it in 1.3.9h

Anyway, I just tried it in 1.3.9h (without the contrib) and it did not work. I copied the button in the
includes/MY_TEMPLATE/button/English folder and it didn't do diddly. :no:

Anybody out there who implemented such a feature?

3 Aug 2011, 1:34 AM
#4
rstevenson avatar

rstevenson

Totally Zenned

Join Date:
Nov 2006
Location:
Dartmouth, NS Canada
Posts:
2,400
Plugin Contributions:
0

Re: Case by case CSS button override. Possible?

Yes, that was from the contrib's readme file. I suppose I'm not surprised that that trick didn't work without the contrib being installed.

I just reviewed the CSS Buttons contrib support thread. It got hijacked by someone who was enthusiastically doing something else, so I couldn't follow it very well at all. But it looks like Paul Mathot, the person who modified the CSS Buttons contrib to bring it up to 1.3.8a level, is no longer working on it. A few questions asking if anyone had tried it on 1.3.9 were not answered yet.

Rob

3 Aug 2011, 1:34 AM
#5
runlikeagirl avatar

runlikeagirl

New Zenner

Join Date:
Jun 2011
Posts:
14
Plugin Contributions:
0

Re: Case by case CSS button override. Possible?

Didn't install the CSS button add-on. Maybe later. In the mean time to make things work I just added a quick fix to html_output (line 295 or so)

I changed:

if (strtolower(IMAGE_USE_CSS_BUTTONS) == 'yes') 
	return zenCssButton($image, $alt, 'button', $sec_class, $parameters = '');

to

    
if (strtolower(IMAGE_USE_CSS_BUTTONS) == 'yes') 
    if ( !file_exists(DIR_WS_TEMPLATE . 'buttons/' . $_SESSION['language'] . '/' . $image) )		
          return zenCssButton($image, $alt, 'button', $sec_class, $parameters = '');

Now, just drop the image file of the specific button you would like to override in the includes/YOUR_TEMPLATE/buttons/english folder and you will have an image button instead of a CSS button.