Éxecuter du code quand une commande est payée
Lorsque l’on utilise le plugin commande et que l’on souhaite exécuter une peu de code lorsqu’une commande est payée, il suffit d’utiliser ce petit pipeline :
- function prefixe_post_edition($flux) {
- if ($flux['args']['table'] == table_objet_sql('commande')
- and $flux['args']['action'] == 'instituer'
- and $flux['args']['statut_ancien'] == 'encours'
- and $flux['data']['statut'] == 'paye'
- ) {
- $id_commande = $flux['args']['id_objet'];
- // Coder ici
- }
- return $flux;
- }