Post by liyen » Fri Nov 20, 2009 1:17 pm

Dear all,

I'm trying to add thickbox effect to the product image when they show under category in grid view.

I have changed the link on the product image in the product/category.tpl

from:
<a href="<?php echo $popup; ?>" title="<?php echo $heading_title; ?>" class="thickbox"><img src="<?php echo $products[$j]['thumb']; ?>" title="<?php echo $products[$j]['name']; ?>" alt="<?php echo $products[$j]['name']; ?>" /></a>
to:
<a href="<?php echo $popup; ?>" title="<?php echo $heading_title; ?>" class="thickbox"><img src="<?php echo $products[$j]['thumb']; ?>" title="<?php echo $products[$j]['name']; ?>" alt="<?php echo $products[$j]['name']; ?>" /></a>
Then I added the code marked in red to the controller/product/category.php
$this->data['products'] = array();

$results = $this->model_catalog_product->getProductsByCategoryId($category_id, $sort, $order, ($page - 1) * 12, 12);

$this->load->helper('image');

foreach ($results as $result) {

if ($result['image']) {
$image = $result['image'];
$popup = image_resize($image, $this->config->get('config_image_popup_width'), $this->config->get('config_image_popup_height'));
} else {
$image = 'no_image.jpg';
}
However, the thickbox effect not working and the link on the product image appear like: Undefined variable : popup

I thought I already defined it in the controller/product/category.php ? or is it I missed out something from the code?

Thank you!

Newbie

Posts

Joined
Tue Oct 06, 2009 2:55 pm

Post by Qphoria » Mon Nov 23, 2009 11:56 am

You defined it in the controller, but not in a way to pass it to the template

after that code, you need to add:

Code: Select all

$this->data['popup'] = $popup;

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am
Who is online

Users browsing this forum: No registered users and 6 guests