PrestaShopProduct
The PrestaShopProduct component allows you to interact directly with your e-commerce store using PrestaShop. It helps you automate tasks like listing products, updating stock levels, changing prices, or removing items. You can use this component in your workflows to keep your product data synchronized with other applications, manage inventory efficiently, or trigger actions based on product changes.
How it Works
This component connects to the PrestaShop Webservice API. When you configure it, Nappai sends requests to your store to perform specific actions based on the inputs you provide.
- Reading Products: You can fetch details about specific products or retrieve a list of products using filters.
- Creating Products: You can add new items to your catalog by providing details like name, price, and quantity.
- Updating Products: You can modify existing product information, such as updating stock levels or changing prices.
- Deleting Products: You can remove products from your store catalog.
The component handles the connection securely and returns the results, allowing you to pass data to other steps in your automation.
Connection & Credentials
This component requires configuring a credential in the Nappai panel before interacting with the external service:
- Go to the Credentials section in your Nappai panel.
- Create a new credential of the type PrestaShop and fill in the required fields:
- Shop URL: Your store’s web address (e.g.,
https://my-shop.com). - PrestaShop Api Key: Your secret API key from PrestaShop. You can generate this in your PrestaShop admin panel by going to Advanced Parameters > Webservice. Make sure to enable the web service and grant permissions to the key.
- Shop URL: Your store’s web address (e.g.,
- In your workflow, select the saved credential in the Credential input field of this node.
Inputs
Mapping Mode
This component has a special mode called Mapping Mode. When you enable this mode using the toggle switch, each input field offers you three different ways to provide data:
- Fixed: You type the value directly into the field.
- Mapped: You connect the output of another component to use its result as the value.
- Javascript: You write Javascript code to dynamically calculate the value.
This flexibility allows you to create more dynamic and connected workflows.
Input Fields
- Operation: Select the PrestaShop operation to perform.
- Query Type: Get products list or a specific product by ID.
- Product ID: The ID of the product to get, update, or delete.
- Max Results: The maximum number of products to return.
- Filter by Category: Filter products by category.
- Product Name: The name of the product.
- Description: The description of the product.
- Price: The price of the product.
- Quantity: The stock quantity of the product.
- Category: The category of the product.
- Active: Whether the product is active/visible in the store.
- Reference (SKU): The product reference/SKU code.
- Image URL: Public URL of the product image (jpg, png) to upload to PrestaShop.
Outputs
Output Data Example
The component returns a Data object containing the details of the product after the operation is completed. You can use this output to pass information to other components, such as sending emails, updating databases, or triggering further actions. json { “id”: 1234, “name”: “Wireless Mouse”, “price”: 25.99, “quantity”: 150, “active”: true, “reference”: “WM-001”, “description”: “Ergonomic wireless mouse with long battery life.”, “imageUrl”: “https://store.com/images/mouse.jpg”, “category”: “Electronics”, “status”: “success” }
Connectivity
This component typically connects to other parts of your workflow to manage e-commerce data:
- Inputs: The
Credentialinput connects to your saved PrestaShop credentials. Other inputs likeProduct IDorQuantityoften receive data from triggers, spreadsheets, or other data sources in your workflow. - Outputs: The
Dataoutput is useful for passing product details to subsequent actions, such as notifying your team via email, updating a CRM, or syncing with a shipping provider.
You might use this component after a trigger that detects a low stock level, or before sending an invoice to ensure product details are accurate.
Usage Example
Scenario: Updating Product Stock
You can use this component to automate inventory updates. For example, when a new order arrives in your system, you can connect the order details to this component. Set the Product ID to the ID of the item sold and map the Quantity to the new stock level. The component will update your PrestaShop store automatically. You can then use the output Data to send a confirmation message or log the update.
Tips and Best Practices
- Development Mode: This component is currently in development mode. We recommend testing your workflows in a sandbox environment before using them with live store data to ensure everything works as expected.
- Mapping Mode Power: Enable Mapping Mode to create dynamic workflows. For example, you can map the
Priceinput to calculate a discount based on a formula, or map theProduct IDto pull values from a list of items. - API Permissions: Ensure your PrestaShop API Key has the necessary permissions to read and write product data. If you encounter errors, check the key’s configuration in PrestaShop.
- Performance: When retrieving lists of products, use the
Max Resultsinput to limit the number of items returned. This helps keep your workflows fast and efficient, especially for large catalogs. - Image Uploads: To upload product images, provide a public URL in the
Image URLfield. The image must be accessible over the internet.
Security Considerations
- Secure Credentials: Your API Key is a sensitive secret. Nappai encrypts credentials securely. Never share your API Key or include it in publicly accessible parts of your workflow.
- HTTPS: Ensure your PrestaShop store URL uses HTTPS to maintain a secure connection.
- Least Privilege: When generating API keys in PrestaShop, grant only the permissions required for your workflow. Avoid using keys with full admin access if your workflow only needs to update specific product data.