Products won't display with update - by kevinkjr

This topic has 14 replies, 2 voices, and was last updated 6 years, 6 months ago ago by Rose Tyler

  • Avatar: kevinkjr
    kevinkjr
    Participant
    May 31, 2018 at 15:12

    This has been an issue before, but a certain product category will not display properly on our site. The page is here: https://highlandpharms.com/best-cbd-dabs-waxes/

    There is some kind of conflict. It only affects this product category.

    13 Answers
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    May 31, 2018 at 15:22
    Avatar: kevinkjr
    kevinkjr
    Participant
    May 31, 2018 at 15:25

    The theme was updated through WP. Updated last night, that is when category stopped working.

    Avatar: kevinkjr
    kevinkjr
    Participant
    May 31, 2018 at 15:26
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    May 31, 2018 at 15:35

    Hello,

    Please provide us with FTP access.

    Regards

    Avatar: kevinkjr
    kevinkjr
    Participant
    May 31, 2018 at 15:37

    Can you provide an email address? I can add you to our Flywheel SFTP.

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    May 31, 2018 at 15:46

    Please open theme-functions.php file (xstore/framework) > find unicode_chars function > and change this https://prnt.sc/jp2qz3 to https://prnt.sc/jp2r8i

    Regards

    Avatar: kevinkjr
    kevinkjr
    Participant
    May 31, 2018 at 15:49

    I am not sure what you are referring to? I am not a developer.

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    May 31, 2018 at 15:58

    You need to connect site via FTP, open theme-functions.php file and change

    function unicode_chars($source, $iconv_to = 'UTF-8') {
        $decodedStr = '';
        $pos = 0;
        $len = strlen ($source);
        while ($pos < $len) {
            $charAt = substr ($source, $pos, 1);
            if ($charAt == '%') {
                $pos++;
                $charAt = substr ($source, $pos, 1);
                if ($charAt == 'u') {
                    // we got a unicode character
                    $pos++;
                    $unicodeHexVal = substr ($source, $pos, 4);
                    $unicode = hexdec ($unicodeHexVal);
                    $decodedStr .= code2utf($unicode);
                    $pos += 4;
                }
                else {
                    // we have an escaped ascii character
                    $hexVal = substr ($source, $pos, 2);
                    $decodedStr .= chr (hexdec ($hexVal));
                    $pos += 2;
                }
            }
            else {
                $decodedStr .= $charAt;
                $pos++;
            }
        }
    
        if ($iconv_to != "UTF-8") {
            $decodedStr = iconv("UTF-8", $iconv_to, $decodedStr);
        }
        
        return $decodedStr;
    }

    to

    function unicode_chars($source, $iconv_to = 'UTF-8') {
        $decodedStr = '';
        $pos = 0;
        $len = strlen ($source);
        while ($pos < $len) {
            $charAt = substr ($source, $pos, 1);
            // if ($charAt == '%') {
            //     $pos++;
            //     $charAt = substr ($source, $pos, 1);
            //     if ($charAt == 'u') {
            //         // we got a unicode character
            //         $pos++;
            //         $unicodeHexVal = substr ($source, $pos, 4);
            //         $unicode = hexdec ($unicodeHexVal);
            //         $decodedStr .= code2utf($unicode);
            //         $pos += 4;
            //     }
            //     else {
            //         // we have an escaped ascii character
            //         $hexVal = substr ($source, $pos, 2);
            //         $decodedStr .= chr (hexdec ($hexVal));
            //         $pos += 2;
            //     }
            // }
            // else {
                $decodedStr .= $charAt;
                $pos++;
            // }
        }
    
        if ($iconv_to != "UTF-8") {
            $decodedStr = iconv("UTF-8", $iconv_to, $decodedStr);
        }
        
        return $decodedStr;
    }

    Regards

    Avatar: kevinkjr
    kevinkjr
    Participant
    May 31, 2018 at 16:07

    Ok can this be done in the child theme? Or will a theme update remove this?

    Avatar: kevinkjr
    kevinkjr
    Participant
    May 31, 2018 at 17:20

    I made this change in the theme-functions.php file in the XStore folder and the site stopped working. I had to reload the entire XStore theme folder.

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    June 1, 2018 at 08:18

    Dear @kevinkjr,

    You need to change the code in the file of the parent theme. We will add this fix in next theme update.
    Please try one more time https://prnt.sc/jpdrql , this code should work fine:

    function unicode_chars($source, $iconv_to = 'UTF-8') {
        $decodedStr = '';
        $pos = 0;
        $len = strlen ($source);
        while ($pos < $len) {
            $charAt = substr ($source, $pos, 1);
            // if ($charAt == '%') {
            //     $pos++;
            //     $charAt = substr ($source, $pos, 1);
            //     if ($charAt == 'u') {
            //         // we got a unicode character
            //         $pos++;
            //         $unicodeHexVal = substr ($source, $pos, 4);
            //         $unicode = hexdec ($unicodeHexVal);
            //         $decodedStr .= code2utf($unicode);
            //         $pos += 4;
            //     }
            //     else {
            //         // we have an escaped ascii character
            //         $hexVal = substr ($source, $pos, 2);
            //         $decodedStr .= chr (hexdec ($hexVal));
            //         $pos += 2;
            //     }
            // }
            // else {
                $decodedStr .= $charAt;
                $pos++;
            // }
        }
    
        if ($iconv_to != "UTF-8") {
            $decodedStr = iconv("UTF-8", $iconv_to, $decodedStr);
        }
        
        return $decodedStr;
    }
    

    Regards

    Avatar: kevinkjr
    kevinkjr
    Participant
    June 1, 2018 at 22:54

    Finally was able to get a developer to apply the fix. That worked. Thank you.

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    June 4, 2018 at 06:54

    You’re welcome!
    Feel free to ask if you have any other questions.

    Regards

  • Viewing 14 results - 1 through 14 (of 14 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.