| |
|
Setting Type |
What it looks like / How it works |
| |
|
|
|
|
|
|
On/Off switches
|
$enable_cc_verify = 1;
This simply turns On ( 1 ) or Off ( 0 ) the on board credit card verification algorithms. You can set these to zero (off) or any positive integer (on)
|
| |
|
|
|
|
|
|
Text strings
|
$programfile = 'mof.cgi';
This type of setting simply identifies a string of text. These text settings are used for HTML tags and attributes, messages, filenames, and file pathways. This example identifies a file that MOF will use.
In a few rare cases, text string settings are used both to declare a text string that will be used by MOF, and as an On/Off switch. We'll point out where that is the case in the configuration help.
|
| |
|
|
|
|
|
|
Simple array settings
|
@field_validation = ('HatColor','HatSize');
This is a simple array. It stores elements in a list . MOF uses the list to process stuff. This example is taken from the section USER INPUT OPTIONS in mof.conf . It simply identifies that both HatColor and HatSize should be required input for a product.
|
| |
|
|
|
|
|
|
Associative arrays
|
%product_fields = ('HatColor','Selected Hat Color',
'HatSize','Selected Hat Size');
This is an associative array. These types of arrays make two column lists where the item in the first column is paired to the item in the second column. This example is taken from the section USER INPUT OPTIONS in mof.conf .
These arrays act like name=value pairs, pairing the string Selected Hat Color with the element HatColor .
|
| |
|
|
|
| |
|
More Explanation and Some Examples : |
| |
|
|
|
 |
|
Simple On/Off Switches : |
| |
|
Stick to the syntax rules that you find already in place for a setting. If it is surrounded by single quotes, double quotes, or no quotes, then use that same syntax. Remember that the line always ends with the semicolon.
A simple On/Off switch is On (positive number) or Off (0) (Null)
= 0; -- Off
= 1; -- On
These types of settings can be both: On/Off switch and contain usable information:
$use_global_tax = 0; -- Off
$use_global_tax = 0.825; -- Enables a global tax rate of 8.25 %
Here's an On/Off setting that contains usable text information
= "<font size=1 color=gray>Tax</font>";
The above setting not only turns on the feature, but also tells MOF how to print an identifier for taxable or non taxable items.
If you wanted to turn Off that feature it would look like this:
= "" ; -- (null)
Note : (null) is a set of double quotes "" (or single quotes) '' with nothing (null) between them. Zero is not the same as (null).
|
| |
|
|
|
 |
|
Single Text Strings : |
| |
|
Stick to the syntax rules that you find already in place for a setting. If it is surrounded by single quotes, double quotes, or no quotes, then use that same syntax. Remember that the line always ends with the semicolon.
These types of settings can identify a filename
= " countries.txt ";
These types of settings can identify text and/or html
= "Sales Tax";
Note : the example above uses single quotes to surround a text string. When single quotes are used then everything between them is treated as exact text.
Here's another example of an html setting, but surrounded in double quotes:
=<img align=top src="$mvar_front_http_web/mofcart/images/delete_minus.gif" border=0 width=16 height=16>
Note : if any of these type settings surrounded by double quotes use special characters within the double quotes, then the Perl escape character \ must precede any occurrence of a special character. The above example must precede the inside use of a double quote with the backward slash. This tells Perl to treat the very next character as text. Otherwise, Perl would be looking at a broken string, not knowing what to do with 4 sets of double quotes on a single line. This is a common oversight with beginners.
|
| |
|
|
|
 |
