batman42ca Posted January 1, 2014 Share Posted January 1, 2014 (edited) When I add an item to the shopping cart, then view the cart (which puts me in https mode) the images in the Top Mega Menu don't display anymore. Any ideas? My web site is http://thevacuumstore.ca Edited January 4, 2014 by batman42ca (see edit history) Link to comment Share on other sites More sharing options...
Sharak Posted January 1, 2014 Share Posted January 1, 2014 It's custom module so it's hard to find solution without module's files. I assume it's not free and probably code is encrypted. If not, try to find in module's .tpl file the part responsible for loading image and copy it to this thread. Link to comment Share on other sites More sharing options...
batman42ca Posted January 1, 2014 Author Share Posted January 1, 2014 It's custom module ... I'm a little confused. The module says it's created by Prestashop but when I double checked with a default installation, I see you are right because that module is not included in the default installation. I'll contact the company responsible for the template I'm using and see what they have to say. Thanks for responding. Link to comment Share on other sites More sharing options...
vekia Posted January 1, 2014 Share Posted January 1, 2014 it's because of mixed content filtering, it's a quite "new" feature in browsers (all of them). if you're contected via ssl, you can't load contents from non-ssl connections (especially ajax queries due to the not allowed origin error) XMLHttpRequest cannot load http://thevacuumstore.ca/p/modules/blockmegamenu/ajax.php. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://thevacuumstore.ca' is therefore not allowed access. you have to use ssl connection instead of simple http. what to do? change http to https in: <script type="text/javascript"> $(document).ready(function(){ $('.sf-menu a').mouseover(function() { var pID = $(this).attr('id'); if ($('#c_'+pID+' .prodImage').length == 0) { $.ajax({ type: 'POST', url: 'http://thevacuumstore.ca/p/modules/blockmegamenu/ajax.php', data: 'id='+pID, success: function(result){ if (result == '0') { console.log("no data") } else { $('#c_'+pID).html('<img class="prodImage" src='+result+' />'); } } }); } }); }); </script> remember that if you're connected via http you can't load https ajax queries, the same when you're connected with https - you can't load ajax via http what to do? use this js var: baseDir url: baseDir+'modules/blockmegamenu/ajax.php', Link to comment Share on other sites More sharing options...
batman42ca Posted January 1, 2014 Author Share Posted January 1, 2014 what to do? change http to https .... what to do? use this js var: baseDir url: baseDir+'modules/blockmegamenu/ajax.php', Thanks for the suggestions. Just a few follow up questions. Which file contains that javascript code? The error message you quoted doesn't seem to mention the source of the error. You said replace http with https in the javascript code but I think you're saying that I should really use baseDir instead of just changing http into https? Link to comment Share on other sites More sharing options...
vekia Posted January 2, 2014 Share Posted January 2, 2014 hello due to the fact, that module isn't "default" it's hard to say where exactly, i suppose that it's a part of module ".tpl" file. dunno, maybe header.tpl ? you shold check module .tpl files first. you can also check .header.tpl file located in your theme directory and what to do? sorry for the confusion, i tried to describe problem instead of exact path to the file: url: 'http://thevacuumstore.ca/p/modules/blockmegamenu/ajax.php', use: url: baseDir+'modules/blockmegamenu/ajax.php', Link to comment Share on other sites More sharing options...
batman42ca Posted January 4, 2014 Author Share Posted January 4, 2014 Just to be complete. I did get some help from the template authors. What they did to fix the problem is as follows: in hookDisplayTop() in modules/blockmegamenu/blockmegamenu.php, they changed the very first line from: $shopUrl = 'http://'.$_SERVER['HTTP_HOST']. __PS_BASE_URI__.'modules/blockmegamenu/ajax.php'; to $shopUrl = '//'.$_SERVER['HTTP_HOST']. __PS_BASE_URI__.'modules/blockmegamenu/ajax.php'; 1 Link to comment Share on other sites More sharing options...
mir-aus Posted October 31, 2014 Share Posted October 31, 2014 Hi, I have a model which use below code: $this->controller_type = 'front'; global $useSSL; parent::__construct(); // BT - add override on detecting PayPal's payment controller if (Configuration::get('PS_SSL_ENABLED') && Configuration::get('PS_SSL_ENABLED_EVERYWHERE') || (strstr($_SERVER['SCRIPT_NAME'], 'paypal') || strstr($_SERVER['REQUEST_URI'], 'paypal')) ) { $useSSL = true; } if (isset($useSSL)) $this->ssl = $useSSL; else $useSSL = $this->ssl; --- and give me a error in http pages. how can I edit this code, then can works for http pages as well ? Link to comment Share on other sites More sharing options...
vekia Posted November 2, 2014 Share Posted November 2, 2014 and give me a error in http pages what error? Link to comment Share on other sites More sharing options...
Recommended Posts