$tbData->isHTTPS returns false even when on HTTPS.

Tagged: , ,

ThemeBurn SupportForumsOpenCart ThemesShoppica 2 OpenCart Theme$tbData->isHTTPS returns false even when on HTTPS.

This topic has been marked as not resolved.

Hi,

I’am running Shoppica 2 version 2.2.4 on OC 1.5.6.

Like the topic says. Running var_dump on $tbData->isHTTPS, it returns bool(false) even when on HTTPS.

How do i resolve this?

January 31, 2017 at 9:35 pm #56001

The $tbData->isHTTPS variable is set from tb_themes\shoppica2\library\Utils.php -> public static function isRequestHTTPS(). This is the recommended way of detecting secure pages, but you can change the code if you like. For example you can try to replace the function with:

    public static function isRequestHTTPS()
    {
        $isSecure =
            (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')
            || (!empty($_SERVER['SERVER_PORT']) && intval($_SERVER['SERVER_PORT']) == 443);

        if ((!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
            || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') {
            $isSecure = true;
        }

        return $isSecure;
    }

If this does not work, you can try with custom implementation. Please, not that Shoppica2 is not supported anymore.

Regards,
Themeburn Team

February 1, 2017 at 8:54 am #56017
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.