webtechwhiz
Member-
Posts
22 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Hotfixes
Everything posted by webtechwhiz
-
Hi Brian, I have added below code and working fine: add_hook('AdminAreaFooterOutput', 1, function($vars) { if($vars['filename'] == 'configpromotions'){ return <<<HTML <b>This is a custom output on the footer</b> <script type="text/javascript"> $('input[name="existingclient"]').change(function() { if(this.checked) { var html='<tr><td class="fieldlabel">Restrict to Specific Client?</td><td class="fieldarea"><label class="checkbox-inline"><input type="checkbox" name="restricted" value="1"> Restricted to selected clients only</label></td></tr>'; var elem= $(this).closest('tr').after(html); } }); $(document).on('change','input[name="restricted"]',function() { if(this.checked) { var html='<tr><td class="fieldlabel">Select Clients</td><td class="fieldarea"><select type="checkbox" name="restrictedto" multiple size="8"><option value="1">Client 1</option><option value="2">Client 2</option><option value="3">Client 3</option> </select></label></td></tr>'; var elem= $(this).closest('tr').after(html); } }); </script> HTML; } }); Now I have to display a list of all existing clients with active order in the list. Currently I have manually displayed Client 1, Client 2, Client 3 in the dropdown list. Also I would like to know how I can store the values to the tblpromotions. I have already created restricted column next to existingclient column with default value 0 and next to restricted column added another column restrictedto to store client's user id. Awaiting for your help on this... Regards, Shubhajeet Saha
-
Hi Brian, Thanks for your reply. I had also created following ticket with Support was redirected to community. My ticket query was: At first I would like to ask how to add custom html element Checkbox below "Existing Client Apply to existing clients only (must have an active order to qualify)"? When checked this checkbox my custom added check box should open. And when my custom check box is checked a new html element will open Select Existing clients. This will multiselect dropdown list having all existing client value will be userid and display will be client names. How to get existing client list that is my 2nd query. Below is the hook example found at https://developers.whmcs.com/hooks-reference/admin-area/#adminareapage. add_hook('AdminAreaPage', 1, function($vars) { $extraVariables = []; if ($vars['filename'] == 'index.php') { $extraVariables['newVariable1'] = 'thisValue'; $extraVariables['newVariable2'] = 'thatValue'; } return $extraVariables; }); Would like to confirm few things: add_hook('AdminAreaPage', 1, function($vars) { $extraVariables = []; if ($vars['filename'] == 'configpromotions.php?action=manage') { $extraVariables['newCheckBoxValue'] = 'thisValue'; } return $extraVariables; }); Will work on page while creating new coupon? Can you help me to achieve my goal using admin area hooks? I'll post my further queries later since its not allowing to post large text in comment. Will be awaiting your reply. Regards, Shubhajeet Saha
-
AfterShoppingCartCheckout unable to format Invoice Number
webtechwhiz replied to webtechwhiz's topic in Developer Corner
Find enclosed activity log for hook AfterShoppingCartCheckout Awaiting solution/reply from Developers in WHMCS community . . . -
InvoiceCreationPreEmail hook not working in WHMCS 8.1
webtechwhiz replied to webtechwhiz's topic in Developer Corner
Dear String, I have implemented above code, enabled hook debug mode and display errors. But no variable data is logged in tblactivitylog table. And in WHMCS v8.0+ I am unable to find Configuration > System Logs menu from Admin Dashboard. There are many logs for the hook 1 given below in description column: Hooks Debug: Hook Defined for Point: AfterShoppingCartCheckout - Priority: 1 - Function Name: generate_custom_invoice_number_4Client_hook But no log entries have logged any variables. I think logActivity (json_encode($vars)); didn't worked. Awaiting your reply... Regards, Shubhajeet Saha -
Dear Team, In reply to a support ticket #KQX-559385 - How to set invoice number raised on 13/01/2021 support team member John Kipling has given AfterShoppingCartCheckout hook on 21st April 2021. Based on documentation I had written hook code as below: function generate_custom_invoice_number_4Client_hook($vars) { $invoiceid = $vars['InvoiceID']; $customnumber = 'WTW'.date("Y").str_pad($invoiceid,5,"0",STR_PAD_LEFT); if (isset($customnumber)) { try { $updatedInvoiceNumber = Capsule::table('tblinvoices') ->where('id', $invoiceid) ->update(['invoicenum' => $customnumber,]); } catch (\Exception $e) { // Deal with error } } } add_hook('AfterShoppingCartCheckout', 1, "generate_custom_invoice_number_4Client_hook"); But its not working. As given in hook documentation below parameters should be available: Parameters Variable Type Notes OrderID int The Order ID OrderNumber int The randomly generated order number ServiceIDs array An array of Service IDs created by the order AddonIDs array An array of Addon IDs created by the order DomainIDs array An array of Domain IDs created by the order RenewalIDs array An array of Domain Renewal IDs created by the order PaymentMethod string The payment gateway selected InvoiceID int The Invoice ID TotalDue float The total amount due Hence I have fetched InvoiceId as $invoiceid = $vars['InvoiceID']. But not working. Request community members to help me in formatting invoice number with hook AfterShoppingCartCheckout. Unable to find any post related to AfterShoppingCartCheckout which is used to format invoice number. Request to kindly approve this topic. Regards, Shubhajeet Saha
-
InvoiceCreationPreEmail hook not working in WHMCS 8.1
webtechwhiz replied to webtechwhiz's topic in Developer Corner
Hi Brian, Now WHMCS support has given hook AfterShoppingCartCheckout to format invoice number when client makes purchases from fontend: I had written hook code as below: function generate_custom_invoice_number_4Client_hook($vars) { $invoiceid = $vars['InvoiceID']; $customnumber = 'WTW'.date("Y").str_pad($invoiceid,5,"0",STR_PAD_LEFT); if (isset($customnumber)) { try { $updatedInvoiceNumber = Capsule::table('tblinvoices') ->where('id', $invoiceid) ->update(['invoicenum' => $customnumber,]); } catch (\Exception $e) { // Deal with error } } } add_hook('AfterShoppingCartCheckout', 1, "generate_custom_invoice_number_4Client_hook"); But its not working. As given in hook documentation below parameters should be available: Parameters Variable Type Notes OrderID int The Order ID OrderNumber int The randomly generated order number ServiceIDs array An array of Service IDs created by the order AddonIDs array An array of Addon IDs created by the order DomainIDs array An array of Domain IDs created by the order RenewalIDs array An array of Domain Renewal IDs created by the order PaymentMethod string The payment gateway selected InvoiceID int The Invoice ID TotalDue float The total amount due Hence I have fetched InvoiceId as $invoiceid = $vars['InvoiceID']. But not working. Awaiting for your reply. Regards, Shubhajeet Saha -
InvoiceCreationPreEmail hook not working in WHMCS 8.1
webtechwhiz replied to webtechwhiz's topic in Developer Corner
Hi Brian, Would like to update that I have reopened ticket with this community post and as suggested by them I have created a new quote from Admin and then converted it into Invoice. Then the hook worked and created unpaid invoices WTW202100027 and WTW202100028 but when I tried to place and order from user login it generated proforma invoice 29. Can you please put some light on this issue? I think if it starts working in PI then it will work for final Invoice too. Request you to make a response. Awaiting your reply... Regards, Shubhajeet Saha -
InvoiceCreationPreEmail hook not working in WHMCS 8.1
webtechwhiz replied to webtechwhiz's topic in Developer Corner
Hi Brian, Sorry for late reply. My site using TwentyOne theme and all its functions, only some design customization is done. I have raised issue with Support tkt number is #KQX-559385 and below was their reply: Now tell me where should I report my issues. Support guys do access our cpanel and admin and fixes the issues. But they redirected me to Developer community. And here you senior developers guides us for any issue, always grateful for your help but you produce instance locally not on our site. Then how this issue will get fixed? The result your are showing is clearly indicating there is no issue with the coding neither with PI or Final Invoice. Now at least guide me whom I should contact for my issue? Who will test the issue on my server and find out why it is not working? Awaiting your reply... Regards, Shubhajeet Saha -
InvoiceCreationPreEmail hook not working in WHMCS 8.1
webtechwhiz replied to webtechwhiz's topic in Developer Corner
Hi Brian, Leading 0 is important to me. I want invoice number in my given format and I can create such invoice number using core PHP, Codeigniter and in Laravel too. But here is no option available for custom coding. Hooks given are not working. If above any option is introduced in next release of WHMCS to check want leading 0 to invoice number and size of invoice then it will be very useful. But my simple question when there is no scope of custom coding and hooks are provided then why it's not working? If any option is given the should work properly. Also I should let know that client who has forgotten his account password is unable to reset his account password. At the reset page client fills his registered email id and a reset link is received. When he clocks the link it again asks for email id. No page appears to enter new password. Though I have created ticket for this but letting you know to check what is the issue with latest version WHMCS and Twenty One theme. Awaiting your reply... Regards, Shubhajeet Saha -
InvoiceCreationPreEmail hook not working in WHMCS 8.1
webtechwhiz replied to webtechwhiz's topic in Developer Corner
Hi Brian, Waiting for your reply... Regards, Shubhajeet Saha -
InvoiceCreationPreEmail hook not working in WHMCS 8.1
webtechwhiz replied to webtechwhiz's topic in Developer Corner
Hi Brian, Thanks for your reply. I'll wait for your investigation report. I have disabled Proforma Invoicing and after disabling proforma invoicing no invoice is created. Is there any hook which can format invoice number in Proforma Invoice? Searching in WHMCS hooks references but unable to find any such hook. It will be better if any such is available or can be provided. Awaiting reply... Regards, Shubhajeet Saha -
InvoiceCreationPreEmail hook not working in WHMCS 8.1
webtechwhiz replied to webtechwhiz's topic in Developer Corner
Hi Brian, Thanks for quick reply, As per your statement hook should work now. But I just tested with an order though its unpaid. Its showing invoice number as #3. Would like to know when Invoice number gets formatted with the above hook at the time of placing order or after Payment. Unpaid invoice is attached for your reference. Kindly guide me so that I can make this hook work. Awaiting for your guidance... Regards, Shubhajeet Saha Invoice-3.pdf -
InvoiceCreationPreEmail hook not working in WHMCS 8.1
webtechwhiz replied to webtechwhiz's topic in Developer Corner
Hi, I have made custom Invoice numbering off. What should be filled in format field only {number} ? Or anything else? Regards, Shubhajeet Saha -
InvoiceCreationPreEmail hook not working in WHMCS 8.1
webtechwhiz replied to webtechwhiz's topic in Developer Corner
Hi Brian, Forgot to mentioned one thing. You have replied on 10th April, 2021 but notification email received just 5 hours ago. Don't know why there was so much delay. Ideally it should trigger soon a reply is made. There should not be any waiting to get reply approved by moderator. Thanks kindly help me to find out the issue. I have explained everything in my previous reply. Regards, -
InvoiceCreationPreEmail hook not working in WHMCS 8.1
webtechwhiz replied to webtechwhiz's topic in Developer Corner
Hi Brian, There is other hooks too there in hooks folder which like customMenu.php is working fine. And custom invoice number formatting hook is also paced there only file name custominvoicenumberformat.php. I have attached screenshot. Also attached hook file in edit mode displaying the location of custominvoicenumberformat.php. I know hook will only work new invoices onwards. Also attached current Tax Configuration screenshot. Presently Custom invoice numbering is enabled. Should I turn it off? Awaiting reply... Thanks -
How to get product details in loop with product group ID
webtechwhiz replied to webtechwhiz's topic in Developer Corner
Can anyone provide me any solution to my requirement? -
InvoiceCreationPreEmail hook not working in WHMCS 8.1
webtechwhiz posted a topic in Developer Corner
Dear Team, I have created following hook for invoice number formatting: use Illuminate\Database\Capsule\Manager as Capsule; function generate_custom_invoice_number_hook($vars) { $invoiceid = $vars['invoiceid']; $customnumber = 'WTW'.date("Y").str_pad($invoiceid,5,"0",STR_PAD_LEFT); if (isset($customnumber)) { try { $updatedInvoiceNumber = Capsule::table('tblinvoices') ->where('id', $invoiceid) ->update(['invoicenum' => $customnumber,]); } catch (\Exception $e) { // Deal with error } } } add_hook("InvoiceCreationPreEmail",1,"generate_custom_invoice_number_hook"); But there is no impact on Invoice Number. Invoice is generated with default invoice number like 1,2,3,... Why invoice number is not getting updated as expected like WTW202100001, WTW202100002,WTW202100003,... as expected with using above hook? Kindly help to get desired invoice number. Regards, Shubhajeet Saha -
Hi, I am using latest Twenty-One theme of WHMCS. In landing page has following code: {foreach $productGroups as $productGroup} <div class="mb-5"> <div class=" text-center"> <h3 class="card-title pricing-card-title"> {$productGroup->name} </h3> <p>{$productGroup->tagline}</p> <a href="{$productGroup->getRoutePath()}" class="btn btn-outline-primary my-3"> {lang key='browseProducts'} </a> </div> </div> {/foreach} Which is listing all Product Groups. I want to display all products under each product groups. For that I got below code through Support. function homepage_products_hook($vars) {// print_r($vars);// $client = Menu::context('client'); $products = Capsule::table('tblproducts') ->join('tblpricing', 'tblproducts.id', '=', 'tblpricing.relid') ->select('tblproducts.*','tblpricing.*') ->where('tblpricing.type', 'product') ->where('tblproducts.hidden','0') ->where('tblproducts.gid','x') ->groupBy('tblproducts.order') ->get(); $encodedata = json_encode($products); $decodedata = json_decode($encodedata, true); return array("myproducts" => $decodedata);}add_hook("ClientAreaPageHome", 1, "homepage_products_hook"); Which is returning null array. But when I change x to 1 or 2 in ->where('tblproducts.gid','x') I get products of product group id 1 or 2 statically. I would like to know how I can get respective product group Product Details in loop. What value to be passed in place of x in ->where('tblproducts.gid','x') so that product output remains dynamic. Will appreciate a working solution. Thanks Regards, Shubhajeet Saha
-
Dear Team, When general Promotion is going on the price should be displayed after applying the available coupon available for the product & tenure in with striking off regular price in product, cart and checkout page. Am using WHMCS v8.0.4 six template and premium comparison order form (I have created custom comparison order form template by duplicating this for doing alterations). Currently it's showing min tenure regular price. How to achieve above mentioned concept with dropdown for available tenures in product page with highest tenure selected as default selection? Also how to list all product groups and products in home page template?
