PrestaShop is a popular platform for creating online stores, but its standard product import tool has several significant drawbacks. In this article, we will explore common issues that users face when importing products and provide solutions to address these problems.
Key Problems with Product Import in PrestaShop
1. Misunderstanding Field Mapping
One of the most common challenges is the mapping of fields during the import process. On the second step of the import, PrestaShop asks users to map fields from the import file to fields in the database. For example, the “reference” column in the import file corresponds to the product reference in PrestaShop.
Many users skip this step, which results in errors. Mapping is essential because it tells PrestaShop where to store the data. Without it, the system won’t process the information correctly.
2. Skipping Unnecessary Columns
Another common issue is the inclusion of unnecessary columns in the import file. Import files may contain columns that aren’t needed in PrestaShop. If these columns are not skipped, PrestaShop will attempt to process them, leading to errors and confusing the user.
For example, technical data that isn’t relevant to PrestaShop should be skipped during the field mapping step.
3. Server Limitations and Performance with Large Quantities of Products
When importing a large number of products, users often encounter server limitations. On a weak hosting plan, where script execution time and available memory are limited, the import process can fail.
Take this example: on a weak hosting plan, the average time to import a single product in PrestaShop can be about 5 seconds. If you're importing 50,000 products, this will take approximately 69 hours:
5 seconds × 50,000 products = 250,000 seconds = 69 hours
This is an enormous wait time, and if the server cannot handle the load, the import will frequently fail.
Solution:
- Increase the script execution time (
max_execution_time
) and memory limit (memory_limit
) in your server settings. - Consider moving your store to a more powerful server or using hosting optimized for PrestaShop.
4. Special Characters in Product Names
One of the most frustrating issues is the interruption of the import process due to special characters in product names. If the product name contains characters that PrestaShop doesn’t support (e.g., #
, =
, {
, }
), the import will stop completely. This is especially troublesome when thousands of products have already been uploaded, and the process stops at a single problematic product.
For example, if 30,000 products have been uploaded successfully, but the 31,000th product has an invalid name, the entire process will stop, requiring you to manually find and fix the error before continuing.
Solution to the Special Characters Problem:
To prevent this issue, you can clean the product names of any invalid characters before the import. To do this, you need to edit the /controllers/admin/AdminImportController.php file at line 1614.
Find the productImportOne
method and add the following code to clean the product names:
if (isset($info['name'])) {
$info['name'] = mb_strimwidth(
str_replace(['#','=',';','<','>','{','}'], ['', '-', '', '', '', '', ''], (string)$info['name']),
0, 128
);
}
This code replaces problematic characters and limits the product name to 128 characters, which meets PrestaShop’s requirements.
Important: You need to override this class to ensure that your changes are not lost during future PrestaShop updates. This can be done through PrestaShop's class override mechanism.
Conclusion
The product import process in PrestaShop can be improved by properly setting up field mapping, skipping unnecessary columns, and accounting for server limitations. Cleaning product names of invalid characters will prevent the import from stopping halfway and save you time.
We hope that the PrestaShop team will improve the import process in the future, making it more reliable and user-friendly.
In the meantime, share your experiences with PrestaShop product import in the comments: what problems have you encountered, and how did you solve them?