Jump to content

วิธีแก้ไข prestashop ให้ support Friendly URL ภาษาไทยได้


mrdreamer

Recommended Posts

Update: ไฟล์สำหรับขั้นตอนที่ 1 และ 3 ครับเพื่อความสะดวก
http://www.mediafire.com/?2znymv2tymm
------------------------------------------------
Credit การทำมั่วๆ by ผมเอง Grin
1. เข้าไปใน folder js หาไฟล์ที่ชื่อว่า admin.js
หา function str2url
แล้วหาบรรทัดที่เขียนว่า
โค๊ด:

str = str.replace(/[^a-z0-9\s\'\:\/\[\]-]/g,'');




จากนั้นแทนที่ด้วย
โค๊ด:

str = str.replace(/[^a-z0-9ก-๙\s\'\:\/\[\]-]/g,'');




2. แก้ไฟล์ .htaccess แบบมักง่ายที่สุด
replace คำว่า [_a-zA-Z0-9-] และ [a-zA-Z0-9-] เป็น . ใน RewriteRule แต่ละอัน

3. Folder Class หา Validate.php แล้วหา function ชื่อว่า isLinkRewrite

จากนั้นแก้
โค๊ด:

return empty($link) OR preg_match('/^[_a-z0-9-]+$/ui', $link);



เป็น
โค๊ด:

return empty($link) OR preg_match('/^[_a-z0-9ก-๙-]+$/ui', $link);




ก็เสร็จเรียบร้อยแล้วครับ ก็จะได้ SEF url ที่สวยงามดังภาพ Embarrassed
แต่ต้องไปเซ็ตในสินค้าก่อนด้วยนะครับ
urlm.jpg




Credit ท่าน barco แห่ง thaiseoboard.com
http://www.thaiseoboard.com/index.php/topic,80015.0.html

  • Like 2
Link to comment
Share on other sites

  • 1 month later...

สุดยอดครับ ได้ผลจริง ๆ แต่มีปัญหานิดหหน่อย เพราะถ้าใช้ firefox จะใส่ตัวอักษรไทยไม่ได้ แต่ถ้าใช้ IE จะใส่ได้ ก็พยายามแก้ไขตามคำแนะนำ แต่ก็ไม่สำเร็จ อย่างไรก็ตามก็ใช้ IE แก้ไขก็ไม่ได้ลำบากอะไร

Link to comment
Share on other sites

สุดยอดครับ ได้ผลจริง ๆ แต่มีปัญหานิดหหน่อย เพราะถ้าใช้ firefox จะใส่ตัวอักษรไทยไม่ได้ แต่ถ้าใช้ IE จะใส่ได้ ก็พยายามแก้ไขตามคำแนะนำ แต่ก็ไม่สำเร็จ อย่างไรก็ตามก็ใช้ IE แก้ไขก็ไม่ได้ลำบากอะไร


ผมใช้ใน firefox ได้ปกติครับ
เพราะผมใช้ firefox เป็นหลักครับ 99.99% ใช้แต่ firefox ครับ หุุหุ
Link to comment
Share on other sites

  • 3 months later...
  • 2 months later...
  • 2 weeks later...

ลองแล้วถ้าเป็นเว็บเปิดใหม่ ก็ได้ปกติ แต่ถ้าเป็นเว็บที่มีสินค้าแล้ว จะหาชื่อสินค้าไม่เจอ ต้องไปแก้ไขชื่อสินค้าใหม่ทั้งหมด

Link to comment
Share on other sites

  • 1 year later...

ทำตามแล้วดูจะใช้ได้เว้นแต่เมื่อใช้ gsitemap ของpresto-changeo เพื่อสร้าง sitemap แล้วมีerror

Warning: simplexml_load_file() [function.simplexml-load-file]: /home/domain.com/public_html/modules/gsitemap/../../sitemap.xml:3: parser error : Premature end of data in tag url line 3 in /home/domain.com/public_html/modules/gsitemap/gsitemap.php on line 197

มีใครเจอและแก้ปัญหาได้มั๊ยค่ะ

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...