While shopping online apparel, you definitely came across a situation where you have to choose the product color and size option. This is what known as Swatches that provides an alternate way to display the selection of options for configurable products. Rather than choosing an option from a typical drop-down, swatches make it easy for customers to make their selection by clicking a swatch. By default, this type of swatches is displayed on the product page, product list, and in layered navigation.
Unfortunately, these swatches are only available for the default RWD package. But we can add this feature in our custom theme using code.

Firstly copy the “configurableswatches” folder to your theme “template” folder.
app\design\frontend\RWD\default\template\configurableswatches
and its content to
app\design\frontend\Themes\Yourtheme\template

Now, you have to copy “configurable.phtml” file to your “options” folder.
app\design\frontend\RWD\default\template\catalog\product\view\type\options\configurable.phtml
To
app\design\frontend\Themes\Yourtheme\template\catalog\product\view\type\options

Also, copy your “media.phtml” from view folder to your custom theme view folder.
app\design\frontend\RWD\default\template\catalog\product\view\media.phtml
to
app\design\frontend\Themes\Yourtheme\template\catalog\product\view\

Also, copy swatches javascript to your theme.
skin\frontend\RWD\default\js\configurableswatches\
skin\frontend\RWD\default\js\lib\
and its content to
skin\frontend\Themes\Yourtheme\js\

and…
skin\frontend\RWD\default\js\app.js
skin\frontend\RWD\default\js\minicart.js
skin\frontend\RWD\default\js\slideshow.js
to
skin\frontend\Themes\Yourtheme\js\

Also, Copy “configurableswatches.xml” file from the RWD theme folder to your custom theme layout folder.
app\design\frontend\RWD\default\layout\configurableswatches.xml
to
app\design\frontend\Themes\Yourtheme\layout\

Now, we have to create “local.xml” file inside our theme layout folder and add the following code.
app\design\frontend\Themes\Yourtheme\layout\local.xml

NOTE : If your package layout folder already contains a local.xml file, then do not overwrite it. Have a look at the changes in the next step and copy them to your version of the local.xml file.

Now. Add the following css to your “customstyle.css” file:
skin\frontend\Themes\yourtheme\css\customstyle.css

Lastly, copy the “bg_x.png” to your theme images folder.
skin\frontend\RWD\default\images\bg_x.png
to
skin\frontend\Themes\Yourtheme\images\

That’s it, Let us know if you are facing an issue while implementing swatches using this code by commenting below.
Happy Swatches!

Click to rate this post!
[Total: 4 Average: 5]