|
Simple Array Lists : |
| |
|
- Simple arrays are lists of elements
- The whole list of elements are enclosed within parentheses ( )
- Each element in the list is separated by a comma
- If an element will be text, then you should surround it in single quotes
- If an element is numeric, then no quotes are needed
- The very last element in your list does not have a comma after it
- The very first element in your list does not have a comma preceding it
- End the whole array with the semicolon
An array setting can have one element:
= ('custom');
Or it can have multiple elements of both text and numbers
= ('weight',0,0,1);
Notice the rules of surrounding the text in single quotes, numbers without quotes, separated by commas, enclosed in parentheses.
You don't have to keep everything on one line, you can break it all up on individual lines. Perl allows for liberal white space if it will help you make things more readable. All rules described above appear in the following example, yet each element is placed on a different line, making it more readable. Remember to end the list with the ending parenthesis and semicolon );
= ('HatColor',
'HatSize',
'PropellerColor',
'BandType');
Here's a list of US states and Canadian Provinces. This example sets all these states and provinces as domestic for shipping computations.
=
('AL','AZ','AR','CA','CO','CT','DE','DC','FL','GA','ID','IL','IN','IA','KS','KY','LA','ME','MD', 'MA','MI',
'MN','MS','MO','MT','NE','NV','NH','NJ','NM','NY','NC','ND','OH','OK','OR','PA','RI','SC','SD','TN',
'TX','UT','VT','VA','WA','WV','WI','WY','AB','BC','MB','NB','NF','NS','ON','PQ','SK');
|
| |
|
|
|
 |
|
Associative Array Lists : |
| |
|
- Associative arrays are lists of name=value pairs
- The whole list of elements are enclosed within parentheses ( )
- The name and value in the list is separated by a comma
- And The pairs of name,value are separated by a comma
- If an element will be text, then you should surround it in single quotes
- If an element is numeric, then no quotes are needed
- The very last element in your list does not have a comma after it
- The very first element in your list does not have a comma preceding it
- End the whole array with the semicolon
Important : When making these types of arrays, you must always keep order with your name=value pairs. To explain: Perl will read the associative array beginning with the first item in your list, the next item in the list is paired with the first .. the third item is paired with the fourth .. the fifth is paired with the sixth .. and so on. If you have your pairings mixed up then you will get unexpected results.
Here's an example from the tax settings:
= ('TX',0.0825,'CO',0.053,'CA',0.0922);
This example sets up the following tax rates for different states
(Texas) TX = 8.25 percent
(Colorado) CO = 5.3 percent
(California) CA = 6.22 percent
You can see the pairings:
Item 1 paired to Item 2
Item 3 paired to Item 4
Item 5 paired to Item 6 ...
Here's an example using the shipping configurations. This setting instructs MOF what fields to list for shipping, and if that field is required or not. It also acts as the overall On/Off switch for using the whole shipping information and computations. In a few short lines, this settings is able to supply MOF with some very complex instructions for handling shipping information input.
'Ecom_ShipTo_Postal_Name_Prefix',0,
'Ecom_ShipTo_Postal_Name_First',2,
'Ecom_ShipTo_Postal_Name_Middle',0,
'Ecom_ShipTo_Postal_Name_Last',2,
'Ecom_ShipTo_Postal_Name_Suffix',0,
'Ecom_ShipTo_Postal_Street_Line1',4,
'Ecom_ShipTo_Postal_Street_Line2',0,
'Ecom_ShipTo_Postal_Company',0,
'Ecom_ShipTo_Postal_City',2,
'Ecom_ShipTo_Postal_StateProv',2,
'Ecom_ShipTo_Postal_Region',2,
'Ecom_ShipTo_Postal_PostalCode',4,
'Ecom_ShipTo_Postal_CountryCode',2,
'Ecom_ShipTo_Telecom_Phone_Number',0,
'Ecom_ShipTo_Online_Email',0
Notice all the rules are followed: surrounding the text in single quotes, numbers without quotes, separated by commas, enclosed in parentheses, ending in semicolon. We even placed each name=value pair on a separate line for readability.
Here's a last example taken from the tax settings. This setting identifies different tax rates for specific postal code areas. What's a little different about this one is that the zip code looks like a number, but is surrounded in single quotes--meaning it is actually treated like text. This is very important, because MOF uses this list to match zip code areas that may not always be numbers for different countries. MOF also uses this pattern to match the starting string, which could not be done with numbers
%use_zipcode_tax = (
'78745',0.025,
'78746',0.026,
'78747',0.027,
'78748',0.028,
'78749',0.029,
'78750',0.030
);
|
| |
|
|
|
|