Hi all,
This is driving me crazy, and I'm sure it should be a simple thing! I'm a .NET C# dev usually so PHP is a little alien to me, but the concepts all generally translate.
I'm using the Journal2 template, which seems to add a slight layer of complexity and I'm finding it hard to find what calls what and when! Anyway, I'm trying to add a label to the category template (here: "/catalog/view/theme/journal2/template/product/category.tpl") based on a condition, the number of options.
So I can edit "/catalog/model/product.php" and add a value to the "getProduct" array after "'viewed' => $query->row['viewed']". No errors, and if I edit the existing values, it's reflected in the view template without any problems.
However the new value, "no_of_options" I can't get to the template... And if I edit either of the controllers "$products[]" array it's not reflected in the template, by adding the value from the model or just hard-coding a value.
Where am I going wrong here!?
Hi,
The field 'viewed' works because it already exists in the table and the model: http://take.ms/qrDLq
If you want to add a new field, you must add it to:
1. database table
2. product model SQL query in catalog/model/catalog/product.php > getProducts() and in the returned array also
3. add it in the category controller catalog/controller/product/category.php around line 215, where the products fields are set. after this it will be available in the theme, to be 'echoed' with $product['no_of_options'], for example.
The field 'viewed' works because it already exists in the table and the model: http://take.ms/qrDLq
If you want to add a new field, you must add it to:
1. database table
2. product model SQL query in catalog/model/catalog/product.php > getProducts() and in the returned array also
3. add it in the category controller catalog/controller/product/category.php around line 215, where the products fields are set. after this it will be available in the theme, to be 'echoed' with $product['no_of_options'], for example.
Andrei
andrei.opencart[at]yahoo.com
Themes and Extensions
Who is online
Users browsing this forum: Amazon [Bot] and 9 guests