Error: main.CRITICAL: Invalid parameter given. A valid $fileId[tmp_name] is expected in Magento 2

Have you ever faced the above-mentioned issue in your local development area? If yes, then we have a solution for you.

Note: This is the temporary solution we don’t recommend changing the core files.

Go to ‘vendor/Magento/Framework/File/Uploader.php’

In function ‘_setUploadField($field)’, comment out ‘$this->validateFileId($field)’ after doing this your function should be simile to following image.


Line numbers in the above screenshot may vary based on your magento version.

Let us know if this solution helped you or not by commenting on our blog

Happy coding 🙂

How to add if condition in transactional emails

Have you ever wonder or faced situation where you want to add condition block in transactional email? If yes, we have solution for you. Please go through all the possible solution.

Solution 1: use depend tag which check whether that variable has some value or not.

{{depend shipping_company}}
               <h1>Your shipment is on its way.</h1>
             <img src="{{media url=wysiwyg/logo-dpd.png}}" alt="" />

If you have some advance condition using block technique.

Solution 2: Block technique for advance conditioning

{{block class='Magento\\Framework\\View\\Element\\Template' 
               area='frontend' template='Codedecorator_Learn::email/shipping_company.phtml' shipping_company=$shipping_company}}

Add above block code in your email template and create new phtml template in your plugin like following:

        if($block->getData('shipping_company') !='dpd') {
                echo $block->getData('shipping_company'); 

I hope above this post help you in your task.

Happy Coding 🙂

How to Add Date Picker in Custom Form

In this post , we are going to see how we can add date picker in custom form at Backend or Frontend.

<div class="admin__field">
      <label for="delivery_date" class="admin__field-label"><?= $block->escapeHtml(__('Shipment Delivery Date')) ?></label>
         <div class="admin__field-control">
           <input name="delivery_date" type="text" class="input-text" id="delivery_date" />
    ], function () {
            dateFormat: 'dd/mm/yy',
            changeMonth: false,
            changeYear: false

We have to add HTML block and javascript code in same phtml to make date picker work. Let us know if you are facing any issue about the same.

Happy Coding 😀

How to Override comment history order in backend

We have recently worked on backed for one of customer who wants additional information in comment history form so we have override the following layout in order to make it work.

We have override both sales_order_view.xml with order_history block name.

<?xml version="1.0"?>
<page xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <referenceBlock name="order_history">
            <action method="setTemplate">
                <argument name="template" xsi:type="string">Codedecorator_Learn::order/view/history.phtml</argument>

You can now copy the history.phtml from the core and paste in your module and you can easy customize it or add new fields in your form.

Let’s us know that above code snippets helped your or not. If you have any doubt or any queries. Please do comment in our blog post.

How to add banner on the category sidebar in Magento 2

Have you ever required to add some offers and promotions banner on your website ? I guess answer is ‘Yes’.

Here we have described how can you easily add a banner to the category sidebar even you do not have knowledge of coding because it is really easy to do with Magento 2 admin.

To add a banner in the sidebar follow the below steps.

  1. Create Bock

First, you need to create a bock and add a banner image. You can design it with HTML code if you want.

To add Block go to ‘Admin->Content->Blocks->Add New

create block
  1. Create Widget

Once you create a block, just go to the widget and add a block to the ‘category page sidebar’.

To add widget go to ‘Admin->Content->Widgets->Add new

Check the below screenshot to know the information to be feeling up in Widget.

Create Widget – 1
Create Widget – 2

  1. Flush Cache

Once you finish all the above steps just go to ‘Admin->System->Cache Management’ and flush the cache.

Happy coding 🙂