Finding and fixing template Syntax errors
Viewing Syntax and Runtime errors on a page
While viewing your StoreFront, you may notice the Admin panel at the top of the page. This is only displayed when you are logged in to your account. When you have Syntax errors for example the Admin bar will display this information within the Developer tools section and be highlighted in red.
Depending on the error you may also see code on the screen like.
For this example the error is letting us know that there is a syntax error within the "product_grid.vm" template. Because of the error it could not be displayed and error message is displayed in its place.
Finding Syntax errors.
For this example we know that the error is within the "product_grid.vm" template, however you can also use the File Manager to locate the exact template and any other templates that may have errors.
StoreFronts → File Manager
From the File Manager screen, simply click on the "Files with Compile errors" Icon. This will filter out only the files that have errors.
As you can see, the system locate all the files with syntax errors. In this example we only have 1 file with an error, however it is possible to have many files display here with errors.
Now that we have the file with the error we can simply click on the file Name to view the code.
After click on the file name the system will pull up the editor with a display of some basic information in regards to the error, for example what line and column the error was found on.
As we can see the system is telling us there is an issue on line 28, column 7.
if they're not experienced in template programming, please get help.
Resolving the Error
Now this information alone may not be enough to tell us exactly what the issue is, but we do know that it was working before.
One of the most powerful tools within the StoreFronts and the file Manager is the version control, this allows UltraCart to keep the different versions of a template as they are edited. If we go back to the "Files with Compile errors" display.
We can see that there are currently 8 versions of this file, if we click on the number of version we can see a display of all the revisions, the users that saved the change and the date of the change.
Because we know the page was working before, we can simply go to the last version of the file and click on the "diff" button to view the changes in the file.
The system will provide a side by side view of the current version of the file and the diff file we selected. For this example it looks like a ")" was removed from line 27 that is now causing the syntax error on line 28. We can revert this change by simply clicking on the arrow to the left of file display.
This will then update the current file to resolve the issue. From here we simply click "Save" to keep our changes. Now if we go back to the site we can see there is no longer an error on the page or within the Admin bar.