lims Posted February 12, 2019 Share Posted February 12, 2019 haw to set custom link order to cart.php?gid=xx when No SSL Detected ? example on domain {if $domain.sslStatus} <img src="{$domain.sslStatus->getImagePath()}" data-toggle="tooltip" title="{$domain.sslStatus->getTooltipContent()}" class="{$domain.sslStatus->getClass()}"/> {elseif !$domain.isActive} <img src="{$BASE_PATH_IMG}/ssl/ssl-inactive-domain.png" data-toggle="tooltip" title="{lang key='sslState.sslInactiveDomain'}"> {/if} 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 12, 2019 Share Posted February 12, 2019 On 12/02/2019 at 07:09, lims said: how to set custom link order to cart.php?gid=xx when No SSL Detected ? there will be at least two short-term ways to do it... edit the code in the above template. edit scripts.min.js (where there URL is defined). method 2 implies that you should be able to do it via a hook (which would be a better long-term solution), but i've not been able to get it working yet... besides, now that v7.7.1 is released, I suspect there won't be any more updates, apart from hotfixes, until May 2019 and so no harm in editing the template or js files. so if you want to edit the template... {if $service.sslStatus} {if $service.sslStatus->getClass() eq "ssl-state ssl-inactive"}<a href="cart.php?gid=11">{/if}<img src="{$service.sslStatus->getImagePath()}" data-toggle="tooltip" title="{$service.sslStatus->getTooltipContent()}" />{if $service.sslStatus->getClass() eq "ssl-state ssl-inactive"}</a>{/if} {elseif !$service.isActive} <img src="{$BASE_PATH_IMG}/ssl/ssl-inactive-domain.png" data-toggle="tooltip" title="{lang key='sslState.sslInactiveService'}"> {/if} alternatively, in scripts.js (not used by WHMCS), you can change... jQuery(document).on('click', '.ssl-state.ssl-inactive', function(e) { e.preventDefault(); window.location.href = WHMCS.utils.getRouteUrl('/ssl-purchase'); }); to... jQuery(document).on('click', '.ssl-state.ssl-inactive', function(e) { e.preventDefault(); var gidvalue="11"; window.location.href = "cart.php?gid=" + gidvalue; }); minify/compress it and save it as /templates/six/js/scripts.min.js - or if you're familiar with the minified files, you could edit scripts.min.js directly... either method should work, there is no need to do both! it's probably easier to use the template edit, but I posted the js solution because it was the first one that I wrote for this and it seems a shame to let it go to waste if others want to use or improve upon it (e.g the basis of a hook). 3 Quote Link to comment Share on other sites More sharing options...
lims Posted February 12, 2019 Author Share Posted February 12, 2019 3 hours ago, brian! said: there will be at least two short-term ways to do it... edit the code in the above template. edit scripts.min.js (where there URL is defined). method 2 implies that you should be able to do it via a hook (which would be a better long-term solution), but i've not been able to get it working yet... besides, now that v7.7.1 is released, I suspect there won't be any more updates, apart from hotfixes, until May 2019 and so no harm in editing the template or js files. so if you want to edit the template... {if $service.sslStatus} {if $service.sslStatus->getClass() eq "ssl-state ssl-inactive"}<a href="cart.php?gid=11">{/if}<img src="{$service.sslStatus->getImagePath()}" data-toggle="tooltip" title="{$service.sslStatus->getTooltipContent()}" />{if $service.sslStatus->getClass() eq "ssl-state ssl-inactive"}</a>{/if} {elseif !$service.isActive} <img src="{$BASE_PATH_IMG}/ssl/ssl-inactive-domain.png" data-toggle="tooltip" title="{lang key='sslState.sslInactiveService'}"> {/if} i'm using using option 1 (template) on v7.7.1, its work prefect ..good job .. thank you on option 2, already try scripts.js get more loading to long 0 Quote Link to comment Share on other sites More sharing options...
glenn Posted February 13, 2019 Share Posted February 13, 2019 Would it be possible to make the SSL icon non-clickable at all, so there is no link behind it? It doesn't make sense to send clients to a specific page if you don't sell SSL certificates. 0 Quote Link to comment Share on other sites More sharing options...
steven99 Posted February 14, 2019 Share Posted February 14, 2019 In the above template changes, just remove the <a ....></a> and replace with the image. @brian! have you looked doing a ClientAreaProductDetailsOutput hook with javascript to do the same actions? That way updates wont need this done again. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 14, 2019 Share Posted February 14, 2019 14 hours ago, steven99 said: @brian! have you looked doing a ClientAreaProductDetailsOutput hook with javascript to do the same actions? That way updates wont need this done again. not specifically, but this occurs on the products main page, not on the details page - so that hook may not be relevant. for the details pages, I posted the hook in the thread below that nuked the array, thus solving the output problem there... in any event, I found two working solutions to this and felt that was enough for now as who knows if WHMCS are minutes/days/weeks/months away from solving this themselves! plus to be honest, coding js is not something I enjoy doing, so I avoid if whenever I can! 🙂 0 Quote Link to comment Share on other sites More sharing options...
bendrop Posted February 15, 2019 Share Posted February 15, 2019 (edited) If you don't want to make any template edits at all, you can add a couple of lines to your .htaccess file (in the root) Under line: RewriteBase / Add: # Redirect SSL Checker Link to alternate location RewriteCond %{QUERY_STRING} ^rp=/ssl-purchase$ RewriteRule ^index\.php$ cart.php?gid=SSLGROUPID [R,L] Changing SSLGROUPID to the group id of your SSL certs. Or you can enter a totally different URL / site address there and redirect to wherever you want 🙂 Edited February 15, 2019 by bendrop 1 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 15, 2019 Share Posted February 15, 2019 3 hours ago, bendrop said: Or you can enter a totally different URL / site address there and redirect to wherever you want this does work, but for me it needed the full URL to cart.php for it to do so. 0 Quote Link to comment Share on other sites More sharing options...
aquiss Posted March 3, 2019 Share Posted March 3, 2019 @brian! Which template is method 1 found in? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 3, 2019 Share Posted March 3, 2019 6 minutes ago, aquiss said: @brian! Which template is method 1 found in? it's clientareaproducts.tpl - and the code I posted is just the replacement code to use. 1 Quote Link to comment Share on other sites More sharing options...
aquiss Posted March 3, 2019 Share Posted March 3, 2019 @brian! I'm actually finding that if I use the following amended code, during the SSL detecting phase, the icon remains yellow. {if $domain.sslStatus} {if $domain.sslStatus->getClass() eq "ssl-state ssl-inactive"}<a href="cart.php?gid=addons">{/if}<img src="{$domain.sslStatus->getImagePath()}" data-toggle="tooltip" title="{$domain.sslStatus->getTooltipContent()}" />{if $domain.sslStatus->getClass() eq "ssl-state ssl-inactive"}</a>{/if} {elseif !$domain.isActive} <img src="{$BASE_PATH_IMG}/ssl/ssl-inactive-domain.png" data-toggle="tooltip" title="{lang key='sslState.sslInactiveDomain'}"> {/if} However, the original code, the SSL detection will turn the icon red/green instantly. {if $service.sslStatus} <img src="{$service.sslStatus->getImagePath()}" data-toggle="tooltip" title="{$service.sslStatus->getTooltipContent()}" class="{$service.sslStatus->getClass()}"/> {elseif !$service.isActive} <img src="{$BASE_PATH_IMG}/ssl/ssl-inactive-domain.png" data-toggle="tooltip" title="{lang key='sslState.sslInactiveService'}"> {/if} If an SSL has already detected previously, then your amended code will pull from the database recorded entry fine. Any ideas what's keeping it in a hanged/loading/detection state? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 3, 2019 Share Posted March 3, 2019 14 minutes ago, aquiss said: Any ideas what's keeping it in a hanged/loading/detection state? can you PM me a user ID where you're seeing this occurring. 0 Quote Link to comment Share on other sites More sharing options...
aquiss Posted March 3, 2019 Share Posted March 3, 2019 @brian! PM sent as requested. 0 Quote Link to comment Share on other sites More sharing options...
Jade D Posted November 8, 2019 Share Posted November 8, 2019 On 2/12/2019 at 5:34 PM, brian! said: there will be at least two short-term ways to do it... edit the code in the above template. edit scripts.min.js (where there URL is defined). method 2 implies that you should be able to do it via a hook (which would be a better long-term solution), but i've not been able to get it working yet... besides, now that v7.7.1 is released, I suspect there won't be any more updates, apart from hotfixes, until May 2019 and so no harm in editing the template or js files. so if you want to edit the template... {if $service.sslStatus} {if $service.sslStatus->getClass() eq "ssl-state ssl-inactive"}<a href="cart.php?gid=11">{/if}<img src="{$service.sslStatus->getImagePath()}" data-toggle="tooltip" title="{$service.sslStatus->getTooltipContent()}" />{if $service.sslStatus->getClass() eq "ssl-state ssl-inactive"}</a>{/if} {elseif !$service.isActive} <img src="{$BASE_PATH_IMG}/ssl/ssl-inactive-domain.png" data-toggle="tooltip" title="{lang key='sslState.sslInactiveService'}"> {/if} alternatively, in scripts.js (not used by WHMCS), you can change... jQuery(document).on('click', '.ssl-state.ssl-inactive', function(e) { e.preventDefault(); window.location.href = WHMCS.utils.getRouteUrl('/ssl-purchase'); }); to... jQuery(document).on('click', '.ssl-state.ssl-inactive', function(e) { e.preventDefault(); var gidvalue="11"; window.location.href = "cart.php?gid=" + gidvalue; }); minify/compress it and save it as /templates/six/js/scripts.min.js - or if you're familiar with the minified files, you could edit scripts.min.js directly... either method should work, there is no need to do both! it's probably easier to use the template edit, but I posted the js solution because it was the first one that I wrote for this and it seems a shame to let it go to waste if others want to use or improve upon it (e.g the basis of a hook). Thanks again Brian - this worked 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.