X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   External address buttons & https (https://forum.x-cart.com/showthread.php?t=7666)

Ian 05-19-2004 04:05 PM

External address buttons & https
 
I may be having a dunmb moment here but can anyone help me with this problem please.

I have a couple of buttons that are linked to a "Top 50" listing site and of course they cause a problem when my site visitor switches over to the https address as they aren't directly from my site. Is there a way I can say something in the code like if using the secure address, don't show?

I have search around the forum but drawn a blank, any help would be much appriciated.

Thanks
Ian :D

Mod King 05-19-2004 04:19 PM

Code:

{literal}
<SCRIPT>
var url =  document.URL;
var re = /^https/;
if ( !url.match(re) ) {
        document.write("<A HREF=\"http://www.somesite.com/index.php\">Some link</a>");
};
</SCRIPT>
{/literal}


Try that and let me know how it goes :)

TelaFirma 05-19-2004 06:22 PM

The best way to do this is to check the port on the back end and write the URL based on the port. Using Javascript is not reliable across all browsers.

Here is an example using one of the links you have on your site...


Code:

<a href="http://www.ausscrapcentral.com.au/aschot50/in.php?id=27">
{if $smarty.server.SERVER_PORT == 443}
[img]https://www.ausscrapcentral.com.au/aschot50/button.php?id=27[/img]
{else}
[img]http://www.ausscrapcentral.com.au/aschot50/button.php?id=27[/img]
{/if}
</a>


Ian 05-19-2004 07:33 PM

Thanks for the reply :D
I have been out but I will try it later and let you know, I'm sure there are a lot of sites that could use a fix like this.

All the best
Ian

Ian 05-19-2004 08:21 PM

It's all good news!

The provider of the buttons didn't have a https address so, I saved a copy of the button to my server in the images directory. This is the cade I used in the end

Code:

<a href="http://www.ausscrapcentral.com.au/aschot50/in.php?id=27">
{if $smarty.server.SERVER_PORT == 443}
[img]{$ImagesDir}/top20.jpg[/img]
{else}
[img]http://www.ausscrapcentral.com.au/aschot50/button.php?id=27[/img]
{/if}
</a>


Thanks for all of your help its solved the problem perfectly.

Ian
:D Very Happy

shan 05-20-2004 01:10 AM

http://forum.x-cart.com/viewtopic.php?t=3811&highlight=https

theres a good link for you

Ian 05-20-2004 02:28 PM

Thanks Shan it's all been a big help.

I went for displaying a copy of the image from my site when https is in effect as most of the time people are busy checking out at that stage. I made an image with no ranking number on it for that purpose. The live image comes in fine when in http so everyone is happy :D

Thanks again

Ian


All times are GMT -8. The time now is 12:39 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.