===== Production Handlers ===== ===== Moodle Shop: Structure ===== ==== Structure overview ==== Production handlers are responsible for the actions that are executed when a product is bought on the Moodle shop. It runs an action script that can be predefined (standard handlers) or on the contrary very specific to a given usage context (specific handlers). A handler is characterised by: * A pre-payment script * A post-payment script * Internal parameters * External parameters * Post-production actions if the product has a life cycle after the purchase. ==== The scripts ==== === The pre-payment script === This script is executed before payment, whether it is immediate or deferred. === The post-payment script === This script is executed ONLY once the payment has been validated. ==== The parameters ==== They correspond to the settings to be made to call the appropriate handlers. === Internal parameters === Internal parameters are set up by the operator to provide predefined data or choose handler behaviour options. The values of these parameters must be determined when the operator programs the catalogue entry. === External parameters === External parameters are parameters that are requested from the customer when they order the product. They are defined as a set of form element descriptions. The values of these parameters are entered by the customers during the purchase phase. The shop will present a micro-form per purchased product unit, so that each unit can receive its configuration. Some handlers need to collect data from the customer. The definition of this form uses a JSON syntax to define the expected information and the form elements to use in the shop. **The description adopts the following structure:** {{ :local:shop:structure:structure-requete.png?nolink |}} **The resulting expression is:** [{"field":"the_field_name","label":"some visible name","type":"textfield","desc":"some desc","attrs":{"size":80}}, {"field":"description_sample","label":"Description (sample)","type":"textarea","desc":"Short Description (sample)"}, {"field":"template_sample","label":"Model (sample)","type":"select","desc":"Course template (sample)", "options":{"MOD1":"Model1","MOD2":"Model2"}}] You can use an online service such as http://www.objgen.com/json to help you format the structure. ==== The handlers ==== These are the bodies that take care of fulfilling the products. === Standard handlers === Standard handlers are already written plugins that are delivered as standard with the shop or can be installed afterwards. Standard handlers can be associated with all the products of the catalogue. Standard handler plugins reside in a directory whose name must start with 'std_' (example: std_enrolonecourse). === Extension handlers === Integrators can add and develop new handler plugins available like the standard handlers for all the products of the shop. These handlers must reside in directories starting with 'ext_'. === Specific handlers === Specific handlers are handlers associated with one and only one product by its name. They do not appear in the list of available handlers, but a "Specific" option in the handler choice makes it possible to activate this particular handler if it is installed. === Post-production actions === Some handlers constitute products that can be altered or modified by their validity period. Example: A product of type "Unassigned seat" must be able to be assigned later to a learner, sometimes well after the purchase date. Similarly, some renewable products may offer a renewal possibility. Extensible products could offer an extension function, etc. Post-production actions are implemented by a set of dedicated functions: * The function that gives the "action starts" in the detail description of the product instance * The functions that execute the processing ---------- [[:local:shop:structure|Back to the structure summary]] - [[:local:shop|Back to the component summary Local Shop (Boutique)]] - [[:start|Back to the catalog]]