Jump to content

Smarty's $link->getPageLink() gives me always SSL!


Recommended Posts

Hello,

I have very strange problem. In my tpl files of blockcms module and blocktags module I have $link->getPageLink() functions, which always result with ssl versions of links. The second parameter should be responsible for this, right?

I am passing it like this:
 

<a href="{$link->getPageLink($contact_url, null)|escape:'html'}" title="{l s='Contact us' mod='blockcms'}">{l s='Contact us' mod='blockcms'}</a>

or

<a href="{$link->getPageLink('search', null, NULL, "tag={$tag.name|urlencode}")|escape:'html'}" title="{l s='More about' mod='blocktags'} {$tag.name|escape:html:'UTF-8'}" class="{$tag.class} {if $smarty.foreach.myLoop.last}last_item{elseif $smarty.foreach.myLoop.first}first_item{else}item{/if}">{$tag.name|escape:html:'UTF-8'}</a>

I couldn't find place where smarty's $link is assigned to php's $link, and I assumed it's done somewhere in global scope. In prestashop's link.php I traced all the way this second parameter's going, and all I found is dependency on PS_SSL_ENABLED_EVERYWHERE table in configuration. In my configuration there's nothing like that.

 

I want to get rid of https on these links :( help

Link to comment
Share on other sites

1. Yes, SSL is enabled of course.

2. No, in my panel there is no option like this. Does multistore have something to do with accessibility of this option?

This is associated with PS_SSL_ENABLED_EVERYWHERE in configuration in database, right? As I said, there is no table like this in my database.

Link to comment
Share on other sites

2. No, in my panel there is no option like this. Does multistore have something to do with accessibility of this option?

 

In PS v1.6.0.9 this option is there.  multistore should have nothing to do with it

 

This is associated with PS_SSL_ENABLED_EVERYWHERE in configuration in database, right? As I said, there is no table like this in my database.

 

the database table is "ps_configuration".  Inside that table would be a row whose 'name' is 'PS_SSL_ENABLED_EVERYWHERE'

Link to comment
Share on other sites

Yes, I meant ps_configuration table. Thank you for your attention.

 

On my live store it looks like this:

in ps_configuration there is no PS_SSL_ENABLED_EVERYWHERE, and when I click Please click here to use HTTPS protocol before enabling SSL on Preferences -> General, there is first a warning from my browser about SSL certificate (this is cheap certificate issued for only one of my stores, and I use multistore. Also I access admin panel from domain of shop with NO ssl certificate);

then, when redirected to ssl admin, there is only one option: ENABLE SSL, which works fine in context of my shop which has issued certificate.

 

Hovewer, if there is no PS_SSL_ENABLED_EVERYWHERE Configuration::get('PS_SSL_ENABLED_EVERYWHERE'equals to 0, is that right?

protected function getBaseLink($id_shop = null, $ssl = null)
	{
		static $force_ssl = null;
		
		if ($ssl === null)
		{
			if ($force_ssl === null)
				$force_ssl = (Configuration::get('PS_SSL_ENABLED') && Configuration::get('PS_SSL_ENABLED_EVERYWHERE'));
			$ssl = $force_ssl;
		}

		if (Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE') && $id_shop !== null)
			$shop = new Shop($id_shop);
		else
			$shop = Context::getContext()->shop;

		$base = (($ssl && $this->ssl_enable) ? 'https://'.$shop->domain_ssl : 'http://'.$shop->domain);

		return $base.$shop->getBaseURI();
	}
Link to comment
Share on other sites

Hovewer, if there is no PS_SSL_ENABLED_EVERYWHERE Configuration::get('PS_SSL_ENABLED_EVERYWHERE'equals to 0, is that right?

 

It would equate to false

 

When you are using the back office to configure, what Context have you selected?  The context is the multi-store select box at the top of the page.  Did you leave it as All?  Or did you select a specific store or group?

Edited by bellini13 (see edit history)
Link to comment
Share on other sites

In context of All Shops SSL is disabled. In shop with purchased certificate this option is overriden, SSL is enabled. For my other store, which does not have SSL certificate, option is left as disabled, same in Group: Default context.

 

Thanks to your post I discovered how to make "Force SSL on all pages" appear. It happens when I enable SSL in All Shops context. Now it's visible in database. Not much use for me though.

 

@EDIT: Maybe some sort of smarty debugging would be useful here. I'll try to follow this guide.

 

 

I also tried using smarty's regex_replace and replace called on ssl part of link. I'm desperate.

Maybe this is related to url rewriting?

 

 

@EDIT2: I DID IT.

This was easy and I am stupid. Blocktags module's .tpl was overriden inside my_template/modules/blocktags

Changes applied there result with http links :D

Thank you Bellini for interest and help, you're great.

Edited by khejit68 (see edit history)
Link to comment
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
×
×
  • Create New...