payless4domains
Member-
Posts
31 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Hotfixes
Everything posted by payless4domains
-
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.
-
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
-
Email list hook for all ClientareaPages
payless4domains replied to payless4domains's topic in Developer Corner
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. -
Email list hook for all ClientareaPages
payless4domains replied to payless4domains's topic in Developer Corner
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. -
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}&c={$ticket.c}'"> <td class="text-center">{$ticket.department}</td> <td><a href="viewticket.php?tid={$ticket.tid}&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> </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
-
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
-
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
-
Extenrnal API: Get product by name
payless4domains replied to DigItalWarrior's topic in Developer Corner
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; }); -
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.
-
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.
-
States dropdown if else statement needed, pls
payless4domains replied to payless4domains's topic in Developer Corner
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 -
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.
-
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}
-
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
-
Extract from http://docs.whmcs.com/Customising_the_Six_Theme There are two sidebars in WHMCS’ client area. The primary sidebar contains sidebar elements that are displayed above the body content when in responsive mode. The secondary sidebar contains sidebar elements that are displayed below the body content when in responsive mode. In desktop mode, there will be no noticeable difference between primary and secondary sidebar items. • The secondary side bar does not show below the body content. It shows below the primary sidebar. Does anyone know how to have it show at the bottom of the page, below the body content when in responsive mode?
-
Thanks Brian, That works excellent on all of the clientarea pages. I use a hook on all loggedin pages, clientarea.php and any other ones to show clients product data, can we link this hook in with that one so that the client's balance shows on all loggedin pages? as I understand that the reason that the above code doesn't show on cart pages,ticket pages or any custom pages etc is that the product id syntax is not linked to those pages. This is the hook to show clients product data. <?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']; $status = $product['status']; switch( $product['pid'] ) : case '70' : $info = 'membership'; break; endswitch; $data['myproduct'] = array( 'info' => $info, 'title' => $title, 'status' => $status); return $data; });
-
Hi brian & sentq, Sorry for the confusion. And correct Brian "do you want the credit sidebar to be shown if the client has a specified product" My clients are asking that if they have $allowedProductsId = array(70); (specified product),can they see their credit balance on all of their clientarea.php?,submitticket.php?,knowledgebase.php?(basiclly all loggedin pages) instead of just being able to see it on their clientarea.php?action=productdetails&id=70 page. Thank you Sentq for posting the newly modified code, I think we are close to what I'm after but the code still only shows on the clientarea.php?action=productdetails&id=70 and not their other loggedin pages, due to my poor explanation at the start, is it possible to show on their pages? Thanks again guys, Kev
-
Thank you Sentq, this has been working perfectly on our clientsproductdetails.tpl page. I've had clients recently asking if they can also see it on their other client pages, go figure. So I was just wondering can this code be modified so that if the client has the product id, can the $services.product be allowed to be shown on all the clients pages. Only if they have one of the allowedproductids. <?php /** * Display Client's Credit Balance in Client Area * * @author WHMCMS * @link www.whmcms.com * @since WHMCS v6.0.0+ */ use WHMCS\View\Menu\Item as MenuItem; use Illuminate\Database\Capsule\Manager as Capsule; # Add Balance To Sidebar if (App::getCurrentFilename() == 'clientarea') { add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar){ $filename = basename($_SERVER['REQUEST_URI'], ".php"); $parseFile = explode('.', $filename); $client = Menu::context("client"); $clientid = intval($client->id); if ($parseFile['0']!=='clientarea' || $clientid===0){ return; } $allowedinproductids = array(70); $productInfo = Menu::context("service"); if (!in_array($productInfo->packageid, $allowedinproductids)){ return; } $primarySidebar->addChild('Client-Balance', array( 'label' => "Account Balance", 'uri' => '#', 'order' => '1', 'icon' => 'fa-university' )); # Get Currency $getCurrency = Capsule::table('tblcurrencies')->where('id', $client->currency)->get(); # Retrieve the panel we just created. $balancePanel = $primarySidebar->getChild('Client-Balance'); // Move the panel to the end of the sorting order so it's always displayed // as the last panel in the sidebar. $balancePanel->moveToFront(); $balancePanel->setOrder(0); # Add Balance. $balancePanel->addChild('balance-amount', array( 'uri' => '#', 'label' => '<h4 style="text-align:center;">'.$getCurrency['0']->prefix.$client->credit.' '. $getCurrency['0']->suffix.'</h4>', 'order' => 1 )); }); } Thanks again in advance. Kev
-
Adding an individual custom product field to cart
payless4domains posted a topic in Developer Corner
Hi Guys, I have added this code to our cart, and I thought I had it right as it looks fine on both the logged in client area cart and the logged out client area. But, when I tested it, Logged out - everything seems to work, you can enter in the info and it goes through to the payment gateway, but it doesn't pass on the information in the product custom fields to back end admin. Logged in - again you can enter the info, but this time when you click on submit to go to the payment gateway nothing happens. Can anyone help me out here, I would have thought this would work, but I'm missing something. Thanks in advance. <div class="col-sm-4 col-xs-12"> {foreach key=num item=product from=$products} {if $product.productinfo.name eq "custom name"} {if $loggedin} <div class="form-group"> <label class="control-label">custom name</label> <input required placeholder="e.g. 400FOS" type="text" value="{$customfields[1].value}" class="form-control"> </div> {else} {foreach key=custnum item=customfields from=$product.customfields} {if $customfields.name eq "custome name"} <div class="form-group"> <label class="control-label">custom name</label> <div class="control">{$customfield.input|replace:'<input ':'<input required placeholder="e.g. 400FOS"'} </div> </div> {/if} {/foreach} {/if} {/if} {/foreach} </div> -
Thank you all fixed. On another topic, this should also be easy, I've manually added custom fields to our cart.tpl but I would like to make some of them required fields. I've tried {$required} and {{customfield.required} but neither work, I can't seem to find the answer to this anywhere. {foreach key=num item=customfield from=$customfields} {if $customfield.name eq "SMS Number"} <div class="form-group"> <label class="control-label">SMS Mobile No (e.g. +61 412345678)</label> <div class="control">{$customfield.input} {$required} </div> </div> {/if} {/foreach}
-
The custom fields are Client custom fields, there is a long story to this one. They can't be product custom fields. But the issue I'm having is I need to add an {if} statement that shows the appropriate client custom field in relation to the order the product has been purchased, as in the i.e. above. Any idea's? Thanks again for your time.
-
On the clientareaproductdetails.tpl I have a conditional statement that I can't get my head around, using the clients serviced/id. Scenario Customer has purchased 4 of the same products with the same pid/name (let’s call the product – Test). This product has been setup that the 1st time they purchase this product in the cart they fill in custom field (1 & 2), the 2nd time they purchase the product, custom field (3 & 4), the 3rd time purchase the product custom field (5 & 6) and the 4th custom field (7 & The custom fields are dates and reference numbers. I need to be able to show the individual custom fields on the clientareaproductdetails.tpl. The problem is that, and this is what I can’t get my head around, I can’t find a way to call the service ID and allocate the fields needed for that service ID, do I need a hook to do this? And if so does someone have one that will do the trick? Knowing that the service id will always change, I can’t just put a figure. i.e. Purchase 1 - Test, show custom field 1 & 2 Purchase 2 - Test, show custom field 3 & 4 Purchase 3 - Test, show custom field 5 & 6 Purchase 4 - Test, show custom field 7 & 8 Does this make sense? {if $serviceid == '(4th product purchased)'} <input type="text" name="" id="" value="{$clientsdetails.customfields8}" class="form-control" disabled/> <input type="text" name="" id="" value="{$clientsdetails.customfields7}" class="form-control" disabled/> {elseif $serviceid == '(3rd product purchased)'} <input type="text" name="" id="" value="{$clientsdetails.customfields6}" class="form-control" disabled/> <input type="text" name="" id="" value="{$clientsdetails.customfields5}" class="form-control" disabled/> {elseif $serviceid == '(2nd product purchased)'} <input type="text" name="" id="" value="{$clientsdetails.customfields4}" class="form-control" disabled/> <input type="text" name="" id="" value="{$clientsdetails.customfields3}" class="form-control" disabled/> {elseif $serviceid == '(1st product purchased)'} <input type="text" name="" id="" value="{$clientsdetails.customfields2}" class="form-control" disabled/> <input type="text" name="" id="" value="{$clientsdetails.customfields1}" class="form-control" disabled/> {/if} Thanks again Kev
