Forums / Templates, Stylesheets, Page Layout / Manufacturers Sidebox change option selected

Manufacturers Sidebox change option selected

Locked

Views: 1,806

Results 1 to 8 of 8
This thread is locked. New replies are disabled.
25 Apr 2009, 4:52 PM
#1
and_or avatar

and_or

New Zenner

Join Date:
Apr 2009
Location:
Netherlands
Posts:
9
Plugin Contributions:
0

Manufacturers Sidebox change option selected

I have spent hours trying to find a way to change the default color (blue) of the selected option in the sidebox Manufacturers.

The template I am working on is all Black/grey/white and the only disturbing element is the blue color of the first item in the manufacturers form...

Does anyone know how to fix this, either in css or point me to the php I need to edit..

Example:

Your tip could make my day !!!

Henk

26 Apr 2009, 3:02 PM
#2
tony_sar avatar

tony_sar

Totally Zenned

Join Date:
Jul 2006
Location:
Montreal, Canada
Posts:
2,276
Plugin Contributions:
0

Re: Manufacturers Sidebox change option selected

this is possible with the use of javascript and CSS.. so here .. to do that , you need to modify html_output.php located in Includes / functions folder .

at line 503 change
$field .= ' selected="selected"';
to
//$field .= ' selected="selected"';

and right under this add this javascript

$field.= "onload='document.manufacturers_form.manufacturers_id.selectedIndex = -1'";
so will look like this
//$field .= ' selected="selected"';
$field.= "onload='document.manufacturers_form.manufacturers_id.selectedIndex = -1'";
save and upload.
now add this to your stylesheet.css

option.hover, option:hover
{
background-color:#CC0000;
color:#000000;
}

change the background-color , to any color you want . umm as long as is not blue :P

26 Apr 2009, 3:39 PM
#3
and_or avatar

and_or

New Zenner

Join Date:
Apr 2009
Location:
Netherlands
Posts:
9
Plugin Contributions:
0

Re: Manufacturers Sidebox change option selected

Thanx.. that works, would never have found that on my own:D

Now the blue only appears when the option is clicked, so to satisfy the perfectionist... Any chance you know also how to change that?

I tried option:focus and option:active, but that doesn't do the trick

26 Apr 2009, 4:08 PM
#4
tony_sar avatar

tony_sar

Totally Zenned

Join Date:
Jul 2006
Location:
Montreal, Canada
Posts:
2,276
Plugin Contributions:
0

Re: Manufacturers Sidebox change option selected

i believe that needs to be done using javascript . I don't think there are any css class that can work with onclick event ..

26 Apr 2009, 4:16 PM
#5
and_or avatar

and_or

New Zenner

Join Date:
Apr 2009
Location:
Netherlands
Posts:
9
Plugin Contributions:
0

Re: Manufacturers Sidebox change option selected

since the :hover did not result in the right color I added the style to the code in html_output.php

$field.= "onload='document.manufacturers_form.manufacturers_id.selectedIndex = -1'" . 'style="background-color:#DDDFD9"';

disadvantage is off course that its not the "right" way with overrides etc, but the grey I have changed it to now is less likely to interfere with other designs than the default blue...

26 Apr 2009, 4:49 PM
#6
and_or avatar

and_or

New Zenner

Join Date:
Apr 2009
Location:
Netherlands
Posts:
9
Plugin Contributions:
0

Re: Manufacturers Sidebox change option selected

Thanks again Tony, I think you are right about the onclick and css.
I am not very good a php (nor javascript) I can read it but writing is another thing. Could I add the onclick to the same line in html_output.php?
Or is that too simple?

26 Apr 2009, 7:00 PM
#7
tony_sar avatar

tony_sar

Totally Zenned

Join Date:
Jul 2006
Location:
Montreal, Canada
Posts:
2,276
Plugin Contributions:
0

Re: Manufacturers Sidebox change option selected

i think would be better to replace onload with onclick event , and move the onload event to head section of your site .

26 Apr 2009, 7:14 PM
#8
and_or avatar

and_or

New Zenner

Join Date:
Apr 2009
Location:
Netherlands
Posts:
9
Plugin Contributions:
0

Re: Manufacturers Sidebox change option selected

Unfortunately I had to revert to the original code. It turns out that a side effect of the suggested change by Tony is that in a product page, where the option colors is available, selecting a color would result in the color before that.

Red
Blue
Black
Clicking on "blue" would result in "Red" , so alas, this solution will not work.