After successful installation your are run magento 2.3.0 project if your front page and admin page showing blank please follow this step.

  • 1. Go to following path and open this file.
    lib\internal\Magento\Framework\View\Element\Template\File\Validator.php
  • 2. code
                
                   protected function isPathInDirectories($path, $directories)
                    {
                        if (!is_array($directories)) {
                            $directories = (array)$directories;
                        }
                        foreach ($directories as $directory) {
                            if (0 === strpos($this->fileDriver->getRealPath($path), $directory)) {
                                return true;
                            }
                        }
                        return false;
                    }
                
              
  • 3. to replase
                
                 protected function isPathInDirectories($path, $directories)
                        {
                            $realPath = str_replace('\\', '/', $this->fileDriver->getRealPath($path));
                            if (!is_array($directories)) {
                                $directories = (array)$directories;
                            }
                            foreach ($directories as $directory) {
                                if (0 === strpos($realPath, $directory)) {
                                    return true;
                                }
                            }
                            return false;
                        }
                
       
  • Remove cache : php bin/magento cache:clean and run you project.


Want to show discount % on list page please follow below steps.


  • 1. Got to this page and open final price file : Magento_Catalog > templates > product > price > final_price.phtml
  • 2. Copy below code and pate after old-price section. <span class="save-per"> <?= 100 - round(($finalPriceModel->getAmount()->getValue() / $priceModel->getAmount()->getValue()) * 100); ?>% Off</span>
  • 3. Please clean cache and check your list page.

How to add category banner to selective category page in magento 2 project? Most of people create this question how to add category banner in magento 2 project. It’s very simple way to add category wise category banner in magento 2 project please follow below steps.

Step 1 : Open you admin penal and login after go to catalog > categories section.

Step 2 : Please select your category page

Step 3 : Now click to upload button and upload your category banner.


if you want to add breadcrumbs in shopping cart page please create below file.
app/design/frontend/vendor/theme/Magento_Checkout/layout/checkout_cart_index.xml


 <?xml version="1.0"?>  
 <!--  
 /**  
  * Copyright © 2013-2017 Magento, Inc. All rights reserved.  
  * See COPYING.txt for license details.  
  */  
 -->  
 <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">  
   <update handle="checkout_cart_item_renderers"/>  
   <body>  
     <referenceBlock name="breadcrumbs">  
       <action method="addCrumb">  
         <argument name="crumbName" xsi:type="string">Home</argument>  
         <argument name="crumbInfo" xsi:type="array">  
           <item name="title" xsi:type="string">Home</item>  
           <item name="label" xsi:type="string">Home</item>  
           <item name="link" xsi:type="string">/</item>  
         </argument>  
       </action>  
       <action method="addCrumb">  
         <argument name="crumbName" xsi:type="string">Shoppint Cart</argument>  
         <argument name="crumbInfo" xsi:type="array">  
           <item name="title" xsi:type="string">Shoppint Cart</item>  
           <item name="label" xsi:type="string">Shoppint Cart</item>  
         </argument>  
       </action>  
     </referenceBlock>  
   </body>  
 </page>  

We have provided very easy step and simple code for your Magento 2 project while page loading.

Step 1. Open your "copyright.phtml" and add this <div class="loader"></div> after </small> tag.
    (Please add this "copyright.phtml" file in this path : Magento_Theme\templates\html)

Step 2. Add this following code.

 <script type="text/javascript">  
      require([  
      'jquery'  
      ], function ($) {  
           $(window).scroll(function(){  
                if ($(window).scrollTop() >= 150) {  
                  $('.page-wrapper').addClass('fixed-header');  
                }  
                else {  
                  $('.page-wrapper').removeClass('fixed-header');  
                }  
           });  
      });  
 </script>  

Step 3. Add this following CSS in your stylesheet.(please create loader image like gif,svg)

 .loader{position:fixed;left:0;top:0;width:100%;height:100%;z-index:99999999;background:url(../images/pageLoader.svg) 50% 50% no-repeat #000}  

Step 4. Please clean cache: php bin/magento cache:clean

Now refresh your page and show result.

Note : if this example not works please add this jquery :
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>  


How to create magento static block and how to call CMS page, phtml file and XML file.

Please follow example code.
________________________________________________________________________________

How To create Static Block

Step 1 : Content > Blocks


Step 2 : Click to Add New Block

Step 3 : Enter your Block name ID name and save block



How to call statick block in magento 2

Magento 2 static block call in phtml file.

 <?php echo $block->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId('example-name')->toHtml();?>  


Magento 2 static block call in CMS page

 {{block class="Magento\\Cms\\Block\\Block" block_id="example-name"}}  


Magento 2 static block call in XML file

 <referenceContainer name="content">  
 <block class="Magento\Cms\Block\Block" name="example-name">  
 <arguments>  
 <argument name="block_id" xsi:type="string">example-name</argument>  
 </arguments>  
 </block>  
 </referenceContainer>  




Sticky navigation with animation in down effect.

 

Step 1 : Open your "header.phtml" file.

Step 2 : Copy below javascript code and past header.phtml file in bottom.

 <script type="text/javascript">  
      require([  
      'jquery'  
      ], function ($) {  
           $(window).scroll(function(){  
                if ($(window).scrollTop() >= 150) {  
                  $('.page-wrapper').addClass('fixed-header');  
                }  
                else {  
                  $('.page-wrapper').removeClass('fixed-header');  
                }  
           });  
      });  
 </script>  

Step 3 : Copy below CSS and paste in css file.

 .fixed-header.page-wrapper .nav-sections{position:fixed;z-index:9;top:0;width:100%;margin-top:0;animation:nav-down .7s;}  
 @keyframes nav-down {  
 0%{transform:translateY(-100%)}  
 100%{transform:translateY(0)}  
 }  

Step 4 : Please clean cache : php bin/magento cache:clean

Now refresh your browser and scroll down.

Info
: This example use only in magento project if you want other project use please change class name.

Know us

Contact us

Name

Email *

Message *