digitalmarketing and seo
Slide 1

We Designed for

Web Development
Image is not available

In the dynamic landscape of digital presence, harnessing the power of effective web development is paramount. At TAG VIBE....

Slide 2

We Designed

App Development
Image is not available

In today's mobile-centric world, having a mobile app is essential for reaching and engaging with your
audience....

Slide 3

We Designed

Digital Marketing & Search Engine Optimization
Image is not available

we great to do digital marketing and search engine optimization work as per google rule and regulation....

previous arrowprevious arrow
next arrownext arrow

How to debug Magento 2 issues?

Spread the love
  • First Step is to check ./var/log directory in Magento 2 installation whether any errors or exceptions in logs, report or you can check the system.log, debug.log.
  • If you Magento application is in default or production mode then you will see the  ‘There has been an error processing your request’ message on page front, grab the report id from that message and check ./var/report directory to get the exact error.
  • If you want to see the error message directly in the browser , run php bin/magento deploy:mode:set developer command to switch to developer mode.
  • 3rd step is to make sure that you have all the correct permission Use chown(change owner) and chmod (change mode) for you Magento files and folder.
  • Check the web server logs. Nginx for var/log/nginx and  for Apache it’s /var/log/apache2 or /var/log/httpd.
  • Clear Magento 2 cache files by running the php bin/magento cache:clean command.
  • you can also add the belwo code in your index.php
    • the ini_set(‘display_startup_errors’,1);
    • ini_set(‘display_errors’,1);
    • error_reporting(-1);

Debug the Frontend JS issue

  • Check browser console for the errors and resolve accordingly.
  • If you are using any third party cache like varnish please clear the cache.
  • Enable the template path hints by navigate to the Go to Admin Panel > Stores > Settings > Configuration > Advanced > Developer > Debug. to know the correct block and phtml file to debug in specific file.

Debug the Knockout JS issue

  • At first we need to get a Knockout instance from the browser console.
    • var ko = require('knockout');
  • Now we have Knockout instance in the ko variable. We can use it to get a context of any DOM element.
var context = ko.contextFor($0);
  • where $0 is a special variable in browser console. It contains a link to a DOM element that is last inspected.
// Admin > Products > Catalog > Add Product
// Inspect "Product Name"
var fieldName = ko.contextFor($0).$data;

console.log(fieldName.name); // product_form.product_form.product-details.container_name.name

OR

You can install this https://chrome.google.com/webstore/detail/knockoutjs-context-debugg/oddcpmchholgcjgjdnfjmildmlielhof?hl=en knockout debugger and debug.


Hope this article helped you in some way. Please leave us your comment and let us know what do you think? Thanks.

Scroll to Top