Showing posts with label unable. Show all posts
Showing posts with label unable. Show all posts

Sunday, June 14, 2015

[PrestaShop] A problem in ‘TECHNICAL ERROR: unable to load form. Details Error thrown:’ message

[PrestaShop] A problem in ‘TECHNICAL ERROR: unable to load form. Details Error thrown:’ message

As Using a prestashop in multilingual, we usually have a problem that loaded data to show from JavaScript with json format, moreover the prestashop called the load with its global function in class path ‘\classes\Tools.php’

An example function,
1.                  public static function jsonEncode($data)
2.           {
3.               if (function_exists('json_encode'))
4.                   return json_encode($data );
5.               else
6.               {
7.                   include_once(_PS_TOOL_DIR_.'json/json.php');
8.                   $pear_json = new Services_JSON();
9.                   return $pear_json->encode($data);
10.           }
11.       }

How to solved this, you ought to add command in line number 4 with;
            return json_encode($data, JSON_UNESCAPED_UNICODE );
You will have never found a message of problem anymore.


Congratulations, all of you for solved problem. 

[PrestaShop] ปัญหาการเกิด TECHNICAL ERROR: unable to load form. Details Error thrown:

[PrestaShop] ปัญหาการเกิด TECHNICAL ERROR: unable to load form. Details Error thrown:

เนื่องจากการใช้งานในรูปแบบ multilingual นั้น มักจะมีปัญหาการ load ข้อมูลมาเพื่อแสดงในรูปแบบ json  และ Prestashop ใช้การload โดยผ่าน global function ของ prestashop เอง ใน class \classes\Tools.php

ตัวอย่าง function
1.                  public static function jsonEncode($data)
2.           {
3.               if (function_exists('json_encode'))
4.                   return json_encode($data );
5.               else
6.               {
7.                   include_once(_PS_TOOL_DIR_.'json/json.php');
8.                   $pear_json = new Services_JSON();
9.                   return $pear_json->encode($data);
10.           }
11.       }

วิธีแก้ไข ให้เพิ่มคำสั่งในบรรทัดที่ 4 ด้วย
            return json_encode($data, JSON_UNESCAPED_UNICODE );
จะทำให้ไม่เกิดปัญหาอีกต่อได้



ยินดีด้วยกับผู้ที่เริ่มต้นการใช้งาน  J