That Software Guy! eCommerce Starts Here!
Switch Skin

Switch Skin

A Zen Cart™ mod which allows you to dynamically switch from one template to another.

Donate: This is free software. Show your appreciation by supporting my efforts. Donate

Relevance: Zen Cart™ 1.5.1 and above

Current Version: 1.2a

Support Thread: Skin Switch Support Thread

Cost: Free, but donation appreciated

Installed Cost: $120.00 Buy Professional Installation by That Software Guy

Installation Difficulty: Moderate

Installation Instructions: click here

Location: Zen Cart Downloads page, under Template Alterations

Download: Switch Skin on Zen Cart Downloads Page

FAQ: click here

See it Live: Go to my demo4 store. You can switch back and forth between a basic desktop template and Picaflor Azul's Responsive Sheffield Blue template.

The desktop link to switch skins is here:
Zen Cart Switch View



The mobile link to switch skins is here:
Zen Cart Switch View




Overview:

If you want to try a new template or provide your customers with multiple templates, this module will help you do that.

Installation Instructions:

  1. Back up everything! Try this in a test environment prior to installing it on a live shop.
  2. Unzip the file you have received.
  3. Upload the files in the includes directory to your cart.
  4. Consider how you would like to do skin-switching. The example1 directory shows how to do it through a link. The example2 directory shows an example of how to do it automatically. (Be sure to rename "custom" to the name of your actual template.) Note: If you are using Zen Cart 1.5.5 or higher, your template name will be "responsive_classic" if you have not changed it.
Further instructions for example2:
  1. Edit ./includes/init_includes/overrides/init_templates.php and right before the line that says
        if (isset($_GET['skin'])) {
    
    add
      set_template();
    
    so now you have
      /* See if there is an override */
      set_template();
      if (isset($_GET['skin'])) {
    
  2. Modify the use_nondefault_template() function to check the parameter you want to check. The example contains a trivial check for day of the week. You may wish to check
    • whether or not the visitor is coming from a mobile device (Note: you will need a mobile checking function, such as mobiledetect.net)
    • the visitor's country of origin (Note: you will need an IP address to Country mapping function, such as ip2nation.com)
  3. set the non-default template name in the set_template() function. (I have used responsive_sheffield_blue as an example.)

Major Versions

  • 1.2a 10/22/2016 - Addition of third example by @ideasgirl
  • 1.2 09/18/2016 - Update for Zen Cart 1.5.5a
  • 1.1a 10/24/2015 - Documentation updates
  • 1.1 09/06/2015 - Addition of second example
  • 1.0 07/05/2015 - First Release

FAQ

Q: Is the name of this mod Switch Skin or Skin Switch?
A: Yes. This is in the spirit of switching.