Jump to content


New Member
  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Xfireteam

  • Rank
    Junior Member
  1. 1- Create file: includes/hooks/service_customfields.php and add the following code to it: <?php use WHMCS\Database\Capsule as DB; if (!defined("WHMCS")) { die("This file cannot be accessed directly"); } add_hook('ClientAreaPageProductsServices', 1, function($vars) { $fieldId = 4; //Custom field id if (isset($vars['services'])) { $csVals = []; foreach ($vars['services'] as $service) { $fieldVal = ''; $data = DB::table('tblcustomfieldsvalues AS t1') ->leftJoin('tblcustomfields AS t2', 't1.fieldid', '=', 't2.id') ->select('t1.value') ->where('t2.id', $fieldId)->where('t2.type', 'product')->where('t1.relid', $service['id']) ->first(); if (!is_null($data)) { $fieldVal = $data->value; } $csVals[$service['id']] = $fieldVal; } return ['customFields' => $csVals]; } }); 2- In clientareaproducts.tpl use {$customFields[$service.id]} to output custom field value. Note: code is querying custom field value using this SQL: SELECT * FROM tblcustomfieldsvalues AS t1 LEFT JOIN tblcustomfields AS t2 ON t1.fieldid = t2.id WHERE t2.id = 2 #Field id AND t2.type = 'product' AND t1.relid = 9 #service id i trying add it right after {$service.product} but not work. Does anyone have any ideas? I want to show a custom field on each product, or a product ID, to differentiate who it belongs to.
  2. how to show custom field in each product in: clientarea.php?action=services
  3. How to display ID service please. when the person buys several products of the same category and cannot be differentiated
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated