Jump to content

payless4domains

Member
  • Posts

    31
  • Joined

  • Last visited

About payless4domains

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

payless4domains's Achievements

Member

Member (2/3)

0

Reputation

  1. Client details and client custom fields are currently both on one page clientarea.php?action=details I would like to separate them onto 2 pages, hiding the custom fields on the clientarea.php?action=details page and being able to retrieve and update our client custom fields on a separate custom template, without affecting the clientdetails on the clientarea.php?action=details page. Creating some sort of hook. Is this possible? if so does anybody know how? Thanks in advance.
  2. Hi Guys, I’ve only noticed recently that there haven’t been any client logs in our Activity logs section via Utilities > Activity log, Clients Profile > log or on the Admin Summary screen. After looking into the logs a bit deeper I noticed that the client logs stopped around a month ago. Long story cut short… our 'Client details change notify' option had been un-ticked. In General Settings > Other, if you un-tick the option ‘Client Details Change Notify’ to stop receiving email notifications every time a user modifies their details, WHMCS appears to also turnoff the client logs completly. Is it possible the tick this option so we don’t get the email notifications, but having WHMCS keep the client logs? With the option ticked WHMCS is logging exactly what we need it to do but we don't what all the emails. Anybody have any ideas on the best way to do this? Thanks in advance
  3. Sorry Brian, the original hook was written by you (your credit logs hook) which works great as all of your suggestions are, your brilliant. I'm only learning. The not so good tweaks are my doing.
  4. Thankyou Kian and yes that worked for the emails including all values, can't believe I missed that. Cheers I also changed the 'clientid' to 'userid' and now the tickets hook is working, but the values (under debug) are different to the original supportticketlist.tpl Original values id => "78" tid => "986161" c => "EOoxJKPr" date => "07/07/2016 10:05" normalisedDate => "2016-07-07 10:05:20" department => "Customer Care" subject => "test" status => "<span style="color:#888888">Closed</s..." statusClass => "closed" statusColor => null urgency => "Medium" lastreply => "07/07/2016 10:09" normalisedLastReply => "2016-07-07 10:09:24" unread => "0" new hook values id => 78 tid => "986161" did => 1 userid => 1 contactid => 0 name => "" email => "" cc => "" c => "EOoxJKPr" date => "2016-07-07 10:05:20" title => "test" message => "test ---------------------------- IP..." status => "Closed" urgency => "Medium" admin => "" attachment => "" lastreply => "2016-07-07 10:09:24" flag => 0 clientunread => 0 adminunread => "1" replyingadmin => 0 replyingtime => "0000-00-00 00:00:00" service => "S489" So it is displaying slightly different to the original, how do I get the values to be the same as the original? So the table shows all the info not just parts. <?php # Credit Logs For Client Area # Written by brian! use Illuminate\Database\Capsule\Manager as Capsule; function hook_client_tickets($vars) { $client = Menu::context('client'); $tickets = Capsule::table('tbltickets') ->where('userid', $client->id) ->get(); $encodedata = json_encode($tickets); $decodedata = json_decode($encodedata, true); return array("tickets" => $decodedata); } add_hook("ClientAreaPage", 1, "hook_client_tickets"); ?> I'm guessing that this part of the hook needs to be changed to ?? $encodedata = json_encode($tickets); $decodedata = json_decode($encodedata, true); return array("tickets" => $decodedata); Thanks in advance.
  5. Hi Guys, I would like to merge the clientareaemails.tpl and the supportticketlist.tpl template together into a new template messages.tpl. I have the fundamentals, but can't work out the email and tickets list hook/s. Messages.php (root directory) <?php use WHMCS\ClientArea; use WHMCS\Database\Capsule; define('CLIENTAREA', true); define("FORCESSL", true); // Uncomment to force the page to use https:// require __DIR__ . '/init.php'; $ca = new ClientArea(); $ca->setPageTitle("Messages"); $ca->addToBreadCrumb('index.php', $whmcs->get_lang('globalsystemname')); $ca->addToBreadCrumb('messages.php'); $ca->initPage(); $ca->requireLogin(); // Uncomment this line to require a login to access this page # To assign variables to the template system use the following syntax. # These can then be referenced using {$variablename} in the template. $ca->assign('variablename', $value); # Check login status if ($ca->isLoggedIn()) { # User is logged in - put any code you like here # Here's an example to get the currently logged in clients first name $result = mysql_query("SELECT firstname FROM tblclients WHERE id=" . $ca->getUserID()); $data = mysql_fetch_array($result); $clientname = $data[0]; $ca->assign('clientname', $clientname); } else { # User is not logged in } # Define the template filename to be used without the .tpl extension $ca->setTemplate('messages'); $ca->output(); messages.tpl (template directory) <div class="header-lined"> <h1 style="text-align:center;">My messages</h1> </div> {include file="$template/includes/tablelist.tpl" tableName="TicketsList" filterColumn="2"} <script type="text/javascript"> jQuery(document).ready( function () { var table = $('#tableTicketsList').DataTable(); {if $orderby == 'did' || $orderby == 'dept'} table.order(0, '{$sort}'); {elseif $orderby == 'subject' || $orderby == 'title'} table.order(1, '{$sort}'); {elseif $orderby == 'status'} table.order(2, '{$sort}'); {elseif $orderby == 'lastreply'} table.order(3, '{$sort}'); {/if} table.draw(); }); </script> <div class="table-container clearfix"> <table id="tableTicketsList" class="table table-list"> <thead> <tr> <th>{$LANG.supportticketsdepartment}</th> <th>{$LANG.supportticketssubject}</th> <th>{$LANG.supportticketsstatus}</th> <th>{$LANG.supportticketsticketlastupdated}</th> </tr> </thead> <tbody> {foreach from=$tickets item=ticket} <tr onclick="window.location='viewticket.php?tid={$ticket.tid}&amp;c={$ticket.c}'"> <td class="text-center">{$ticket.department}</td> <td><a href="viewticket.php?tid={$ticket.tid}&amp;c={$ticket.c}">{if $ticket.unread}<strong>{/if}#{$ticket.tid} - {$ticket.subject}{if $ticket.unread}</strong>{/if}</a></td> <td><span class="label status {if is_null($ticket.statusColor)}status-{$ticket.statusClass}"{else}status-custom" style="border-color: {$ticket.statusColor}; color: {$ticket.statusColor}"{/if}>{$ticket.status|strip_tags}</span></td> <td class="text-center"><span class="hidden">{$ticket.normalisedLastReply}</span>{$ticket.lastreply}</td> </tr> {/foreach} </tbody> </table> </div> <div class="header-lined"> <h1 style="text-align:center;">Email history</h1> </div> {include file="$template/includes/tablelist.tpl" tableName="EmailsList" noSortColumns="-1"} <script type="text/javascript"> jQuery(document).ready( function () { var table = $('#tableEmailsList').DataTable(); {if $orderby == 'date'} table.order(0, '{$sort}'); {elseif $orderby == 'subject'} table.order(1, '{$sort}'); {/if} table.draw(); }); </script> <div class="table-container clearfix"> <table id="tableEmailsList" class="table table-list"> <thead> <tr> <th>Date</th> <th>Subject</th> <th>&nbsp;</th> </tr> </thead> <tbody> {foreach from=$emails item=email} <tr onclick="popupWindow('viewemail.php?id={$email.id}', 'emailWin', '650', '450')"> <td class="text-center"><span class="hidden">{$email.normalisedDate}</span>{$email.date}</td> <td>{$email.subject}</td> <td class="text-center"><input type="button" class="btn btn-primary btn-sm" value="View" onclick="popupWindow('viewemail.php?id={$email.id}', 'emailWin', '650', '450')" /></td> </tr> {/foreach} </tbody> </table> </div> emaillist.php / ticketslist.php (hooks directory) - doesn't work <?php # Credit Logs For Client Area # Written by brian! use Illuminate\Database\Capsule\Manager as Capsule; function hook_client_emails($vars) { $client = Menu::context('client'); $emails = Capsule::table('tblEmailsList') ->where('clientid', $client->id) ->get(); $encodedata = json_encode($emails); $decodedata = json_decode($encodedata, true); return array("emails" => $decodedata); } add_hook("ClientAreaPage", 1, "hook_client_emails"); ?> <?php # Credit Logs For Client Area # Written by brian! use Illuminate\Database\Capsule\Manager as Capsule; function hook_client_tickets($vars) { $client = Menu::context('client'); $tickets = Capsule::table('tbltickets') ->where('clientid', $client->id) ->get(); $encodedata = json_encode($tickets); $decodedata = json_decode($encodedata, true); return array("tickets" => $decodedata); } add_hook("ClientAreaPage", 1, "hook_client_tickets"); ?> Any help would be appreciated. Thanks in advance. Kev
  6. Brian, I just had a reply from a WHMCS ticket. And this has put another spin on things. We have worked though the first part of this, but here's another idea. Any idea on how this could be written, and would this be a better way to do things?
  7. Thanks again Brian for your wisdom, Quote from the above link: “If a customer was allowed to edit the fields at a later date from the client area, your admins or staff wouldn't know it had been done so not sure what it would achieve?” I understand this is an unusual case, but as I said earlier the information that we need our clients to enter into these fields are more client related. To be more pacific the data that is entered into the fields are dates and reference no’s and these details need to updated by the client at different times during the year. Our reports do the rest, this is why we were using client custom fields, which works fine, as a new client, until we realised that client custom fields didn’t save in the cart for an existing client if they were to purchase a new product that required the additional information. So thinking along the lines of being technically possible, using the {debug} on the following pages I can see that custom fields are listed with the input function: Configureproduct.tpl - $customfields Viewcart.tpl - $customfields and/or $products Clientareadetails.tpl – only client $customfields Clientproductdetails.tpl - $customfields and/or $productcustomfields If we were to convert our existing client fields to product fields, we will still need our clients to edit these within their client area. So we need a way to update the DB with information entered into the product custom fields. Do you know a possible way that we could this? Logically it looks as if it could be done on the Clientproductdetails.tpl but there is no current way of submitting the info, on the other hand on the Clientareadetails.tpl you can submit but this only updates client custom fields. Hmmm And another thought, the viewcart.tpl has both $customfields and $product.customfields listed in the var, so could the configureproduct.tpl page be skipped and the product configuration be entered directly in to the viewcart calling the available var? To shorten the order process. Thanks again Kev
  8. Agreed, Looks like I'm going to have to use product custom fields in the cart and client. I can see a problem with that also, I need to be able to let the clients edit some of the product custom fields from their client area i.e. clientareaproductdetails page, once again I can view them but don't know how to have it save, as you can on the clientareadetails page with the client custom fields. Bit of a catch twenty two Any ideas? can it be submit using a form? hmmm head hurts. Kev
  9. Hi DigitalWarrior, You could try this by saving it in your hooks folder and naming as myproducts.php, changing the case, info sections to your product info and removing my notes. I haven't tested it but is should work. Hopefully I've understood you correctly to what you are after. <?php add_hook( 'ClientAreaPage', 1, function( $vars ) { $user = Menu :: context( 'client' ); $data = array( 'showproductdata' => false ); if (! $user ) return $data; $products = localAPI( 'getclientsproducts', array( 'clientid' => $user->getAttribute( 'id' ), ), 'admin' ); if (! $products || $products['result'] != 'success' || $products['totalresults'] == 0 || count( $products['products'] ) == 0 ) return $data; $data['showproductdata'] = true; $product = $products['products']['product'][0]; $info = null; $title = $product['translated_name']; switch( $product['pid'] ) : case '1' : //change to the 1st product id $info = 'productname1'; //change to the product name break; case '2' : //change to the 2nd product id $info = 'productname2'; //change to the product name break; case '3' : //change to the 3rd product id $info = 'productname3'; //change to the product name break; endswitch; $data['myproduct'] = array( 'info' => $info, 'title' => $title); return $data; });
  10. Thanks for your reply Brian, You explain things so much better than I do, and I can understand exactly what you are talking about. And yes it makes sense that the custom client fields are used to generate a new client account and that if they're not logged in, they're not a client and so a new record in the database needs to be created for their order. The thing is, depending on the product that is being purchased by our new (loggedout) or our existing (loggedin) clients, is to what extra client details we need, I am aware that these probably and should be added as custom product fields but I was trying to avoid using custom product fields, for one they generate an extra page for the client to full in i.e. configureproduct.tpl, we could possibly try to skip the configureproduct template during the order process (if there was a way to do this) and maybe include it in the viewcart.tpl e.g. using something like {include file="configureproduct.tpl} But the main reason behind not using product custom fields and needing to be able to edit and save client custom fields as an existing client in the cart as you can as a new client, are the reports & some of our add-on modules that our system require are using custom client detail fields. Plus the details we require are more client related than product. Having the same ability on the cart page to add some individual custom client fields that update the database as the clientareadetails page does would solve our issue; this is why I was asking if there was a hook out there that could let use access the customfields var . Even though I didn’t explain it to well, hope I have now. Yeah I can understand the confusion here; I shouldn’t have used ‘Date of birth’ as an example. Yeah found this one out, after days of trying to get it working.
  11. This seems to be an un-answered, long time WHMCS client custom fields cart question. I've searched the net, tried to ask WHMCS support to no avail (just got run around in circles) From what I have found out is when loggedin the only access you have to the client custom fields is via the $clientsdetails.customfields var which allows you to use the id and value only. This can not have any direct input from the user. (I could be wrong) What is needed is the clients custom field to display and to be editable in the cart the same as when the client is loggedout, and from my understanding this can only be done using the $customfields var. The $customfields var is populated, using {debug} when loggedout but when loggedin the $customfields var is there but unpopulated, which is why when loggedout the code works fine. {foreach key=num item=customfield from=$customfields} {if $customfield.name eq "Date of birth"} <div class="col-sm-6 form-horizontal"> <div class="form-group"> <label for="inputDateofbirth" class="col-md-4 control-label" style="font-size:.85em;">Date of birth</label> <div class="col-md-8"> <div class="control">{$customfield.input|replace:'>':"placeholder='e.g. dd/mm/yyyy' style='font-size:.85em;' >"}</div> </div> </div> </div> {/if} {/foreach} Does anybody know if there is a hook or something to solve this? This should be just a simple exercise, it makes no sense that a client custom field can be edited loggedout, but can't be once a user has loggedin.
  12. Thank you and got this one solved. but again it does work when logged in. <script> $(function() { $("#stateselect").on("change",function() { $(".hideable").hide(); var id = "#state"+(this.selectedIndex+1); $(id).show(); }).change(); }); </script> <style> .hideable { display:none } </style> <div id="state1"></div> <div id="state2" class="hideable"> {foreach key=num item=customfield from=$customfields} {if $customfield.name eq "ACT"} <div class="panel input-panel authorisation"> <div class="panel-input"> {$customfield.input} </div> </div> {/if} {/foreach} </div> Thanks again Guys
  13. Hi Brain, Thank you for your reply. Yes, and the value is correct. Are you suggesting more like this? I haven't tested it, just seeing if I understand you correctly. {foreach key=num item=customfield from=$customfields} {if $loggedin} <div class="col-sm-6 form-horizontal"> <div class="form-group"> <label class="col-md-4 control-label" style="font-size:.85em;">Date of birth</label> <div class="col-md-8"> <input type="text" value="{$clientsdetails.customfields29}" class="form-control" placeholder="e.g. dd/mm/yyyy"> </div> </div> </div> {else} {if $customfield.name eq "Date of birth"} <div class="col-sm-6 form-horizontal"> <div class="form-group"> <label for="inputCity" class="col-md-4 control-label" style="font-size:.85em;">Date of birth</label> <div class="col-md-8"> <div class="control">{$customfield.input|replace:'>':"placeholder='e.g. dd/mm/yyyy' style='font-size:.85em;' >"}</div> </div> </div> </div> {/if} {/if} {/foreach} The issue I'm experiencing is the original foreach statement I posted works fine when outside the login area, but not inside. I'm needing to get the same result when the client has logged in. {foreach key=num item=customfield from=$customfields} {if $customfield.name eq "Date of birth"} <div class="col-sm-6 form-horizontal"> <div class="form-group"> <label for="inputCity" class="col-md-4 control-label" style="font-size:.85em;">Date of birth</label> <div class="col-md-8"> <div class="control">{$customfield.input|replace:'>':"placeholder='e.g. dd/mm/yyyy' style='font-size:.85em;' >"}</div> </div> </div> </div> {/if} {/foreach} The ifloggedin statement is passing the clientdetails to the correct field on the clientarea cart if you type it in directly in the the clientaredetails page, this is not the result that we are looking for. so I believe that I going down the wrong track, just need the above code function to work both loggedout and loggin. {if $loggedin} <div class="col-sm-6 form-horizontal"> <div class="form-group"> <label class="col-md-4 control-label" style="font-size:.85em;">Date of birth</label> <div class="col-md-8"> <input type="text" value="{$clientsdetails.customfields29}" class="form-control" placeholder="e.g. dd/mm/yyyy"> </div> </div> </div> {/if} Hope this makes sense. Thnaks again.
  14. Hi Guys, I've added a client custom field to out cart, but when logged in it is not passing the entered information to the admin side. Works fine for a new client signing up. Looks fine if an existing client fills in the information from within their clientarea cart, but the entered information is not passed on to admin. What am I missing? Thanks in advance. {if $loggedin} <div class="col-sm-6 form-horizontal"> <div class="form-group"> <label class="col-md-4 control-label" style="font-size:.85em;">Date of birth</label> <div class="col-md-8"> <input type="text" value="{$clientsdetails.customfields29}" class="form-control" placeholder="e.g. dd/mm/yyyy"> </div> </div> </div> {else} {foreach key=num item=customfield from=$customfields} {if $customfield.name eq "Date of birth"} <div class="col-sm-6 form-horizontal"> <div class="form-group"> <label for="inputCity" class="col-md-4 control-label" style="font-size:.85em;">Date of birth</label> <div class="col-md-8"> <div class="control">{$customfield.input|replace:'>':"placeholder='e.g. dd/mm/yyyy' style='font-size:.85em;' >"}</div> </div> </div> </div> {/if} {/foreach} {/if}
  15. Hi Guys, My issue is the states dropdown menu on the vieworders page. not an issue I just need it to be able to display a new option further down the page depending on the original option selected before the form has been submitted. i.e dropown <div class="form-group"> <label for="inputState" class="col-md-4 control-label">{$LANG.clientareastate}</label> <div class="col-md-8"> <input type="text" name="state" id="inputState" value="{$clientsdetails.state}" class="form-control"{if $loggedin} disabled="disabled"{/if} /> </div> </div> States - Queensland - NSW - ETC What I'm trying to achieve is: If a client selects value "Queensland" I need a new custom field to show further down the page, that relates to Queensland If a client selects value "NSW" I need a different custom field to show in the same spot further down the page. I've tried: {foreach $values as $value} {if $value = "Queensland"} Queensland {elseif $value = "NSW"} do action {elseif $value = c} do action {/if} {/foreach} This is the code that goes down the page for "Queensland", but now needs to link to "Queensland" when selected and then there will be others for the other selections, I just can't get my head around how I can link via selection without sumbiting the form and then using the clientsdetails.state {if $loggedin} <div class="line-padded" style="float:right;"> <div class="col-md-12"> <input type="checkbox" name="ctp" id="ctp" value="{$clientsdetails.customfields21}" checked> Yes, Transfer my CTP insurance to RACQ </div> </div> {/if} {foreach key=num item=customfield from=$customfields} {if $customfield.name eq "CTP Insurance"} <div class="line-padded" style="float:right;> <div class="col-md-12"> <div class="control">{$customfield.input|replace:'>':"checked>"} Yes, Transfer my CTP insurance to RACQ </div> </div> </div> {/if} {/foreach} another way to explain what I am trying to do: (doesn't work though} {if $clientsdetails.state eq selected "Queensland"} show the Queensland tickbox above {elseif $clientsdetails.state eq selected "NSW"} then show the NSW tick box {elseif .... etc} another tick box {/if} Really appreciate your help in advance. Thanks Kev
×
×
  • 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