My client sells personalized wearables online with the printing facility. He wants to allow customers upload the printable images while ordering wearables, is there any extension for the same which I can use?
Solved! Go to Solution.
Explore our Magento 2 Order Attachment extension which allows drag and drop functionality to upload files on checkout page while placing orders. Supports jpg, jpeg, png, zip, rar, docx, doc, pdf, bmp, gif, xls, xlsx file upload types.
Explore our Magento 2 Order Attachment extension which allows drag and drop functionality to upload files on checkout page while placing orders. Supports jpg, jpeg, png, zip, rar, docx, doc, pdf, bmp, gif, xls, xlsx file upload types.
Hello @hohodo40184672
In Order, the comment is saving on Ajax request. So for this, It will not save file just using input type="file". You need to:
1. Modify Flow Remove entire flow from ajax based to form submit based and add enctype: multipart/form-data.
To Process Comments - Magento\Sales\Controller\Adminhtml\Order\AddComment print_r( $_FILES); // you will get all details about file for upload. And add custom changes to save file and comment.
2.With Current Flow ( Ajax Based ) As Magento2 Is rich with UI components feature. You can also use upload UI components feature.
<div class="upload-wrapper" data-bind="scope: 'uploader'"> </div> <script type="text/x-magento-init"> { ".upload-wrapper": { "Magento_Ui/js/core/app": { "components": { "uploader": { "component": "Magento_Ui/js/form/element/file-uploader", "template": "ui/form/element/uploader/uploader", "allowedExtensions": "png", "uploaderConfig": { "url": "<?php echo $this->getUrl('sales/*/addComment', ['order_id' => $block->getOrder()->getId(),'type'=>'upload']) ?>" } } } } } } </script>
Do some changes to support file upload functionality in sales/*/addComment . Or Create Separate Controller for upload file functionality.
public function execute() { $error = false; // Do something with the file post var_dump($_FILES['files']) $result = ['error'=>$error,'success'=> ($error) ? false : true ]; try { return $this->jsonResponse($result); } catch (\Magento\Framework\Exception\LocalizedException $e) { return $this->jsonResponse($e->getMessage()); } catch (\Exception $e) { $this->logger->critical($e); return $this->jsonResponse($e->getMessage()); } }
3. Get File Path in response and append it in any hidden input to save file path in the comment.
4. And Submit Comment on addComment Action you need to save file path which is in the hidden field.
It may help you!
Thank you
Hello hohodo40184672,
With the help of Order Attachment Extension, customers can upload file attachments to their orders.
Order attachments retain the best usage in real-time such as while uploading attachments for medications, orders for firearms or heavy machinery which require a license, or other types of pharmaceutical products, etc.
Here are some of the best order attachment extension providers:
The above-given are one of the best order attachment extension providers. You can go with any of the above-given providers to make your client upload and use the extension for the same.
I hope the above information will help you to select an extension for your need.
--------------------
Regards,
Rex M
Hi there,
You can choose this FREE extension: Magento 2 Product Attachment .
Although it's free, I believe it has everything you need.
We think it should be a good choice to use MAGENTO 2 PRODUCT ATTACHMENTS
from Landofcoder, which helps to upload and take control over your attachment files on Magento 2 online store.
Add additional attachment files to enrich the content of your website & provide the customers with more detailed information. These files can be under formats such as PDF Zip, MOV, Excel, Word and etc. Moreover, the Magento 2 store admins can add funny and dynamic icons to the attachment files to attract more customers’ attention.
You can check its features here!
Hope it supports you!
Best Regards,
Bavaan Team