CybroidX Posted June 2, 2023 Share Posted June 2, 2023 Hello, I am a newbie here, I am developing a custom template for my company based on the Latest Twenty-One system theme. The theme works well but I have a problem trying to create a hook that queries products and return them to the $myproducts variable using the ClientAreaPage hook but I have failed to get my hook running, on checking Activity log I see Hook Debug: No Hook functions defined for ClientAreaPage. <?php use WHMCS\Database\Capsule; function homepage_products_hook($vars) { $products = Capsule::table('tblproducts') ->join('tblpricing', 'tblproducts.id', '=', 'tblpricing.relid') ->where('tblpricing.type', 'product') ->where('tblproducts.hidden','0') ->where('tblproducts.gid','1') ->select('tblproducts.id','tblproducts.name','tblproducts.description','tblpricing.monthly') ->orderBy('tblproducts.order') ->groupBy('tblproducts.id') ->get(); $results = json_decode(json_encode($products), true); return array("myproducts" => $results); } add_hook("ClientAreaPage", 1, "homepage_products_hook"); ?> I have created that file in `includes/hooks/homepage_products_hook.php`. Is there anything am doing wrong? I need your help. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.