PrestaShop: Automate Product Support
Deploy an AI chatbot on PrestaShop to automate customer support, answer product questions and reduce support team workload.
PrestaShop: Automate Product Support
PrestaShop powers over 300,000 online stores, primarily in Europe. Automating product support through an AI assistant enables instant responses to customer questions while freeing up time for your team. This guide details how to deploy a RAG chatbot optimized for PrestaShop.
The E-commerce Support Challenge
Repetitive Questions Consume Time
An internal study on PrestaShop stores reveals that 70% of support questions concern:
- Product availability and delivery times
- Technical specifications and compatibility
- Return and exchange procedures
- Order tracking
- Sizes and measurement guides
These questions have standardized answers but currently require human intervention.
Cost of Manual Support
| Metric | Manual Support | AI Support |
|---|---|---|
| Average response time | 4-24 hours | < 5 seconds |
| Cost per interaction | $3-8 | $0.05-0.15 |
| Availability | Business hours | 24/7 |
| Scalability | Linear (hiring) | Instant |
| Response consistency | Variable | Constant |
The RAG Advantage for Support
A RAG assistant connected to your PrestaShop database can:
- Answer product questions with precision
- Know stock status in real-time
- Explain specific return policies
- Guide through the purchase process
- Intelligently escalate to a human when needed
PrestaShop + RAG Architecture
PrestaShop Catalog Connector
DEVELOPERphp<?php // PrestaShop module for RAG catalog export class AilogExportModule extends Module { public function exportCatalog(): array { $products = []; $productList = Product::getProducts( $this->context->language->id, 0, 0, 'id_product', 'ASC', false, true // Active only ); foreach ($productList as $productData) { $product = new Product( $productData['id_product'], true, $this->context->language->id ); $products[] = $this->formatForRAG($product); } return $products; } private function formatForRAG(Product $product): array { // Enriched description for RAG $content = sprintf( "Product: %s\n" . "Reference: %s\n" . "Description: %s\n" . "Features: %s\n" . "Price: $%s\n" . "Availability: %s\n" . "Categories: %s", $product->name, $product->reference, strip_tags($product->description), $this->getFeatures($product), $product->price, $this->getStockStatus($product), $this->getCategories($product) ); return [ 'id' => 'prestashop_' . $product->id, 'title' => $product->name, 'content' => $content, 'metadata' => [ 'source' => 'prestashop', 'product_id' => $product->id, 'reference' => $product->reference, 'price' => (float) $product->price, 'in_stock' => StockAvailable::getQuantityAvailableByProduct($product->id) > 0, 'url' => $this->context->link->getProductLink($product), 'image' => $this->getMainImage($product), 'categories' => $this->getCategoryIds($product) ] ]; } private function getFeatures(Product $product): string { $features = $product->getFeatures(); $featureStrings = []; foreach ($features as $feature) { $featureName = Feature::getFeatureName($feature['id_feature']); $featureValue = FeatureValue::getFeatureValueById($feature['id_feature_value']); $featureStrings[] = "$featureName: $featureValue"; } return implode(', ', $featureStrings); } private function getStockStatus(Product $product): string { $quantity = StockAvailable::getQuantityAvailableByProduct($product->id); if ($quantity > 10) { return 'In stock'; } elseif ($quantity > 0) { return "Limited stock ($quantity available)"; } else { return 'Out of stock'; } } }
REST API for Synchronization
DEVELOPERpythonimport requests from typing import List, Dict class PrestaShopConnector: def __init__(self, shop_url: str, api_key: str): self.base_url = f"{shop_url}/api" self.auth = (api_key, '') def get_all_products(self) -> List[Dict]: """Retrieve all products via PrestaShop API.""" products = [] # Get list of IDs response = requests.get( f"{self.base_url}/products", auth=self.auth, params={'output_format': 'JSON', 'display': 'full'} ) response.raise_for_status() for product in response.json().get('products', []): if product.get('active') == '1': formatted = self._format_product(product) products.append(formatted) return products def _format_product(self, product: dict) -> dict: """Format a product for RAG indexing.""" # Extract texts (multilingual handling) name = self._get_localized_text(product.get('name', [])) description = self._get_localized_text(product.get('description', [])) description_short = self._get_localized_text(product.get('description_short', [])) content_parts = [ f"Product name: {name}", f"Reference: {product.get('reference', '')}", f"Description: {self._clean_html(description)}", f"Summary: {self._clean_html(description_short)}", f"Price: ${product.get('price', '0')}", ] # Add features features = self._get_product_features(product.get('id')) if features: content_parts.append(f"Features: {features}") return { "id": f"prestashop_{product['id']}", "title": name, "content": "\n".join(content_parts), "metadata": { "source": "prestashop", "product_id": product['id'], "reference": product.get('reference'), "price": float(product.get('price', 0)), "in_stock": int(product.get('quantity', 0)) > 0, "ean13": product.get('ean13'), "manufacturer": product.get('manufacturer_name'), "categories": self._get_category_names(product) } } def _get_localized_text(self, text_data) -> str: """Extract text in default language.""" if isinstance(text_data, list) and text_data: return text_data[0].get('value', '') elif isinstance(text_data, dict): return text_data.get('value', '') return str(text_data) if text_data else '' def _clean_html(self, html: str) -> str: """Clean HTML.""" from bs4 import BeautifulSoup return BeautifulSoup(html or '', 'html.parser').get_text(separator=' ')
PrestaShop Support System Prompt
DEVELOPERpythonPRESTASHOP_SUPPORT_PROMPT = """You are the support assistant for {shop_name}, a PrestaShop store. ## Your mission Answer customer questions about products, orders, and store policies. ## Support rules 1. ONLY respond with information from the knowledge base 2. For questions about a specific order, ask for the order number 3. Never share personal or payment information 4. If you can't resolve the issue, offer to contact customer service ## Question types and responses ### Product questions - Use product sheets to answer precisely - Indicate current availability - Suggest alternatives if out of stock ### Shipping questions - Explain available shipping methods - Indicate standard delivery times - For precise tracking, ask for order number ### Returns/Support questions - Explain the store's return policy - Guide through the return procedure - Reassure about warranties ## Knowledge base {context} ## Conversation history {history} ## Customer question {query} ## Your response (professional and helpful) """
PrestaShop Support Use Cases
Product Feature Questions
DEVELOPERpythonasync def handle_product_question(product_ref: str, question: str): """Answer questions about a specific product.""" # Search for the product product = await search_by_reference(product_ref) if not product: return """ I couldn't find a product with that reference. Could you check the number or describe the product? """ prompt = f""" Customer question about product: {product['title']} Product information: {product['content']} Question: {question} Answer precisely. If the information isn't available, suggest contacting customer service. """ return await llm.generate(prompt)
Availability Check
DEVELOPERpythonasync def check_availability(query: str): """Check product availability.""" # Identify the product products = await retriever.search(query, top_k=3) if not products: return "I couldn't find a matching product. Could you be more specific?" response_parts = [] for product in products: status = "available" if product['metadata']['in_stock'] else "out of stock" response_parts.append( f"**{product['title']}**: {status}\n" f"Price: ${product['metadata']['price']}\n" f"[View product]({product['metadata']['url']})" ) return "\n\n".join(response_parts)
Size Guide
DEVELOPERpythonasync def handle_size_question(product_id: str, user_measurements: dict = None): """Help with size selection.""" product = await get_product(product_id) size_guide = await get_size_guide(product['metadata']['categories'][0]) prompt = f""" The customer is asking for size advice for: {product['title']} Size guide for this category: {size_guide} {"Customer measurements: " + str(user_measurements) if user_measurements else ""} Recommend the appropriate size. If information is insufficient, ask the necessary questions (usual size, measurements). """ return await llm.generate(prompt)
Return Policy
DEVELOPERpythonRETURN_POLICY_CONTEXT = """ ## {shop_name} Return Policy **Return period**: 30 days after receipt **Conditions**: - Unused item, in original packaging - Tags still attached - Accompanied by return slip **Procedure**: 1. Log into your customer account 2. Go to "My orders" 3. Click "Return an item" 4. Print the prepaid return label 5. Drop off the package at a pickup point **Refund**: Within 14 days after receiving the return """ async def handle_return_question(question: str, order_id: str = None): """Handle return questions.""" context = RETURN_POLICY_CONTEXT if order_id: order_info = await get_order_info(order_id) if order_info: context += f"\n\nOrder #{order_id} information:\n{order_info}" prompt = f""" {context} Customer question: {question} Respond reassuringly and guide the customer through the procedure if needed. """ return await llm.generate(prompt)
PrestaShop Module Integration
Hook for Chat Widget
DEVELOPERphp<?php class AilogChat extends Module { public function hookDisplayFooter() { // Widget configuration $this->context->smarty->assign([ 'ailog_channel_id' => Configuration::get('AILOG_CHANNEL_ID'), 'current_product' => $this->getCurrentProduct(), 'cart_info' => $this->getCartInfo(), 'customer_info' => $this->getCustomerInfo() ]); return $this->display(__FILE__, 'views/templates/hook/chat_widget.tpl'); } private function getCurrentProduct(): ?array { if ($id_product = Tools::getValue('id_product')) { $product = new Product($id_product, true, $this->context->language->id); return [ 'id' => $product->id, 'name' => $product->name, 'reference' => $product->reference, 'price' => $product->price ]; } return null; } }
Smarty Template
DEVELOPERsmarty{* views/templates/hook/chat_widget.tpl *} <script> window.AilogConfig = { channelId: "{$ailog_channel_id}", context: { platform: "prestashop", {if $current_product} currentProduct: {$current_product|json_encode}, {/if} cartItemsCount: {$cart_info.items_count|default:0}, isLoggedIn: {if $customer_info}true{else}false{/if} }, labels: { placeholder: "{l s='Ask your question...' mod='ailogchat'}", sendButton: "{l s='Send' mod='ailogchat'}" } }; </script> <script src="https://widget.ailog.fr/embed.js" async></script>
Escalation to Human Support
Detecting Escalation Cases
DEVELOPERpythondef should_escalate(conversation: list, last_response: dict) -> bool: """Determine if escalation is needed.""" escalation_triggers = [ # Explicit keywords any(kw in msg['text'].lower() for msg in conversation[-2:] for kw in ['speak human', 'manager', 'complaint', 'lawyer']), # Detected frustration last_response.get('sentiment') == 'negative' and len(conversation) > 4, # Out of scope question last_response.get('confidence', 1) < 0.4, # Unresolved order issue 'order' in conversation[-1]['text'].lower() and len(conversation) > 6 ] return any(escalation_triggers) async def escalate_to_human(conversation: list, reason: str): """Transfer to human agent.""" # Create ticket in PrestaShop ticket = await create_support_ticket( subject=f"Chatbot escalation - {reason}", conversation=conversation, priority='high' ) return f""" I understand you need more in-depth assistance. I've created a support ticket (#{ticket['id']}) and an advisor will contact you as soon as possible. In the meantime, you can also reach us: - By email: support@{shop_domain} - By phone: {support_phone} Thank you for your patience. """
Measuring Effectiveness
Key Metrics
| Metric | Target | How to Measure |
|---|---|---|
| Resolution rate | > 75% | Conversations without escalation |
| Customer satisfaction | > 4/5 | End-of-conversation rating |
| Time saved | > 50% | Tickets avoided vs before AI |
| Response accuracy | > 90% | Manual sample audit |
| Escalation rate | < 20% | Transfers to human |
Analytics Dashboard
DEVELOPERpythondef get_support_metrics(period_days: int = 30) -> dict: """Calculate support performance metrics.""" return { "total_conversations": count_conversations(period_days), "resolved_autonomously": count_resolved(period_days), "resolution_rate": calculate_resolution_rate(period_days), "avg_response_time": avg_response_time_ms(period_days), "avg_satisfaction": avg_csat_score(period_days), "top_topics": get_top_topics(period_days), "escalation_reasons": get_escalation_breakdown(period_days), "cost_savings": estimate_cost_savings(period_days) }
Related Resources
- E-commerce AI Chatbot - E-commerce pillar guide
- Dynamic E-commerce FAQ - Generate contextual answers
- AI Customer Support - Support strategies
- Introduction to RAG - Fundamentals
Automate Your PrestaShop Support with Ailog
Deploying a support assistant on PrestaShop can take weeks. With Ailog, get started quickly:
- PrestaShop module: Simplified installation
- Catalog sync: Automatic and real-time
- Knowledge base: Integrate FAQ and policies
- Smart escalation: Smooth transfer to your agents
- GDPR compliance: French hosting
Try Ailog on your PrestaShop store and reduce your support workload today.
Tags
Related Posts
AI Customer Support: Reducing Tickets with RAG
Automate your customer support with RAG: reduce up to 70% of tier-1 tickets while improving customer satisfaction.
E-commerce AI Chatbot: Boost Conversions with RAG
Deploy an AI chatbot on your online store to increase sales, reduce cart abandonment, and improve customer experience.
Dynamic E-commerce FAQ: Generate Contextual Answers
Create an intelligent FAQ for your online store: personalized answers based on product, customer, and purchase context.