Cant use dump() function in twig files or how to enable debug in opencart twig or print_r alternate use dump() in opencart 3.0
if you are facing the following problem.
Cant use dump() function in twig files
or
how to enable debug in opencart twig
or
print_r alternate use dump() in opencart 3.0
for fixing this problem follow these steps
You can activate dump() function for twig environment by following these steps in opencart 3.0 :
- Go to system/library/template/Twig/Environment.php
- Here in the constructor function, you can find $options array. Set 'debug' option to 'true'.
- Now we need to include debug extension, so
- add $this->addExtension(new Twig_Extension_Debug()); below.
- Now you can use {{ dump(your_variable_name) }} as print_r variable in php