Configuration in Venddor IO

A Two-tiered Approach

Venddor IO integrates a comprehensive settings mechanism which can be broadly classified into two categories:

Core Settings

These are fundamental configurations that govern the overarching functionality of Venddor IO. They are foundational and independent, meaning they operate uninfluenced by any modules you might incorporate into your setup.

Core Settings Interface

Module Settings

As the name suggests, these configurations relate specifically to individual modules installed within Venddor IO. They control and fine-tune the behavior and features of their respective modules.

Both these configurations are seamlessly managed through two central classes: the Registry and Settings classes. The data associated with these configurations is systematically stored in the platform's database, particularly in tables prefixed with settings_.

For administrators, Venddor IO's intuitive administration panel offers an efficient interface to interact with and modify both the core and module-specific settings. This ensures that tailoring the platform's behavior to specific business needs is both straightforward and efficient.

Core Configurations

The core settings, fundamental to Venddor IO's operation, can be located in the Administration panel under the 'Settings' page (visible in the main navigation bar). These configurations are grouped into various sections:

If you're using Venddor Seller Center, you'll notice these configurations in a distinct layout. The display of each setting or configuration segment is influenced by its 'edition_type'. Additionally, a setting can have varied values depending on the specific storefront or vendor. Generally, each core setting should be part of a particular segment. If it doesn't, it remains concealed.

Settings Layout

For illustration, in scenarios with numerous storefronts, the 'Alternative currency display format' (with an edition_type set as "ROOT,STOREFRONT") will manifest in a specific manner.

Module Configurations

Settings related to specific modules can be managed via 'Add-ons' and then 'Manage add-ons' from the top navigation in the Administration panel. The majority of these add-ons come with their individual configuration settings. There are primarily two methods to access an add-on's settings:

  1. Simply click on the add-on's name.
  2. Hover over a specific add-on until a gear icon emerges on the right. Clicking this icon will reveal a dropdown, from which you can select 'Settings'. It's worth noting that settings might be inaccessible if they possess a specific 'edition_type'.

To exemplify, consider the settings available under the 'SEO' add-on.

Interacting with Configurations in the Code

In Venddor IO, settings are also manipulated programmatically via the 'Registry' and 'Settings' classes. These classes proffer functions that allow the addition, modification, and retrieval of setting values.

The Registry Class

The 'Registry' class is pivotal for obtaining settings across the application. This class is also responsible for caching these settings (typically seen in the var/cache/registry directory).

Manipulating settings using the 'Registry' class looks something like this:

The Configuration class within Venddor IO offers an expanded set of tools tailored for handling settings stored in the system's database. With an array of functions, it assists in operations like verifying the presence of settings, reading, updating, and deleting the values of these configurations.

For instance, if you're keen on working with the 'elements_per_page' setting (found under Settings → Appearance), the Configuration class can be utilized as follows:

To validate the presence of the setting:

Configuration::instance()->isExists('elements_per_page', 'Appearance');

To retrieve the value of the setting:

Configuration::instance()->getValue('elements_per_page', 'Appearance');

To update the value of the setting:

Configuration::instance()->updateValue('elements_per_page', $new_value, 'Appearance');

It's pivotal to recognize that settings might possess values specific to certain storefronts or companies. While at times, the storefront or company might be detected automatically, it's usually prudent to define them explicitly:

$config_manager = Configuration::instance(['storefront_id' => 4, 'company_id' => 17]);
$config_manager->getValue('elements_per_page', 'Appearance');

Notably, when using Venddor Seller Center, this is the sole approach to retrieve vendor-centric configurations.

Module Configurations in Venddor IO

Specifying Configurations in addon.xml

Each module's configurations are outlined in its respective 'addon.xml' file, found within the module's directory. These settings are incorporated under the <settings> tag of 'addon.xml'.

Attributes linked with the <settings> section include:

While both attributes are discretionary, an example usage could be:

<settings layout="separate" edition_type="ROOT">

This implies that configurations will be exhibited on an independent page, primarily available in the All stores/All vendors mode of Venddor IO.

Venddor IO Settings Architecture

Leveraging Functions for Configuration Management

Variants for settings in Venddor IO can be dynamically crafted and modified using two key function types: variants.functions and actions.functions.

Data Storage Paradigm for Configurations

All critical data about core and module configurations resides in the database, primarily within tables prefixed by settings_.

Data Storage Diagram

Attachment 2: A Deep Dive into Setting Types

In Venddor IO, the nature of a setting is conveyed through the <type> tag in the addon.xml file. Here's an overview of possible types:

  1. selectable_box (B): A double-list select box, with one list showcasing possible values and the other highlighting selected ones.
  2. checkbox (C): A straightforward checkbox.
  3. hidden (D): A setting that remains invisible to the user.
  4. template (E): Loads a custom template from the designated locations.
  5. file (F): A provision for selecting a file.
  6. checkboxes (G): A list of checkboxes allowing multiple selections. Variants are determined by variants.functions.
  7. header (H): Serves as a title for setting blocks or content sections.
  8. input (I): A basic input field for character entries.
  9. selectbox (K): A dropdown list, allowing the selection of a single variant.
  10. multiple_select (M): A scrolling list permitting multiple variant selections.
  11. multiple_checkboxes (N): An array of checkboxes, supporting multiple checks at once.
  12. info (O): Showcases results from a specific function defined in the <handler> parameter.
  13. password (P): An input field where all characters are masked.
  14. radiogroup (R): A group of radio buttons, with only one selectable at any given time.
  15. selectbox (S): A dropdown list for single variant selection.
  16. textarea (T): A field designed for text input.
  17. input (U): Input field permitting only numeric inputs.
  18. states_list (W): A dropdown designed for state or region selection.
  19. countries_list (X): A dropdown list catered for country selection.
  20. permanent_template (Z): Loads a consistently available custom template, even if the module is turned off.

Understanding these types offers an integrated understanding of how Venddor IO manages and presents configurations, ensuring flexibility and user-friendliness across different settings.