Jump to content
lims

Set Custom Link order On SSL

Recommended Posts

haw to set custom link order to cart.php?gid=xx when  ssl-inactive.png.fa4f8afded30281575c9f6d57ae296f6.png 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}

 

Share this post


Link to post
Share on other sites
On 12/02/2019 at 07:09, lims said:

how to set custom link order to cart.php?gid=xx when  ssl-inactive.png.fa4f8afded30281575c9f6d57ae296f6.png No SSL Detected ?

there will be at least two short-term ways to do it...

  1. edit the code in the above template.
  2. 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.png

  • Thanks 1

Share this post


Link to post
Share on other sites
3 hours ago, brian! said:

there will be at least two short-term ways to do it...

  1. edit the code in the above template.
  2. 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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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. 

Share this post


Link to post
Share on other sites
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! 🙂

Share this post


Link to post
Share on other sites

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 by bendrop
  • Thanks 1

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

  • Like 1

Share this post


Link to post
Share on other sites

@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?
 

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

By using this site, you agree to our Terms of Use & Guidelines