Hello All.
I have a question about adding a variable to the Category / Grid view of my site.
First off a little background.
I am using a template. On the product page there is a line of code that produces the model number below the product name. Here is an screen shot and snippet from the product.tpl:
here is the code line:
"<span>Item Number: </span> <?php echo $model; ?><br />"
______________________________________________________________________________________________________
my goal and question
I want to add this exact line to my category / grid view.
I placed this line of code in the category.tpl.
example:
"<?php if ($product['thumb']) { ?>
<div class="image"><a href="<?php echo $product['href']; ?>"><img id="img_<?php echo $product['product_id']; ?>" src="<?php echo $product['thumb']; ?>" title="<?php echo $product['name']; ?>" alt="<?php echo $product['name']; ?>" /></a></div>
<span><?php echo $text_model; ?></span> <?php echo $model; ?>
<?php } ?>
<div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div>
<div class="description"><?php echo $product['description']; ?></div>
<?php if ($product['price']) { ?>"
When I bring up the category list I am getting and error on the page.
Example:
Undefined variable: model in /home/microtrains/public_html/catalog/view/theme/theme167/template/product/category.tpl on line 208
How do I define this variable in category.tpl so that the item number is displayed along with the other product informtion.
Thanks for you help.
nwdrummer
The variable needs to be defined in the controller so the template can use it.
edit: catalog/controller/product/category.php
find
Add after
edit: catalog/controller/product/category.php
find
Code: Select all
'product_id' => $result['product_id'],
Code: Select all
'model' => $result['model'],
Who is online
Users browsing this forum: No registered users and 4 guests