Example 12.1. Creating an Additional Custom Layout for Visitors Coming from an Affiliate
Let's say we want to create a special look and feel for people who visit the store from a link on a particular affiliate's site. (Perhaps we want to include the affiliate's logo in the store's header, or change the text or colors around a bit. Any customization on any or all screens is possible.)
- The first thing to do is give a name to your new layout. For our purposes (and for lack of a more original name) let's call our new layout the "special" layout (a one-word term is best).
- This name serves as both the value of the
layout
URL parameter for visitors coming to the site, and as the name of the directory under /WEB-INF/layouts
that holds the new layout's customized templates. So, go ahead and create a subdirectory under /WEB-INF/layouts
named special
. While you're at it, within that directory create the same subdirectories found under the custom
and default
directories: core
, product
, order
, customer
, and payment
. - Tell your affiliate to add the
layout
URL parameter, with a value of "special", to any links that take visitors from their site to your store. For example, the link to your Welcome Screen would look something lie this: http://www.storesdomainname.com/softslate/Welcome.do?layout=special
. When SoftSlate Commerce sees that parameter on the URL, it knows to use the "special" layout throughout the user's session. - At this point you can follow the same techniques for creating a custom layout described in the Creating a Custom Layout chapter to create the new "special" layout. Copy files you want to customize from the
default
directory to the special
directory. If the visitor is assigned to the "special" layout, the store will first look in the special
directory to include each template. If it does not exist there, it will then include the corresponding template in the default
directory.