2017-08-26 138 views
0

我啓用SSL對我的Prestashop 1.6:如何更改HTTP到HTTPS在的Prestashop 1.6加入購物車

Preferences > General > Enable SSL 
Preferences > General > Enable SSL on all pages 

在.htaccess我用下面的代碼:

RewriteCond %{HTTPS} off 
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] 

# ~~start~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again 

一切看起來不錯,但在網頁頁面源代碼仍然看到:

<a class="button ajax_add_to_cart_button btn btn-default" href="http://www.myeshop.com/cart?add=1&amp;id_product=9&amp;token=2db68311c3192a52b4eca5bc1b2c218f" rel="nofollow" title="Add to cart" data-id-product="9"> <span>Add to cart</span> </a> 

href鏈接加入購物車按鈕指向http而不是https。 你能幫我嗎? Registers Jan

回答

1

你應該看看smarty模板,看看類或控制器是否被覆蓋。

至少你可以用一些糾正,使用Javascript,如:

$(document).ready(function() 
{ 

    $('.ajax_add_to_cart_button').each(function() { 
       var href = $(this).attr('href'); 
       href = href.replace('http:', 'https:'); 
       $(this).attr('href', href); 
     }); 

});  

但它僅適用於測試模式不生產,由於安全! 請閱讀此主題: Change all occurrences of "http" to "https" on a wordpress page

+0

感謝Melvita爲您的快速響應。我把你的源代碼放到'themes/my_theme/js/modules/blockcart/ajax-cart.js'中。當我在我的谷歌瀏覽器中使用_Inspect_時,我在_Add to cart_ button中看到https。但是,如果我顯示所有的網頁源代碼,我仍然看到http而不是https:( – JanZitniak

+0

是的,因爲我告訴你這是一個讓你找到更好的解決方案的訣竅,Javascript不是你問題的最佳答案。如果你看到http的源代碼,當你在執行Js之前看到源代碼時,可能會發生這種情況,但是你需要再次糾正它,而不需要Js,很抱歉,如果沒有源代碼和代碼,它很難給出更多的建議,希望你找到一個solution.cheers – Melvita

相關問題