Hoe voegt u de Asyntai AI-chatbot toe aan PrestaShop
Stapsgewijze handleiding voor PrestaShop-websites
Stap 1: Uw insluitcode ophalen
Ga eerst naar uw Asyntai Dashboard en scroll naar het gedeelte "Insluitcode". Kopieer uw unieke insluitcode die er als volgt uitziet:
<script async src="https://asyntai.com/static/js/chat-widget.js" data-asyntai-id="YOUR_WIDGET_ID"></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.
Stap 2: Module voor aangepaste code gebruiken (aanbevolen)
De eenvoudigste manier om de chatbot toe te voegen is met een gratis "Custom Code"-module uit de PrestaShop Addons-marketplace:
- Log in op uw PrestaShop-backoffice
- Ga naar Modules → Module Manager
- Klik op "Upload a module" of zoek op de marketplace naar "Custom Code" of "Header Footer Scripts"
- Install a module like "Custom JS and CSS" or similar
- Ga na de installatie naar de configuratie van de module
- Zoek de sectie "Footer Scripts" of "Before </body>"
- Plak uw Asyntai-insluitcode
- Klik op "Save"
Tip: Populaire gratis modules hiervoor zijn "Custom JS and CSS Pro", "Custom Code" en "Header and Footer Scripts". Deze modules overleven thema- en PrestaShop-updates.
Alternatief: Thema-template bewerken (PrestaShop 1.7+/8)
You can add the code directly to your theme's footer template:
- Open uw PrestaShop-bestanden via FTP of bestandsbeheer
- Navigeer naar uw themamap:
themes/your_theme/templates/_partials/ - Open het bestand footer.tpl (of controleer in sommige thema's
templates/layouts/layout-both-columns.tpl) - Zoek de afsluitende
</body>-tag of de sectie{block name='javascript_bottom'} - Plak uw Asyntai-insluitcode net voor de afsluitende
</body>-tag - Sla het bestand op
- Wis de PrestaShop-cache: Advanced Parameters → Performance → Clear cache
Belangrijk: Wijzigingen in themabestanden kunnen worden overschreven bij het bijwerken van uw thema. Overweeg het gebruik van een kindthema of een module voor een meer permanente oplossing.
Alternatief: Het aangepaste JavaScript-bestand van het thema gebruiken
Many PrestaShop themes include a custom.js file for your own scripts:
- Navigeer naar:
themes/your_theme/assets/js/ - Zoek naar een bestand met de naam custom.js (maak het aan als het niet bestaat)
- Voeg de volgende code toe om de chatbot dynamisch te laden:
(function() {
var script = document.createElement('script');
script.async = true;
script.src = 'https://asyntai.com/static/js/chat-widget.js';
script.setAttribute('data-asyntai-id', 'YOUR_WIDGET_ID');
document.body.appendChild(script);
})(); - Vervang
YOUR_WIDGET_IDdoor uw werkelijke widget-ID - Wis de PrestaShop-cache
Alternatief: Een eenvoudige module maken (voor ontwikkelaars)
Voor ontwikkelaars kunt u een eenvoudige module maken met de displayFooter-hook:
- Maak een map aan:
modules/asyntaichatbot/ - Maak asyntaichatbot.php aan met deze code:
<?php
class AsyntaiChatbot extends Module {
public function __construct() {
$this->name = 'asyntaichatbot';
$this->version = '1.0.0';
$this->author = 'Your Name';
parent::__construct();
$this->displayName = 'Asyntai Chatbot';
}
public function install() {
return parent::install() && $this->registerHook('displayFooter');
}
public function hookDisplayFooter($params) {
return '<script async src="https://asyntai.com/static/js/chat-widget.js" data-asyntai-id="YOUR_WIDGET_ID"></script>';
}
} - Vervang
YOUR_WIDGET_IDdoor uw werkelijke widget-ID - Installeer de module via Modules → Module Manager
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 PrestaShop-cache wist: ga naar Advanced Parameters → Performance → Clear cache. Probeer ook uw browsercache te wissen of bekijk de site in een incognitovenster. Als u een aangepaste module gebruikt, controleer dan of deze is ingeschakeld in de Module Manager.
Weebly