Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

How to change the color of ADD TO CART button for certain products Rate Topic   - - - - -

 
  • jeffshead
  • Member
  • Members
  • Join Date: 15-May 08
  • 121 posts

Posted 27 July 2012 - 03:35 AM #1

I'm working on a mod that enables me to add a new field to certain products. I've gotten everything to work but now I can't figure out how to change the color of the 'ADD TO CART' button for those specific products.The only issue I have is the CSS.

I have used FireFox, Chrome etc. to try and figure out the exact CSS of the original button but I cannot get it right. My new button does not look correct. I copied all of the relevant CSS from the original and created a new sprite in a different color. I renamed all of the classes and pointed the background image attribute to my new sprite. It's using the new sprite but the ends are not properly aligned, the middle is too long and the hover effect does not work.

I want the button to look just like the original (active, hover etc.) only in a different color.

Is there maybe Ajax or JavaScript that's needed?

Here's what I have:

My button code:
<span class="AffButton-submit-big AffButton-wrap-left">
<span class="AffButton-submit-big AffButton-wrap-right">
<input type="button" value="Buy Now" onclick="window.open('{$product.aff_url}')" onmouseover="return overlib(caption1, WIDTH,750, HAUTO, VAUTO, FOLLOWMOUSE);" onmouseout="return nd();">
</span>
</span>

