Hoe voegt u de Asyntai AI-chatbot toe aan OpenCart
Stapsgewijze handleiding voor OpenCart-websites
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.
Stap 1: Uw insluitcode ophalen
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>
Opmerking: De bovenstaande code is slechts een voorbeeld. U moet uw eigen unieke insluitcode kopiëren vanuit uw Dashboard omdat deze uw persoonlijke widget-ID bevat.
Step 2: Edit Footer Template
De meest eenvoudige manier om de chatbot toe te voegen is door de voettekst-template van uw thema te bewerken:
- Open uw OpenCart-bestanden via FTP of bestandsbeheer
- Navigeer naar de voettekst-template van uw thema:
- 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:
- Open het voettekstbestand om te bewerken
- Zoek de afsluitende
</body>-tag - Plak uw Asyntai-insluitcode net vóór de
</body>-tag - Sla het bestand op
- Wis de OpenCart-cache: Dashboard → Blauw tandwielpictogram (rechtsboven) → Vernieuwen of verwijder de inhoud van
system/storage/cache/
Tip: Als u het standaardthema gebruikt, is het pad catalog/view/theme/default/template/common/footer.twig. Maak altijd een back-up voordat u templatebestanden bewerkt.
Alternatief: De optie Aangepaste code van het thema gebruiken
Veel moderne OpenCart-thema's bevatten een ingebouwde optie voor aangepaste code:
- Log in op uw OpenCart-beheerpaneel
- Ga naar Extensions → Themes (of Extensions → Extensions → Themes)
- Klik op Edit bij uw actieve thema
- Zoek naar een sectie "Custom Code", "Footer Scripts" of "Custom JavaScript"
- Plak uw Asyntai-insluitcode
- Klik op "Save"
- Wis de cache
Opmerking: Niet alle thema's hebben deze optie. Als uw thema geen velden voor aangepaste code bevat, gebruik dan de template-bewerkingsmethode of installeer een extensie.
Alternatief: Een extensie voor aangepaste code gebruiken
U kunt een gratis extensie installeren vanuit de OpenCart Marketplace om aangepaste scripts toe te voegen:
- Go to the OpenCart Marketplace
- Zoek naar "Custom Script", "Header Footer Scripts" of "Custom Code"
- Download en installeer een geschikte extensie
- Ga in uw beheerpaneel naar Extensions → Extensions → Modules
- Zoek en installeer de module voor aangepaste code
- Configureer de module en plak uw Asyntai-insluitcode in de voettekstsectie
- Sla op en wis de cache
Belangrijk: Het gebruik van extensies heeft de voorkeur boven het bewerken van kernbestanden, aangezien ze OpenCart-updates overleven. Populaire extensies zijn onder andere "Custom Script in Header & Footer" die beschikbaar is op de marketplace.
Alternatief: De addScript-methode gebruiken (voor ontwikkelaars)
Voor ontwikkelaars biedt OpenCart 3.x/4.x een programmatische manier om scripts toe te voegen:
- Open
catalog/controller/common/footer.php - Voeg de volgende regel toe vóór
$data['scripts'] = $this->document->getScripts('footer');:$this->document->addScript('https://asyntai.com/static/js/chat-widget.js', 'footer'); - Voor het data-attribuut moet u de footer.twig handmatig aanpassen om het op te nemen, of inline JavaScript toevoegen na de scripts-lus
Opmerking: Om de widget correct te laten werken met het data-attribuut is de template-methode eenvoudiger, aangezien de addScript-methode geen aangepaste attributen rechtstreeks ondersteunt.
Stap 3: Installatie verifiëren
Na het opslaan van uw wijzigingen en het wissen van de cache, bezoek uw winkel in een nieuw browsertabblad of incognitovenster. U zou de chatwidget-knop in de rechteronderhoek moeten zien. Klik erop om te controleren of deze correct opent en werkt.
Ziet u de widget niet? Zorg ervoor dat u de OpenCart-cache wist. Ga naar uw beheerpaneel, klik op het blauwe tandwielpictogram in de rechterbovenhoek en klik op de vernieuwknoppen. Probeer ook uw browsercache te wissen of bekijk de site in een incognitovenster. Als u het verkeerde templatebestand hebt gewijzigd, controleer dan of uw thema het bestand gebruikt dat u hebt bewerkt.
Weebly