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:

Advertisements

CoreMedia Part IV – Scheduling our promotion banner

We continue our video series for the CoreMedia integration with WebSphere Commerce. In this video I show how you can place the previously created Kids Promotion Banner on our home page and then schedule it to show during the month of December.

You can learn more about CoreMedia and their LiveContext for IBM WebSphere Commerce at their site, click here.

Creating a banner with CoreMedia Content Management System

In this next video in the series, I show how easy it is to create a banner using CoreMedia. CoreMedia allows you to define the proper cropping for the different aspect ratios the banner could be displayed in. I also show how easy it is to create a text overlay and link it to our kids micro site.

You can learn more about CoreMedia and their LiveContext for IBM WebSphere Commerce at their site, click here.