כיצד להוסיף צ'אטבוט AI של Asyntai ל-OpenCart
מדריך צעד אחר צעד לאתרי OpenCart
The Easy Way: Install the Asyntai Extension
We publish a free extension on the OpenCart Marketplace. It puts the chatbot on your storefront and connects your account, and there is no code to copy and no template to edit. It works on OpenCart 3.x and 4.x.
- Download Asyntai - AI Chatbot from the OpenCart Marketplace
- In your admin panel, go to Extensions → Installer and upload the ZIP file
- Go to Extensions → Extensions, choose Modules in the list, find Asyntai AI Chatbot and press the green install button
- Press edit, then press Connect to Asyntai. A window opens where you sign in or create an account.
That is all. The chatbot is live on your storefront when the window closes.
Your products, prices and stock
When you connect, the extension also lets Asyntai read your catalogue. Your assistant then answers with the price you charge today and tells shoppers what is in stock, instead of repeating whatever your pages said when they were last read.
Asyntai reads your products through a read-only address on your own store. Every request is signed, and the reply carries the prices a shopper would actually pay, with your tax rules already applied. You can switch this off at any time on the extension's settings screen.
Updating from version 1.0.0? OpenCart clears a module's settings when you uninstall it, so press Connect to Asyntai once after the update. From this version on, updates keep your connection.
Or Add the Code Yourself
Prefer not to install an extension? The rest of this page shows how to add the chatbot by hand. You will not get the catalogue reading this way.
שלב 1: קבל את קוד ההטמעה שלך
First, go to your Asyntai Dashboard and scroll down to the "Embed Code" section. Copy your unique embed code which will look like this:
<script>(function(){var l=function(){var s=document.createElement("script");s.src="https://widget.asyntai.com/static/js/chat-widget.js";s.async=true;s.setAttribute("data-asyntai-id","YOUR_WIDGET_ID");document.head.appendChild(s)};if(document.readyState==="complete"){l()}else{window.addEventListener("load",l)}})();</script>
הערה: הקוד למעלה הוא רק דוגמה. עליך להעתיק את קוד ההטמעה הייחודי שלך מלוח הבקרה שלך כיוון שהוא מכיל את מזהה הווידג'ט האישי שלך.
Step 2: Edit Footer Template
הדרך הפשוטה ביותר להוסיף את הצ'אטבוט היא על ידי עריכת תבנית הפוטר של התבנית שלכם:
- גשו לקבצי OpenCart שלכם דרך FTP או מנהל קבצים
- נווטו לתבנית הפוטר של התבנית שלכם:
- OpenCart 3.x/4.x:
catalog/view/theme/YOUR_THEME/template/common/footer.twig - OpenCart 2.x:
catalog/view/theme/YOUR_THEME/template/common/footer.tpl
- OpenCart 3.x/4.x:
- פתחו את קובץ הפוטר לעריכה
- מצא את תג הסגירה
</body> - הדבק את קוד ההטמעה של Asyntai ממש לפני תג
</body> - שמור את הקובץ
- נקו מטמון OpenCart: Dashboard → סמל גלגל שיניים כחול (למעלה מימין) → Refresh או מחקו את תוכן
system/storage/cache/
טיפ: אם אתם משתמשים בתבנית ברירת המחדל, הנתיב יהיה catalog/view/theme/default/template/common/footer.twig. תמיד צרו גיבוי לפני עריכת קבצי תבנית.
חלופה: שימוש באפשרות קוד מותאם אישית של התבנית
תבניות OpenCart מודרניות רבות כוללות אפשרות מובנית לקוד מותאם אישית:
- היכנסו ללוח הניהול של OpenCart
- עברו אל Extensions → Themes (או Extensions → Extensions → Themes)
- לחצו על Edit בתבנית הפעילה שלכם
- חפשו קטע "Custom Code", "Footer Scripts", או "Custom JavaScript"
- הדבק את קוד ההטמעה של Asyntai
- לחץ על "Save"
- נקו את המטמון
הערה: לא לכל התבניות יש אפשרות זו. אם לתבנית שלכם אין שדות קוד מותאם אישית, השתמשו בשיטת עריכת התבנית או התקינו הרחבה.
חלופה: שימוש בהרחבת קוד מותאם אישית
ניתן להתקין הרחבה חינמית מ-OpenCart Marketplace כדי להוסיף סקריפטים מותאמים אישית:
- Go to the OpenCart Marketplace
- חפשו "Custom Script", "Header Footer Scripts", או "Custom Code"
- הורידו והתקינו הרחבה מתאימה
- בלוח הניהול שלכם, עברו אל Extensions → Extensions → Modules
- מצאו והתקינו את מודול הקוד המותאם אישית
- הגדירו את המודול והדביקו את קוד ההטמעה של Asyntai בקטע הפוטר
- שמרו ונקו את המטמון
חשוב: שימוש בהרחבות מומלץ על פני עריכת קבצי ליבה, מכיוון שהן שורדות עדכוני OpenCart. הרחבות פופולריות כוללות "Custom Script in Header & Footer" הזמינות ב-marketplace.
חלופה: שימוש בשיטת addScript (למפתחים)
למפתחים, OpenCart 3.x/4.x מספק דרך פרוגרמטית להוספת סקריפטים:
- פתחו את
catalog/controller/common/footer.php - הוסיפו את השורה הבאה לפני
$data['scripts'] = $this->document->getScripts('footer');:$this->document->addScript('https://asyntai.com/static/js/chat-widget.js', 'footer'); - עבור מאפיין ה-data, תצטרכו לשנות את footer.twig כדי לכלול אותו ידנית, או להוסיף JavaScript inline לאחר לולאת הסקריפטים
הערה: כדי שהווידג'ט יעבוד כראוי עם מאפיין ה-data, שיטת התבנית פשוטה יותר מכיוון ששיטת addScript לא תומכת במאפיינים מותאמים אישית ישירות.
שלב 3: אמת את ההתקנה
לאחר שמירת השינויים וניקוי המטמון, בקרו בחנות שלכם בלשונית דפדפן חדשה או בחלון גלישה פרטית. אתם אמורים לראות את כפתור הצ'אט בפינה הימנית התחתונה. לחצו עליו כדי לוודא שהוא נפתח ופועל כראוי.
לא רואה את הווידג'ט? הקפידו לנקות את מטמון OpenCart. עברו ללוח הניהול, לחצו על סמל גלגל השיניים הכחול בפינה הימנית העליונה ולחצו על כפתורי הרענון. נסו גם לנקות את מטמון הדפדפן או לצפות בחלון גלישה פרטית. אם שיניתם את קובץ התבנית הלא נכון, בדקו שהתבנית שלכם משתמשת בקובץ שערכתם.
Weebly