Post by djbigsnax » Wed Aug 19, 2009 10:22 am

What code do I need in the category controller to get the product description to populate and use on the category.tpl?

Newbie

Posts

Joined
Mon Aug 17, 2009 12:37 pm

Post by djbigsnax » Wed Aug 19, 2009 10:42 am

/smacks self in head

So I should have read the posts below this one... here is the answer:

in the category controller
/catalog/controller/product/category.php

find:

Code: Select all

					$this->data['products'][] = array(
            			'name'    => $result['name'],
						'model'   => $result['model'],
            			'rating'  => $rating,
						'stars'   => sprintf($this->language->get('text_stars'), $rating),
						'thumb'   => image_resize($image, $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height')),
            			'price'   => $price,
						'special' => $special,
						'href'    => $this->model_tool_seo_url->rewrite($this->url->http('product/product&path=' . $this->request->get['path'] . '&product_id=' . $result['product_id']))
          			);
        		}
and add 'description' => $result['description'] to the end like this:

Code: Select all

					$this->data['products'][] = array(
            			'name'    => $result['name'],
						'model'   => $result['model'],
            			'rating'  => $rating,
						'stars'   => sprintf($this->language->get('text_stars'), $rating),
						'thumb'   => image_resize($image, $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height')),
            			'price'   => $price,
						'special' => $special,
						'href'    => $this->model_tool_seo_url->rewrite($this->url->http('product/product&path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'])),
						'description' => $result['description']
          			);
        		}
Then in the template file:
/catalog/view/theme/default/template/product/category.tpl

use this code to display:

Code: Select all

<?php echo html_entity_decode($products[$j]['description']);?>
Hope that was all right... back to my client

Newbie

Posts

Joined
Mon Aug 17, 2009 12:37 pm
Who is online

Users browsing this forum: No registered users and 5 guests