Last active
January 1, 2016 16:49
-
-
Save Dh42/8172816 to your computer and use it in GitHub Desktop.
Override for Prestashop 1.5 Tools.php to make media servers not need SSL check http://blog.dh42.com/prestashop-media-server-hack/ for more information and use case.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Tools extends ToolsCore | |
{ | |
public static function getMediaServer($filename) | |
{ | |
if (self::$_cache_nb_media_servers === null) | |
{ | |
if (_MEDIA_SERVER_1_ == '') | |
self::$_cache_nb_media_servers = 0; | |
elseif (_MEDIA_SERVER_2_ == '') | |
self::$_cache_nb_media_servers = 1; | |
elseif (_MEDIA_SERVER_3_ == '') | |
self::$_cache_nb_media_servers = 2; | |
else | |
self::$_cache_nb_media_servers = 3; | |
} | |
if (self::$_cache_nb_media_servers && Tools::usingSecureMode() == false && ($id_media_server = (abs(crc32($filename)) % self::$_cache_nb_media_servers + 1))) | |
return constant('_MEDIA_SERVER_'.$id_media_server.'_'); | |
return Tools::usingSecureMode() ? Tools::getShopDomainSSL() : Tools::getShopDomain(); | |
} | |
} |
HI, I have the same problem... Have you got any ideas?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi there, thanks for posting this! It works great except for when you add to cart. With ajax cart enabled, it tries to load the product image over HTTPS (used in the animation of the image going to the cart). Any idea how to fix?