Hi everyone,
I'm new to the forum and I wanted to share a module that I’ve modified. I found it very useful and noticed that this functionality isn’t available in the default version. I thought it could be helpful for others too — hope you find it useful!
This customization extends the default productcomments module to support image attachments on customer reviews.
example (in Italian)

I'm new to the forum and I wanted to share a module that I’ve modified. I found it very useful and noticed that this functionality isn’t available in the default version. I thought it could be helpful for others too — hope you find it useful!
PrestaShop productcomments Module – Custom Image Upload Support
This customization extends the default productcomments module to support image attachments on customer reviews.
Features Added
- Users can upload one image per product comment.
- Uploaded images are saved to /modules/productcomments/uploads/.
- The image filename is stored in the database (image column in product_comment table).
- Images are displayed alongside reviews on product pages.
- Responsive layout: on mobile, the image stacks above the comment text.
- Styling matches the existing PrestaShop theme.
- Labels and UI elements are localized in Italian.
Backend Changes
- Added image column to the product_comment table.
- Extended the ProductComment Doctrine entity with an image field and relevant getter/setter.
- Updated PostComment.php to:
- Handle image file uploads.
- Resize and compress images using the GD library.
- Save the file and associate its name with the comment entity.
- Modified ListComments controller to include the image in the JSON response.
- Updated ProductCommentRepository:
aginate() to retrieve the image column.
Frontend Changes
- Edited post-comment-modal.tpl to include an image upload input field.
- Modified JavaScript submission function to use FormData() for file transfer.
- Updated productcommentitemprototype.tpl template to render the uploaded image.
- Extended the JS logic to inject the image filename using @COMMENT_IMAGE@.
Styling (CSS)
- Styled file input to match PrestaShop buttons and overall design.
- Ensured image appears on the left of the comment text on desktop, and stacked above on mobile.
- Replaced browser default file input text with a custom label ("Scegli il file").
- Removed default filename display for a cleaner UI.
- Improved responsive behavior and alignment across screen sizes.
example (in Italian)
