Mobile app version of vmapp.org
Login or Join
Pope3001725

: Adding attributes to the category.tpl file in opencart I'm new to opencart, but am an experienced web developer. I am in the process of upgrading an old website, to a new website (1.5.4 to

@Pope3001725

Posted in: #Opencart

I'm new to opencart, but am an experienced web developer. I am in the process of upgrading an old website, to a new website (1.5.4 to 2.3.0.2). We are almost done, but have come across an issue where our catalogviewthemejournal2category.tpl files are having trouble referencing any of the pre-made attributes / attribute groups... Previously, on the old website, the category pages showed attributes in the product listing (category.tpl), and we would like to do the same on the new website.

Problem: When I try to add those attribute variables into the code I get an error; "Notice: Undefined variable:"
... digging around the internet and forums, it is said that you need to add the code into the catalogcontrollerproductcategory.php file.;
'attribute_groups' => $this->model_catalog_product->getProductAttributes($result['product_id']),
...Upon adding that, nothing happened.

So I got to thinking, what happens if I created a simple variable on the category.php file; $variable= 'variable'; and then echo $variable, on the category.tpl file? "Notice: Undefined variable:"

Then I tried to echo a simple hello world; Hello World'; ?> within the catalogcontrollerproductcategory.php file (nothing happened).

Next I decided to comment out the entire category.php file, and the page did not break...

I then confirmed that the page is indeed being referenced in some way by changing the page name category0.php, and I did get an error and a white screen (which is good that it is referenced).

I get the feeling that the page isn't referencing CORRECTLY or something. None of the variables I create are being referenced. I could be totally wrong on my prediction, but any thoughts? Is there anyway that I can get any simple variable to work? I can't even debug this any further.

-Thanks, Michael P.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Pope3001725

1 Comments

Sorted by latest first Latest Oldest Best

 

@Sarah324

It was as simple as a caching issue! ... Within the Admin Panel > Opencart modifications had to be refreshed.

...This is not something that someone new to Opencart would know.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme