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.
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
- ##SET[YourVariableName=Value]## - Creates a Variable
- ##IF[YourVariableName=Value]## Show if True ##ELSE## Show if False ##ENDIF## - Creates the condition for your variable, and what happens when the condition is met.
- ##GENERICVARIABLES## - 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.
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... ##SET[MfgIs=Value]##
- MfgIs is only an example, it can be almost any string you want.
- Determine the value that the variable needs to be... ##SET[MfgIs=##MFGNAME##]##
- 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: $$PRICE$$ will not work on the home page if no products are displayed on that page.)
- Decide when something should happen.
- We used Nike as our manufacturer. Now, any products that are produced by Nike will trigger the special content.
- NOTE: This value is CASE SENSITIVE. Nike is not the same as NIKE or the same as NIke. Ensure the value you use is EXACTLY what is in the system for the manufacturer.
Here's what your finished code will look like...
Part 1... ##SET[MfgIs=##MFGNAME##]## (This is normally placed before the If function.
Part 2... ##IF[MfgIs=Nike]## <your html code, image, banner, special comments, etc that you want displayed if the condition is met. > ##ELSE## <normally blank, but could include whatever you want if, in this case, the Manufacturer is NOT Nike Spark Pay Online Stores > ##ENDIF## <--- 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.