It's probalby very easy to do but i cant make it working.
Working module on product page:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<modification>
<id>Show categories(name and link) on product page</id>
<version>1</version>
<vqmver>2.3.2</vqmver>
<author>Andrei Bogdan (andrei.opencart@yahoo.com)</author>
<file name="catalog/controller/product/product.php">
<operation>
<search position="after"><![CDATA[$product_info = $this->model_catalog_product->getProduct($product_id);]]></search>
<add><![CDATA[
$data['text_category'] = $this->language->get('text_category');
$querycats = $this->model_catalog_product->getCategories($product_id);
$categories = array();
foreach( $querycats as $item ) {
$categ = $this->model_catalog_category->getCategory($item['category_id']);
$catinfo['id'] = $item['category_id'];
$catinfo['href'] = $this->url->link('product/category', 'path=' . $item['category_id']);
$catinfo['name'] = $categ['name'];
$categories[] = $catinfo;
}
]]></add>
</operation>
<operation>
<search position="before"><![CDATA[$data['manufacturer'] = $product_info['manufacturer'];]]></search>
<add><![CDATA[
$data['categories'] = $categories;
]]></add>
</operation>
</file>
<file name="catalog/language/english/product/product.php">
<operation>
<search position="after"><![CDATA[$_['text_manufacturer'] = 'Brand:';]]></search>
<add><![CDATA[
$_['text_category'] = 'Categories:';
]]></add>
</operation>
</file>
<file name="catalog/view/theme/default/template/product/product.tpl">
<operation>
<search position="after" offset="1"><![CDATA[<span><?php echo $text_manufacturer; ?></span> <a href="<?php echo $manufacturers; ?>"><?php echo $manufacturer; ?></a><br />]]></search>
<add><![CDATA[
<?php if( $categories ): ?>
<span><?php echo $text_category; ?></span>
<?php foreach( $categories as $category ): ?>
<a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a>
<?php endforeach; ?>
<br />
<?php endif; ?>
]]></add>
</operation>
</file>
</modification>
http://forum.opencart.com/viewtopic.php?f=131&t=109349
http://forum.opencart.com/viewtopic.php?f=190&t=142671