Generic Variable Merges
Note: Theme modification involves any change to the default values in the HTML or CSS of any theme or widget. Support can direct you to the correct page to make changes or to reset the widget, page HTML or CSS to its default value. This will undo any customization that may be in place. Before you create or modify a theme using HTML and CSS it is suggested to have a backup handy.
While theme modification is outside what support is allowed to assist with, if you need assistance with making modification to the theme, our implementation department is available to make these modification at an hour rate. If the service is ever needed please let us know and we will get that process started for you. Or check out our new Theme Store to find a theme that suits your needs.
|
[Proficiency suggestion: This is an advanced feature that is recommended for individuals with some basic programming experience (HTML and CSS don't qualify), and familiarity with the operation of Americommerce Spark Pay Online Stores merge codes. Training is available for $95/hr if necessary.]
What are they?
Generic Variable Merges codes are a powerful feature. It gives designers and front-end developers an unprecedented amount of control for different conditions.
Source
Where are they used?
They can be used on any page that allows Custom HTML (emails included).
How do you use them?
There are 3 merge codes that you can use, but 2 are the Primary ones.
- Use if to specify a block of code to be executed, if a specified condition is true
- Use else to specify a block of code to be executed, if the same condition is false
Primary:
- - Creates a Variable
- Show if True - Creates the condition for your variable, and what happens when the condition is met.
Secondary:
- YourVariableName=Value;MfgIs=Value;MfgIs=; - For testing purposes, you can output all of your generic variables
Note: Generic Variables do not work with capital letters. Please keep all variables names lowercase.
Examples:
1. Let's say you wanted to display a certain image or special text or links on the Product Details page if the product was by a certain manufacturer. Here's the process...
- Create your variable...
- MfgIs is only an example, it can be almost any string you want.
- Determine the value that the variable needs to be...
- Notice how we used another merge code to set the variable. This means that MfgIs will always be whatever the manufacturer name is of the product being viewed on the Product Details page.
- NOTE: When using Merge codes as values, you can only use merge codes that normally work on that page. (ie: will not work on the home page if no products are displayed on that page.)
- Decide when something should happen.
- <--- This is the closer and MUST be present. Your site may break if it is not placed correctly.
NOTE: Part 2 is placed wherever you want the special content to show up.