AnsweredAssumed Answered

LogicHooks  retrieving custom field in contacts and edit database

Question asked by YellowTulips YellowTulips on Aug 4, 2015
Latest reply on Aug 5, 2015 by YellowTulips YellowTulips
I need to edit a custom field in Contacts through another module.

I have a custom field in Contacts
  • Type: Integer
  • Name: points_c
  • Label: Loyalty Points                                 
Custom module "Products Catalogue" with a list of item, each item cost a certain amount of points
  • Type: Integer
  • Name: cost
  • Label: Points Required                                   
Custom module "Redemption" with 2 custom field where I pick the requester's contact and product for redemption. Points would then be deducted from points_c in Contacts.
  • Type: Relate
  • Name: contacts_c
  • Label: Contacts
  • Type: Relate
  • Name: product_c
  • Label: Product                                              
I have tried using Logic Hooks placing it in "custom\modules\redem_Redemption\" and started off with a simple logic to test if it is working, but nothing is showing. I have even tried doing Quick Repair and Rebuild.

<?php
    $hook_version = 1;
    $hook_array = array();
    $hook_array['after_save'] = array();
    $hook_array['after_save'][] = array(
        1,
        'Deduct loyalty points',
        'custom/modules/redem_Redemption/LogicHooksRedemptionLogicHook.php',
        'RedemptionLogicHook',
        'after_save_method'
    );
?>

<?php
class RedemptionLogicHook
 {
        function after_save_method(&$focus, $event, $arguments)
        {
                 $GLOBALS['log']->info("You have reached your custom logic hook.");
        }
}
?>

I am at my ends wit, my project deadline is closing in. Please help!

Outcomes