Jump to content

Set Custom Link order On SSL


lims

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}

 

Link to comment
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

Link to comment
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

Link to comment
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! 🙂

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

  • 3 weeks later...

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

Link to comment
Share on other sites

  • 8 months later...
On 2/12/2019 at 5:34 PM, 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}

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 again Brian - this worked

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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