Jump to content

How to make $link_conditions with SSL link


Recommended Posts

Hello

I have an SSL problem in order steps select carrier. SSL works fine but when user click on read link for terms and conditions pop up shows and it gives links with out ssl and cause yellow warning in browser.

How can I make this link with ssl. I guess its about $link_conditions but dont know what to change. I am using 1.3.7

 

In order.php around line 377

$cms = new CMS(3, intval($cookie->id_lang));
$link_conditions = $link->getCMSLink($cms, $cms->link_rewrite);
if (!strpos($link_conditions, '?'))
	$link_conditions .= '?content_only=1&TB_iframe=true&width=450&height=500&thickbox=true';
else
	$link_conditions .= '&content_only=1&TB_iframe=true&width=450&height=500&thickbox=true';
if (!isset($checked) OR intval($checked) == 0)
	$checked = intval(Configuration::get('PS_CARRIER_DEFAULT'));
$smarty->assign(array(
	'checkedTOS' => intval($cookie->checkedTOS),
	'recyclablePackAllowed' => intval(Configuration::get('PS_RECYCLABLE_PACK')),
	'giftAllowed' => intval(Configuration::get('PS_GIFT_WRAPPING')),
	'conditions' => intval(Configuration::get('PS_CONDITIONS')),
	'link_conditions' => $link_conditions,
	'recyclable' => intval($cart->recyclable),
	'gift_wrapping_price' => floatval(Configuration::get('PS_GIFT_WRAPPING_PRICE')),
	'carriers' => $resultsArray,
	'HOOK_EXTRACARRIER' => Module::hookExec('extraCarrier', array('address' => $address)),
	'checked' => intval($checked),
	'total_wrapping' => Tools::convertPrice($wrapping_fees_tax_inc, new Currency(intval($cookie->id_currency))),
	'total_wrapping_tax_exc' => Tools::convertPrice($wrapping_fees, new Currency(intval($cookie->id_currency)))));
Tools::safePostVars();
$css_files = array(__PS_BASE_URI__.'css/thickbox.css' => 'all');
$js_files = array(__PS_BASE_URI__.'js/jquery/thickbox-modified.js');
require_once(dirname(__FILE__).'/header.php');
$smarty->display(_PS_THEME_DIR_.'order-carrier.tpl');

 

and order-carrier.tpl code is

 

{if $conditions}
<h3 class="condition_title">{l s='Terms of service'}</h3>
<p class="checkbox">
	<input type="checkbox" name="cgv" id="cgv" value="1" {if $checkedTOS}checked="checked"{/if} />
	<label for="cgv">{l s='I agree with the terms of service and I adhere to them unconditionally.'}</label> <a href="{$link_conditions}" class="thickbox">{l s='(read)'}</a>
</p>
{/if}

Link to comment
Share on other sites

Not sure if this will help you (I don't have 1.3.7) but there are some places where I see:

 

 

$domain = (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://').$domain;

 

Basically, gets global var whether or not SSL is enabled (in back office) and then decides to prepend http or https accordingly. Maybe this will help you?

Link to comment
Share on other sites

Thanks j-rel but I could not find it.

 

Below the code I need to change from order.php I am using 1.3.7. As you can see $link_conditions get link from cms but this pop up does not include SSL so it gives me warning error. It is quite important since prestashop is e-business shop and ssl management is its core issue.

Since 1.4 comes up 1.3 support becames less important it seems. I hope someone give me a hand for this.

Thanks

	$cms = new CMS(3, intval($cookie->id_lang));
$link_conditions = $link->getCMSLink($cms, $cms->link_rewrite);
if (!strpos($link_conditions, '?'))
	$link_conditions .= '?content_only=1&TB_iframe=true&width=450&height=500&thickbox=true';
else
	$link_conditions .= '&content_only=1&TB_iframe=true&width=450&height=500&thickbox=true';
if (!isset($checked) OR intval($checked) == 0)

Link to comment
Share on other sites

  • 2 years later...

This is an interesting bug, and it appears to go way back a few years, and still exists in the latest version 1.5.6.0.   Searching around, I found this solution:

 

http://stackoverflow.com/questions/13888321/prestashop-content-only-link-not-working

 

but then, this reversal of the solution was submitted to the source code tree, breaking the conditions display at https: checkout again:

 

https://github.com/PrestaShop/PrestaShop/pull/330

 

I think a proper solution would be to edit the following files in controllers\front:

 

OrderOpcController.php and ParentOrderController.php

find the line

$link_conditions = $this->context->link->getCMSLink($cms, $cms->link_rewrite );

and change it to

$link_conditions = $this->context->link->getCMSLink($cms, $cms->link_rewrite, Configuration::get('PS_SSL_ENABLED') );

This will work for both shops with ssl and without. Note: I haven't tested this with the Opc style checkout.

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

  • 2 weeks later...
  • 7 months later...

prestashop 1.6.0.8

 

I Found the solution without modify anything in the presta files.

 

enable ssl and force the ssl on all pages but uncheck html purifier library (very important). you could enable it after insert the image.

 

then go on CMS (exemple: about us) the image who's already there when you install prestashop work well even in ssl so you have to copy how they wrote the code. 

 

<img title="cms-img" src="../img/cms/cms-img.jpg" alt="cms-img" width="370" height="192" />

 

replace by your name image 

 

<img title="your name image" src="../img/cms/your name image.jpg" alt="your name image" width="370" height="192" />

 

write this way on the little popup window [insert/edit image] right after uploaded and chose the image from your file manager.

 

 source             ../img/cms/your name image.jpg

 image description   ....

 dimensions             ...

 

Save it and go to enable the html filter purifier if you done to put new images.

Now it should work. your image is here and your page is still SSL.

 

ps: you'll have to disable html purifier library every time you need to add a new picture from your file manager otherwise it will appear this famous question mark instead of the image and your page won't be SSL

 

It tooks 2weeks to found that, I hope you'll appreciate this post. That's the most annoying bug on prestashop, I don't even know why the Presta team didn't fix that so far!!!!????

 

 

I still have a problem with the homeslider who's disappear when running on Safari, need to refresh the page every time I come back on the home page!!! if somebody have the Solution I'll appreciate to know it ;) thanks

 

vince

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...