davey c wrote:Is there a way to make the product extra fields display in the category page?
I can make stock status etc appear, but am struggling with Product Extra Fields.
Thanks
in catalog/controller/product/category.php
find the products array. just before it add
Code: Select all
$extra_fields = $this->model_catalog_product->getExtraFields($result['product_id']);
then change the array to look 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' => $this->model_tool_image->resize($image, $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height')),
'price' => $price,
'options' => $options,
'special' => $special,
'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/product&path=' . $this->request->get['path'] . '&product_id=' . $result['product_id']),
'add' => $add,
'extra_fields' => $extra_fields
);
then in the category view you can do something like
Code: Select all
if($products[$j]['extra_fields']){
foreach($products[$j]['extra_fields'] as $extra_field){
echo $extra_field['name'] . ': ' . $extra_field['value'] . '<br />';
}
}