6. Settings
What are Settings
The settings contain information about feature configuration on the shop, if certain components have different configurations then the settings will have something that describes this behaviour. This is a snippet of a possible set of settings on the template.
{
"website": {
"favicon": "",
"logo": {
"type": "text",
"source": false
}
},
"navigation": {
"show_bread_crumbs": true,
"show_search": true,
...
}
Working with settings
The settings are defined by a JSON file located in the /admin/output/settings.json path. This file must exist in the template to function properly, and making changes is as simple as editing values or even adding and removing keys.
The settings can be changed by the shop owners through the shop administration. This is the recommended way to make changes to the settings.
Setting values can be accessed by using the settings get method provided by the settings module, simply call the settings get method with the key you want to display, and it will return the value. This function can be provided a default argument which will be returned if the key does not exist, otherwise NULL is returned.
{$settings = $Platform->import("settings")}
<p>
<span>The content of "navigation.show_search" is:</span>
<span>{$settings->get("navigation.show_search", true)}</span>
{Input
render=$settings->get("navigation.show_search")
name="Search"
}
</p>
Template configuration
The template configuration is a JSON file that contains the developer configuration for the template. These settings are not meant for the administration, but for special configurations for the template.
{
"payment_support": {
"cookies": {
"succeeded": "hs-checkout-has-check-succeeded",
"googlepay": "hs-checkout-can-googlepay",
"applepay": "hs-checkout-can-applepay"
}
},
"thumbnails": {
"srcset_sizes": [ 100, 200, 400, 600, 800, 1000, 1200, 1600, 2560 ],
"presets": {
...
"cart": {
"srcset": [ 100, 200, 400 ],
"breakpoint_sizes": {
"default": "100px",
"sm": "150px",
"lg": "250px"
}
},
...
}
}
}
Currently, it contains settings related to cookie names, as well as thumbnail sizes and breakpoints. The file is located in the root of the template, and is named template-config.json. These configurations are only meant to be changed by developers or advanced users. For example: Making changes to thumbnail settings will require resetting all thumbnails in the shop.
Getting these settings is done in the same way as the settings, by using the config get method provided by the config utility. There is also a special method for getting the thumbnail settings, config getThumbnailSizePresets.
Legacy settings
We are still using the email and print files that exist in the Rooty template today. These files are dependent on the previous format of settings, which are not used in the new code structure for the Adventure template.
These settings are located in the /admin/output/legacy.settings.json file. Their only current purpose is to adjust settings for emails sent to customers.