izghitu
Member-
Posts
17 -
Joined
-
Last visited
About izghitu

Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
izghitu's Achievements
Junior Member (1/3)
2
Reputation
-
Thanks, I am glad I was able to help. I also faced the need to display this for multiple products and found the same solution as you but never had time to post it.
-
Hi, This is more of an inconvenience that I noticed in WHMCS Support Tickets. After I select the required Statuses and other values to view tickets and click Search/Filter it shows me those required. However after the auto-refresh is set and refreshes the page then the Filter is reset to other settings. Is there any way to make the filter selection I do to save across auto refreshing? Please help. Thanks in advance.
-
So I chose the hooks way to get the same implemented into the admin interface. Below is the hook to be used to make it display the required custom field's value along with the product name: <?php if ( !defined('WHMCS')) { header("Location: ../../index.php"); } use WHMCS\Database\Capsule; // Please set custom field id here. $customfieldId = 1; if($_REQUEST['getAll'] == '1') { if($_REQUEST['userid'] != '') { $all = Capsule::table('tblcustomfieldsvalues') ->join('tblhosting', 'tblcustomfieldsvalues.relid', '=', 'tblhosting.id') ->where('fieldid', $customfieldId ) ->where('userid', $_REQUEST['userid'] ) ->get(); }else { $all = Capsule::table('tblcustomfieldsvalues')->where('fieldid', $customfieldId)->get(); } $all = json_decode( json_encode( $all ) , true ); $newAll = []; foreach($all as $a) { $newAll[$a['relid']] = $a['value']; } ob_clean(); echo json_encode(array( "all" => $newAll )); die; } add_hook('AdminAreaPage', 1, function($vars) { if( $vars['filename'] == 'clientsservices' ) { echo '<script> document.addEventListener("DOMContentLoaded", function(){ $.post(window.location, { getAll: 1 }, function(data, status){ var data = JSON.parse(data); var first = []; setInterval(function() { var x = document.querySelectorAll("[data-value]"); for (var i = 1; i < x.length ; i++) { if(typeof first[x[i].dataset.value] === "undefined") { first[x[i].dataset.value] = x[i].innerText; } if(typeof data.all[x[i].dataset.value] !== "undefined" && data.all[x[i].dataset.value] != "") { x[i].innerText = first[x[i].dataset.value] + " - " + data.all[x[i].dataset.value]; } } }, 100); }); }); </script>'; } if( $vars['filename'] == 'clientshostinglist') { echo '<script> document.addEventListener("DOMContentLoaded", function(){ $.post(window.location, { getAll: 1 }, function(data, status){ var data = JSON.parse(data); var table = document.getElementById("sortabletbl1"); var rows = table.rows; for (var i = 1; i < rows.length ; i++) { if(data.all[rows[i].cells[1].innerText] != null && data.all[rows[i].cells[1].innerText] != "") { rows[i].cells[2].innerHTML = rows[i].cells[2].innerHTML+ " - " + data.all[rows[i].cells[1].innerText]; } } }); }); </script>'; } }); The only thing that needs to be setup is the $customfieldId inside the hook. Hope this is useful to someone. Thanks!
-
The WHMCS support guys just told me there's no way to do this for the admin interface and encouraged me to write a Feature request which I will do. Thanks for your suggestions though.
-
Just an update. I was able to implement this for the client area only like this: includes/hooks/service_customfields.php <?php use WHMCS\Database\Capsule as DB; if (!defined("WHMCS")) { die("This file cannot be accessed directly"); } add_hook('ClientAreaPageProductsServices', 1, function($vars) { $fieldId = 1; //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]; } }); templates/six/clientareaproducts.tpl - I have added "- {$customFields[$service.id]}" right after {$service.product} ... <td><strong>{$service.product} - {$customFields[$service.id]}</strong>{if $service.domain}<br /><a href="http://{$service.domain}" target="_blank">{$service.domain}</a>{/if}</td> ... But I am still unable to apply the same logic to the admin area interface where I list the products. I even searched for the "service.product" string in all whmcs files and did not find any except those in the client area that I already applied this to. Does anyone know how do I apply the same to the admin interface? Please help. Thanks!
-
Hi, I have a product that has some custom fields for the customer to enter after the purchase. Is there any way to make the product name append one of the custom fields as its name at the time when I view the product list for either the client or for all clients? For example the product name is: Server monitoring. One the custom fields the client uses is IP: 1.2.3.4. After the custom field is entered by the client the product name should show: Server monitoring(1.2.3.4) or whatever text/format I need on the page where I view the product list or in the drop down menu where I select the product to view for the particular client. Please let me know Thanks in advance.
-
Hi, I am going to use whmcs to sell web hosting to the clients. The way this will work is a client will need to buy a 10 domains hosting package which then he will need to be provided with custom fields to choose from for each domain that is going to be hosted. Basically each package should have inside 10 domain hosting products. Can someone please tell me what would be the best way to achieve this? Thanks in advance.
-
That helped. Thanks very much for your valuable suggestions!
-
Magic! Sometimes I wonder how do you know all this stuff. It did the trick but it seems there's an additional problem. Please see attached image, when I view the invoice in the client area it shows the required format in one place but not in the other. Any way to change that to match as well? Please let me know. Thanks
-
Hi, Is there any way to make WHMCS use letters in invoice numbers as well? For example I need invoices to have numbering like this: US{NUMBER} and also have the number increment automatically. I tried putting the US{NUMBER} thing in the invoice admin area but the letters are being ignored. Please let me know. Thanks
-
Yay, that did the trick. Thanks a lot for your help!
-
Thanks guys for your help so far. What if I want the bank details displayed in the PDF only when the method of payment chosen is Bank Transfer? How do I correctly add that If statement? Please let me know.
-
I found reference to the logo in that file but I can't see how I can do the sizing stuff, there's nothing in the docs about this, can you please help with details? Can you please be more detailed about this too? how do I do it? What variable do I use?
-
Hi, I have setup Product Custom Fields for the customer to enter when ordering a product. The data that the customer is supposed to enter is sensitive so after he does checkout that data is sent to me by email in the order confirmation. Is there any way to filter out so certain Product Custom Fields are not included in the order confirmation email? Please let me know. Thanks
-
Hi, Sorry for opening a topic that has been opened already before but I was unable to find an answer in those that would help me. When I create an invoice for a client and then view it from the Client area the logo size is huge. I did edit invoicepdf.tpl and set it to show properly in the downloaded PDF file but it still appears huge when the invoice is viewed in the Client area. One other problem I have is that the invoice viewed in the Client Area appears to be different from the downloaded one in terms of data that is displayed. For example if I create an invoice and set the payment method to Bank Transfer then the bank transfer details will appear in the invoice viewed in the Client area. After I download that invoice I can no longer see those bank payment details. Is it possible to add those same details into the PDF version of the invoice? Please help. Thanks in advance.
