Post by Roel_tje » Sun Mar 01, 2015 9:13 pm

Hallo,

I'm using a Pavothems design. The subcategory's in this theme were only visible as a button with title of the category. I wanted to change that, result has to be an image with title.

After a few changes to the original Category.tpl and Category.php I succeeded to get images and titles. Example: http://www.novalarm.nl/index.php?route= ... path=65_67

These changes are quite simple because I used pieces of code from subcatimagesv1.2. Download: http://www.opencart.com/index.php?route ... on_id=3907

Now the problem is, I would like to get the overview in a nice raster instead of a vertical line down. My knowledge about coding is to small to make the right changes. Can somebody help me get this right?

The code in Category.tpl and Category.php that I changed:

Category.tpl original:

Code: Select all

 <?php foreach ($categories as $category) { ?>
      <li><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a></li>
      <?php } ?>
Changed:

Code: Select all

<?php foreach ($categories as $category) { ?>
      <div>
<?php if ($category['thumb']) { ?>
<div class="image">
<a href="<?php echo $category['href']; ?>"><img src="<?php echo $category['thumb']; ?>" alt="<?php echo $category['name']; ?>" /></a>
</div>
<?php } ?>
<a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a></div></div>
<?php } ?>
Category.php original:

Code: Select all

'filter_sub_category' => true
				);

				$product_total = $this->model_catalog_product->getTotalProducts($data);				

				$this->data['categories'][] = array(
					'name'  => $result['name'] . ($this->config->get('config_product_count') ? ' (' . $product_total . ')' : ''),
					'href'  => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url)
				);
			}
Changed:

Code: Select all

'filter_sub_category' => true
				);
							
			if ($this->config->get('config_product_count')) {
				$product_total = $this->model_catalog_product->getTotalProducts($data);
				$image = $this->model_tool_image->resize($result['image'], 80, 80);
				$this->data['categories'][] = array(
					'name'  => $result['name'] . ' (' . $product_total . ')',
					'href'  => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url),
					'thumb' => $image
				);						
			} else {
				$image = $this->model_tool_image->resize($result['image'], 80, 80);
				$this->data['categories'][] = array(
					'name'  => $result['name'],
					'href'  => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url),
					'thumb' => $image
				);						
			}			
			}

Newbie

Posts

Joined
Thu May 02, 2013 10:49 am
Who is online

Users browsing this forum: No registered users and 8 guests