Customizing Banner Ads in WebSphere Commerce

One of the cool features WebSphere Commerce added last year were banner ads that hover above the product image in category lists or search results. Here is an example banner ad for the IsNew attribute and how it currently shows on the product image:

Screen Shot 2015-12-16 at 10.06.34 PM

If you inspect the banner ad element you will see this in the inspector for the HTML div:

Screen Shot 2015-12-16 at 10.08.15 PM

Notice it has two classes associated with it. It applies the default value RibbonAdDefault and also automatically puts in another class with the same name as the attribute, in this case, IsNew. Since I just created this attribute it, is using the RibbonAdDefault class because I have not created an IsNew class.

The RibbonAdDefault css is the following:

.product_image .RibbonAdDefault {
 position:absolute;
 bottom:40px;
 left:0;
 width:110px;
 height:20px;
 background-color:#2C2C2C;
 background: -webkit-gradient(linear, left top, right top, color-stop(0.76, rgba(68, 68, 68, 1)), color-stop(1, rgba(255, 255, 255, 0)));
 background: linear-gradient(to right, rgba(68, 68, 68, 1) 76%, rgba(255, 255, 255, 0) 100%);
 -ms-filter: "progid:DXImageTransform.Microsoft.Gradient(gradientType=1, startColorStr='#FF444444', endColorStr='#00FFFFFF')";
 zoom: 1;
 font-size: 14px;
 line-height:20px;
 font-family: arial, Helvetica, sans-serif;
 color:#FFF;
 padding-left:10px;
 border-radius:3px;
 text-align:left;
 vertical-align:baseline;
 overflow:visible;
 white-space: nowrap;
}

What we are going to do is override this with our new CSS specifying the IsNew attribute. We are also going to change the position and have it be an image with no text. Here is the new CSS for the IsNew attribute:

.product_image .IsNew {
 position:absolute;
 display: block;
 top:10px;
 left:0;
 width:60px;
 height:60px;
 background-color:#2C2C2C;
 background: url("../images/new-icon.png") no-repeat;
 zoom: 1;
 font-size: 0px;
 line-height:20px;
 font-family: arial, Helvetica, sans-serif;
 color:#FFF;
 padding-left:10px;
 border-radius:3px;
 text-align:left;
 vertical-align:baseline;
 overflow:visible;
 white-space: nowrap;
}

This gives us an end results with the follow image:

Screen Shot 2015-12-16 at 10.18.18 PM

Notice since I made the font-size zero pixels. This is essentially making it so there is no text and it ends up just being the image.

Watch the video below to see me implement this:

One thought on “Customizing Banner Ads in WebSphere Commerce

  1. Pingback: Thank you for a great 2015 and Happy New Year! | Bob's Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s