I’m using Smartwave Porto theme for my Magento 2 website. When I load my website for the first time it’s loading properly, but every time I refresh the browser page it will show an error like this in browser console and my page does not load properly:
1 2 3 4 |
Uncaught TypeError: $(...).swMegamenu is not a function Uncaught TypeError: $(...).stellar is not a function Uncaught TypeError: $(...).owlCarousel is not a function Uncaught TypeError: $.widget is not a function |
I just do below changes :
Create a requirejs-config.js in the root of the child theme (you can also do this on root theme if you have not created a child theme) as per Porto child like this:
app/design/frontend/Smartwave/porto_child and add the following code in it:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
var config = { shim: { jquery: { exports: '$' }, 'Smartwave_Megamenu/js/sw_megamenu': { deps: ['jquery'] }, 'owl.carousel/owl.carousel.min': { deps: ['jquery'] }, 'js/jquery.stellar.min': { deps: ['jquery'] }, 'js/jquery.parallax.min': { deps: ['jquery'] } } }; |
And also change child theme layout file at:
app/design/frontend/Smartwave/porto_child/Magento_Theme/layout/default_head_blocks.xml
From:
1 2 3 |
<script src="jquery.js" /> <script src="bootstrap/js/bootstrap.min.js" /> <script src="fancybox/js/jquery.fancybox.js" /> |
To:
1 2 3 |
<remove src="jquery.js" /> <remove src="bootstrap/js/bootstrap.min.js" /> <remove src="fancybox/js/jquery.fancybox.js" /> |
I don’t need the fancybox, So I have turned it off, but if you require it, I guess it should be included in the requirejs as well. If you face the same issue, follow the above steps to solve it.
If you want get query string params in controller file,...
Create di.xml and add the below code Magemonkey/Redirect/etc/frontend/di.xml [crayon-6284585913948531888429/] Create...
You can try below code to change local date to...
Step 1: First you need to add registration.php file in...
Step1 : Override message.js in current theme file on the...