Actions#
In Miva Merchant development, Actions serve as directives that instruct Miva Merchant on specific tasks to execute. Actions, denoted by four-letter codes, dictate Miva Merchant’s behavior when triggered by URL parameters or hidden form inputs. Miva Merchant encompasses a range of predefined actions, including “add product to cart,” “remove product from cart,” “update quantity,” “login,” “logout,” and various checkout-related actions. These actions automate essential functionalities within the Miva Merchant platform.
Actions are typically integrated into forms or appended as URL parameters to initiate specific operations within the Miva Merchant environment. Most actions are preconfigured within Miva Merchant, obviating the need for custom form creation. The association of actions with respective functions within Miva Merchant automates tasks and streamlines development processes.
Multiple actions can be chained within a single form submission, as exemplified in the checkout process. This enables sequential execution of tasks, such as order placement, shipping calculation, tax assessment, and transaction authorization.
The source code snippet from merchant.mvc, the core controller of Miva Merchant, offers insights into action parsing and function invocation. This snippet, available in the Miva Merchant Limited Source Kit (LSK), illustrates how actions are mapped to corresponding functions for execution.
Examples#
-
Form Submission: Hidden form inputs containing action codes, such as
LOGN
for login orLOGO
for logout, facilitate seamless execution of user-initiated actions. Miva Merchant processes these actions and performs the requisite operations, including session management and validation. -
URL Parameters: Actions can also be transmitted as URL parameters, enabling dynamic navigation and functionality execution. For instance, the
LOGO
action appended to the logout URL directs Miva Merchant to log out the user and redirect to the designated page.