My CSS called from styles.post.tpl:
/* AffButtons */
.AffButton a, .AffButton-action a, .AffButton-big a, .AffButton-submit-action input, .AffButton-submit input, .AffButton-submit-big input {
border: 0 none;
background: none;
color: #fff;
text-decoration: none;
text-transform: uppercase;
text-shadow: 0px 1px 0px #900;
}
.AffButton-submit-action input, .AffButton-submit input {
margin-left: -5px;
padding: 1px 15px;
height: 28px;
outline: 0;
outline-width: 0;
outline-style: none;
background: none no-repeat left top;
line-height: 22px;
}
.AffButton-submit-action.b-click input, .AffButton-submit.b-click input, .AffButton-action.b-click a, .AffButton-submit-big.b-click input {
color: #e3d2d2;
}
.AffButton-submit-action input, .AffButton-submit input, x:-moz-any-link {
padding: 0 15px 2px;
}
.AffButton a, .AffButton-action a {
margin-left: -5px;
padding: 0 15px 3px 15px;
height: 27px;
line-height: 29px;
}
/* Input buttons */
.AffButton-submit-action.AffButton-wrap-left,
.AffButton-submit.AffButton-wrap-left,
.AffButton-action.AffButton-wrap-left,
.AffButton.AffButton-wrap-left,
.AffButton-submit-action.AffButton-wrap-right,
.AffButton-submit.AffButton-wrap-right,
.AffButton-action.AffButton-wrap-right,
.AffButton.AffButton-wrap-right,
.AffButton-submit-big.AffButton-wrap-left,
.AffButton-big.AffButton-wrap-left,
.AffButton-submit-big.AffButton-wrap-right,
.AffButton-big.AffButton-wrap-right {
height: 28px;
background: transparent url(../../images/AffButton_Sprite.png) no-repeat left top;
}
.AffButton-submit-action.AffButton-wrap-right,
.AffButton-submit.AffButton-wrap-right,
.AffButton-action.AffButton-wrap-right,
.AffButton.AffButton-wrap-right,
.AffButton-submit-big.AffButton-wrap-right,
.AffButton-big.AffButton-wrap-right {
display: inline-block;
margin-left: 5px;
background-position: right -90px;
}
.AffButton-action.AffButton-wrap-left,
.AffButton-submit-action.AffButton-wrap-left {
background-position: left -178px;
}
.AffButton-action.AffButton-wrap-right,
.AffButton-submit-action.AffButton-wrap-right {
background-position: right -268px;
}
.AffButton-submit.AffButton-wrap-left.AffB-hover,
.AffButton.AffButton-wrap-left.AffB-hover {
background-position: left -30px;
}
.AffButton-action.AffButton-wrap-left.AffB-hover,
.AffButton-submit-action.AffButton-wrap-left.AffB-hover {
background-position: left -208px;
}
.AffButton-submit.AffButton-wrap-left.b-click,
.AffButton.AffButton-wrap-left.b-click {
background-position: left -60px;
}
.AffButton-action.AffButton-wrap-left.b-click,
.AffButton-submit-action.AffButton-wrap-left.b-click {
background-position: left -238px;
}
.AffButton-submit.AffButton-wrap-left.AffB-hover .AffButton-wrap-right,
.AffButton.AffButton-wrap-left.AffB-hover .AffButton-wrap-right {
background-position: right -120px;
}
.AffButton-action.AffButton-wrap-left.AffB-hover .AffButton-wrap-right,
.AffButton-submit-action.AffButton-wrap-left.AffB-hover .AffButton-wrap-right {
background-position: right -298px;
}
.AffButton-submit.AffButton-wrap-left.b-click .AffButton-wrap-right,
.AffButton.AffButton-wrap-left.b-click .AffButton-wrap-right {
background-position: right -150px;
}
.AffButton-action.AffButton-wrap-left.b-click .AffButton-wrap-right,
.AffButton-submit-action.AffButton-wrap-left.b-click .AffButton-wrap-right {
background-position: right -328px;
}
.AffButton-submit-big.AffButton-wrap-left,
.AffButton-big.AffButton-wrap-left,
.AffButton-submit-big.AffButton-wrap-right,
.AffButton-big.AffButton-wrap-right {
height: 34px;
background-position: left -356px;
}
.AffButton-submit-big.AffButton-wrap-right,
.AffButton-big.AffButton-wrap-right {
background-position: right -476px;
}
.AffButton-submit-big.AffButton-wrap-left.AffB-hover,
.AffButton-big.AffButton-wrap-left.AffB-hover {
background-position: left -396px;
}
.AffButton-submit-big.AffButton-wrap-left.AffB-hover .AffButton-submit-big.AffButton-wrap-right,
.AffButton-big.AffButton-wrap-left.AffB-hover .AffButton-big.AffButton-wrap-right {
background-position: right -516px;
}
.AffButton-submit-big.AffButton-wrap-left.AffB-hover.b-click,
.AffButton-big.AffButton-wrap-left.AffB-hover.b-click {
background-position: left -436px;
}
.AffButton-submit-big.AffButton-wrap-left.AffB-hover.b-click .AffButton-submit-big.AffButton-wrap-right,
.AffButton-big.AffButton-wrap-left.AffB-hover.b-click .AffButton-big.AffButton-wrap-right {
background-position: right -556px;
}
.AffButton-submit-big input, .AffButton-big a {
margin-left: -5px;
background: none;
}
.AffButton-submit input, .AffButton input, .AffButton a, .AffButton.AffButton-wrap-right:hover a, .ui-widget-content .AffButton a {
color: #333;
text-shadow: 0px 1px 0px #f7f7f7;
}
.AffButton-submit.b-click input, .AffButton.b-click input, .AffButton.b-click .AffButton.AffButton-wrap-right a, .AffButton.AffButton-wrap-right.b-click a, .ui-widget-content.b-click .AffButton a {
color: #4d4d4d;
}
.AffButton-submit.AffButton-wrap-left.b-click input, .AffButton.AffButton-wrap-left.b-click input {
text-shadow: 0px 1px 0px #e5e5e5;
}
/* /Input buttons */

CS-Cart 4.6.3 SP1

 
  • jeffshead
  • Member
  • Members
  • Join Date: 15-May 08
  • 121 posts

Posted 27 July 2012 - 02:17 PM #2

I made three button images (normal, hover, active) and used CSS to create the desired look. Not what I wanted but it looks OK.
CS-Cart 4.6.3 SP1