Ecommerce Badges
Ecommerce badges are a subtle way to notify the customer that a product is part of a campaign. This helps the customer spot products which are New, On Sale, or part of a custom campaign. This guide will show you how to setup Ecommerce badges and how to create custom badges. You can also use it to check if your current setup is configured correctly.
Badges are available on the following columns:
- Product list - grid view
- Product list - list view
- Product list – compact view
- Product details media gallery
- Product details media
- Product details info
- Product slider/grid view
- Related products list
Badges are also available when working with Product Components.
Manual Setup
After setting up Ecommerce Badges or when creating new ones, you always need to preview the Badge page in frontend. Otherwise, the badges will not load properly as the CSS changes will not be saved. This is especially important after a deployment to a Staging site or a Live site.
- Go to Swift tools -> Design -> Ecommerce badges
- Click on Show page to view the Badges page in frontend
- Do a hard refresh (Ctrl + F5 or Cmd + Shift + R)
This feature is based on a product field called Campaign. In the product field you can choose what campaign the individual products are related to. If the product field has already been configured, you should be able to locate it in either PIM or Ecommerce in the settings of each product. Here you will see a list of campaigns with checkboxes next to them.
If the product field hasn’t been configured yet, you will have to enter Settings to set it up:
- In Settings go to Ecommerce -> Product catalogue -> Product fields
- Create a New field and fill out the information needed
- Let Name, System name and Template tag be “Campaign”
- Choose “List box” as the Field Type
- Make sure Display as is set to “CheckBoxList”
This is all the configuration that is needed for the product field to work. You can add campaigns in the Options section at the bottom of the settings page. Give it a name and value (E.g., “Black Friday” and “BlackFriday”). There is no need to create an option for the New and Sale badges as these are automatically made. For those you only need to create the design (this will be shown next) and link them properly on the relevant columns (this will also be shown later in this guide).
All styling will be done in the Ecommerce Badges page which is the next one to setup.
- In Content open the Swift tools folder
- Create a new page in the Design folder by right clicking it. Choose “Ecommerce badges collection” as the new page and name it “Ecommerce badges”. Make sure to keep the page status Hidden in menu.
The first paragraph to create on the Ecommerce badges site should be a default no badge paragraph.
- Create a New paragraph, choose the Ecommerce badge and name it “No badge”
- Leave the details and layout as they are and hit Save and close
Now you are ready to style the options created in the product field called Campaign. Let us say you have already created an option called “Black Friday” and want to style it:
- Create a New paragraph and name it “Black Friday”
- Enter a Css class name like “BlackFriday” (it is important that your css class names are unique) and tick the checkbox Campaign
- In the Campaign section choose the relevant campaign type, in this case “Black Friday”.
- Style the badge with relevant colors.
When designing for the New and Style badge you do not have a campaign type to link to. This is because the link is done in the relevant ecommerce columns (shown later in the guide).
Whenever you have designed a new badge, you should always open the Ecommerce Badge page by clicking Show page in the top panel. This is to make sure the colors of the badges are rendered.
Next, you will need to link to the Ecommerce badge page in the backend. This is done in the website settings.
- Click the three dots next to the website name. Click on Websites
- Right click on your website and click Edit
- Scroll to the Design section and locate the Ecommerce badges page field
- Link to your Ecommerce badge page
- Hit Save and close
Now everything is ready to be configured in the Visual Editor. The badges are added to the relevant ecommerce columns in the column editor. In each editor there is a Badges section where the configuration is done. In this section you can link the layout of your New and Sale badges along with some configuration for them. You can also choose the custom badges that can be shown on this column.
Remember to clear your browsing data of cashed images and files when you are done working with badges to see the results yourself.
When all this is done, the last step is to add the relevant campaigns to the products. This can be done in either Ecommerce or PIM. We recommend using PIM as this allows you to Bulk edit products, meaning you can add campaigns to multiple products at the same time. If you are doing it in Ecommerce you will have to enter each individual product when adding them to campaigns. We have written documentation about how to do it in both PIM and Ecommerce here.