Post by _michael_ » Thu Nov 03, 2016 5:37 am

Hi, 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 catalog\view\theme\journal2\category.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 catalog\controller\product\category.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; <?php echo '<p>Hello World</p>'; ?> within the catalog\controller\product\category.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.

Newbie

Posts

Joined
Thu Nov 03, 2016 5:10 am

Post by _michael_ » Thu Nov 03, 2016 8:22 pm

Does anyone have any idea why this could be happening?
...Is this an issue caused by upgrading? Or are the variable declared wrong?

Any help would be greatly appreciated. Or any tips to how I might go about debugging my problem.
-Thanks!

Newbie

Posts

Joined
Thu Nov 03, 2016 5:10 am

Post by _michael_ » Fri Nov 04, 2016 3:35 am

...I take it no one has come across this issue, or uses opencart :-[

Newbie

Posts

Joined
Thu Nov 03, 2016 5:10 am

Post by IP_CAM » Fri Nov 04, 2016 4:03 am

just to reply, just better don't expect much, when it comes to socalled 'upgraded' Shops, especially, if
one does not EXACTLY inform others, on, how such an attempted 'Upgrade' has been done, or at least, tried.
This, because, there is, and never was, no such Thing as an official UPGRADE for v.1.5.x to v.2.x Versions,
just a handfull of Custom Attempts, and most of them only contain 'parts' of, what eventually would have to
be done, and changed, moved, and replaced, to really 'upgrade' an older Version. Not to speak about Mod's,
most of them won't work anymore. In addition, every V-2 release was different from the other, for each one,
specific Things would matter...

It would take time, lot's of time, and time is money, for Shop owners equally as for Dev's. One has to accept this.
Good Luck, no offense, just information! ;)
Ernie

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by _michael_ » Fri Nov 04, 2016 4:56 am

I appreciate the response, you did answer one of my questions about modules not being compatible.

The main question I have though is not in regards to modules. It's in regards to defining a variable of any of sort (preferably the attributes) on the category.php page, and the printing out that variable in the category.tpl page.
I don't care how basic the example is, I just want to start from square 1 to see if anything is working in that regard (like i said i feel like it's not referencing correctly). And keep in mind I am using 2.3.0.2.

-Thanks, Michael.

Newbie

Posts

Joined
Thu Nov 03, 2016 5:10 am

Post by opencartboost » Fri Nov 04, 2016 7:33 am

May be to add product attribute you can learn from how to add product option, because attribute and option have similarity.
http://stackoverflow.com/questions/1983 ... f-opencart
Yes, you need add code to category.php and category.tpl

Attention code for public function getProductAttributes($product_id) and public function getProductOptions($product_id)
at catalog/model/catalog/product.php

Active Member

Posts

Joined
Thu Jul 09, 2015 5:59 am

Post by _michael_ » Sun Nov 06, 2016 12:33 am

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.

Newbie

Posts

Joined
Thu Nov 03, 2016 5:10 am

Post by IP_CAM » Sun Nov 06, 2016 1:14 am

well, for those, eager to find out first, instead of wasting time later, it has been explained in detail on multiple Sites,
as well as in uncounted Postings around this Place.
It's one of those things, required to know, for everyone, trying to 'manipulate' such a comprehensive System.
Ernie

http://ocextensions.co.uk/ocmod/ocmod
http://docs.opencart.com/extension/modifications/
http://www.opencartexpress.com/how-to-use-ocmod
https://isenselabs.com/books/allbooks

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland
Who is online

Users browsing this forum: Google [Bot] and 164 guests