cancel
Showing results for 
Search instead for 
Did you mean: 

File upload facility while order placement

SOLVED

File upload facility while order placement

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?

1 ACCEPTED SOLUTION

Accepted Solutions

Re: File upload facility while order placement

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. 

---
If you've found my answer useful, please give"Kudos" and "Accept as Solution"

View solution in original post

5 REPLIES 5

Re: File upload facility while order placement

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. 

---
If you've found my answer useful, please give"Kudos" and "Accept as Solution"

Re: File upload facility while order placement

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

Problem solved? Click Accept as Solution!

Re: File upload facility while order placement

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.

Features:

  • The customer can upload attachments while ordering or after the order.
  • Customers can notice the uploaded attachment’s file status.
  • Admin can also view the uploaded attachment.
  • The admin can set the number and size of the attachment file.
  • Admin can select supported extensions for their attachment file.
  • Customers can upload new attachments if the admin dislikes the older ones.
  • Admin can approve or disapprove the uploaded attachment.

 

Here are some of the best order attachment extension providers:

 

  1. Mageplaza
  2. Amasty
  3. Fmeextensions
  4. Mageants
  5. Mageworx
  6. Magedelight
  7. Meetanshi
  8. Magesales

 

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

 

AccuWeb Hosting | Magento Hosting

Re: File upload facility while order placement

Hi there,
You can choose this FREE extension: Magento 2 Product Attachment .
Although it's free, I believe it has everything you need.

Re: File upload facility while order placement

Hi @rrronie11180f4 

 

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