PrestaBuy MinSync is a BigBuy integration module designed to provide essential synchronization functionalities with the BigBuy dropshipping supplier.
Main Goals: Convenient Import of categories and product catalog into “CMS PrestaShop 1.8” using the “BigBuy” REST API
MVP Module: BigBuy Minimal Sync. Main MVP Functions:
- Settings: Input of the BigBuy API key with the ability to select the environment (Production, sandbox). Selection of the main language for synchronization (from those installed in PS)
- Import of Categories (Cron/Manually): (Mandatory on the first module launch) Creation/update and mapping of selected categories from BigBuy to PrestaShop, taking into account multilingualism (for all active PS languages).
- Synchronization of Products (Cron/Manually): Creation/update of products from selected (previously created) BigBuy categories in PrestaShop.
- Synchronization/update of only the fields selected in the settings (name, description, price, stock, image, etc.).
- Taking into account multilingualism for text fields.
- Synchronization of basic prices (retail, wholesale prices, without special markup rules for MVP).
- Synchronization of stock levels.
- Sending Orders to BigBuy: Automatic sending of orders containing products from BigBuy upon their confirmation in PrestaShop.
- Logging: Basic logging of synchronization operations and API requests (as in the layout).
2. Technical Stack and Architecture:
- PrestaShop: > 8.2
- PHP: Pure PHP, PrestaShop standards.
- JavaScript/AJAX: Minimum (ideally only for non-critical UI improvements, if very necessary, but page reloading can suffice for MVP).
- Module Structure (bbminsync):
- bbminsync.php: Main module class. Installation/removal, hook registration, configuration entry point.
- /controllers/admin/AdminBbminsyncConfigController.php: Configuration page controller.
- /classes/ (or /src/ for PS 8+):
- /Service/BigBuyApiService.php: Encapsulates all logic for interaction with the BigBuy REST API (authentication, requests to category, product, order endpoints, response and error handling).
- /Service/CategorySyncService.php: Category synchronization logic.
- /Service/ProductSyncService.php: Product synchronization logic, including prices and stock levels.
- /Service/OrderSyncService.php: Logic for processing and sending orders to BigBuy.
- /Repository/MappingRepository.php: Working with the mapping table (PrestaShop ID <-> BigBuy ID relation).
- /Form/ConfigurationFormProvider.php: (Optional, can be in the controller) Preparing data for the configuration form.
- /Handler/ConfigurationFormHandler.php: (Optional, can be in the controller) Processing configuration form data.
- /Logger/FileLogger.php: Simple service for writing logs to files.
- /views/templates/admin/configure.tpl: Configuration page template (based on the layout).
- /sql/install.sql: SQL for creating the mapping table.
- /sql/uninstall.sql: SQL for deleting the mapping table.
- cron.php: Script for launching background synchronization tasks (requires server configuration and passing a secret token).
The module does NOT support multi-stores!!!!
V 1.2.0
1. Category Synchronization Fixed: Resolved an issue where the module failed to read the categories
selected for import (the result was always “Created 0”). The problem was caused by an incorrect
key during form data processing.
2. Product Import Fixed:
* Eliminated a fatal UndefinedMethodError caused by a call to a non-existent API method.
* Based on the BigBuy API documentation, the correct method for fetching products by category
was implemented (/rest/catalog/products.json with the parentTaxonomy parameter).
* The logic was optimized: the module now makes only one API request per parent category, even
if multiple of its child categories are selected for import. This has removed duplicate
errors from the logs.
3. Stock Retrieval Fixed: Resolved the 400 Bad Request error that occurred when fetching stock for
each product. The correct endpoint (/rest/catalog/productstockbyhandlingdays/{id}.json) was
identified from the documentation and implemented.
4. Shipping Calculation Debugged: We analyzed and corrected the shipping cost calculation request,
ensuring it matches the format from previous successful logs. The current issues with fetching
carriers are confirmed to be related to limitations and data instability within the BigBuy
sandbox environment.