Hoe voegt u de Asyntai AI-chatbot toe aan PrestaShop

Stapsgewijze handleiding voor PrestaShop-websites

Insluitcode ophalen

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:

  1. Log in op uw PrestaShop-backoffice
  2. Ga naar Modules → Module Manager
  3. Klik op "Upload a module" of zoek op de marketplace naar "Custom Code" of "Header Footer Scripts"
  4. Install a module like "Custom JS and CSS" or similar
  5. Ga na de installatie naar de configuratie van de module
  6. Zoek de sectie "Footer Scripts" of "Before </body>"
  7. Plak uw Asyntai-insluitcode
  8. 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:

  1. Open uw PrestaShop-bestanden via FTP of bestandsbeheer
  2. Navigeer naar uw themamap: themes/your_theme/templates/_partials/
  3. Open het bestand footer.tpl (of controleer in sommige thema's templates/layouts/layout-both-columns.tpl)
  4. Zoek de afsluitende </body>-tag of de sectie {block name='javascript_bottom'}
  5. Plak uw Asyntai-insluitcode net voor de afsluitende </body>-tag
  6. Sla het bestand op
  7. 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:

  1. Navigeer naar: themes/your_theme/assets/js/
  2. Zoek naar een bestand met de naam custom.js (maak het aan als het niet bestaat)
  3. 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);
    })();
  4. Vervang YOUR_WIDGET_ID door uw werkelijke widget-ID
  5. Wis de PrestaShop-cache

Alternatief: Een eenvoudige module maken (voor ontwikkelaars)

Voor ontwikkelaars kunt u een eenvoudige module maken met de displayFooter-hook:

  1. Maak een map aan: modules/asyntaichatbot/
  2. 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>';
      }
    }
  3. Vervang YOUR_WIDGET_ID door uw werkelijke widget-ID
  4. 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.