I'm trying to get the category ID so then I can load some script for that particular category. I used this method - How to get current category id - OpenCart 2.0 and it did work but then for some reason I started to get the error message
Notice: Undefined variable: cat_id in \www\ocart2\vqmod\vqcache\vq2-system_modification_catalog_view_theme_template_product_product.tpl on line 667
Can anyone give me some suggestions or help in the right direction please?
it's only a notice, so no real problem.
It states that cat_id
might not be set, because it's set in an if-statement. You should set it befor that, to be on the save side:
<?php
$cat_id = ''; // <<
if(isset($this->request->get['path'])) {
$path = $this->request->get['path'];
$cats = explode('_', $path);
$cat_id = $cats[count($cats) - 1];
}