Post by Roel_tje » Sun Mar 01, 2015 8:58 pm

Hallo,

Ik gebruik een Pavothemes ontwerp. De subcategorieën waren echter alleen zichtbaar als knop met naam, ipv daarvan wilde ik graag een plaatje met daaronder de titel hebben.

Dmv een paar aanpassingen aan de orignele Category.tpl en Category.php is het mij gelukt om plaatjes bij de subcategorie te krijgen, voorbeeld: http://www.novalarm.nl/index.php?route= ... path=65_67

Deze aanpassingen heb ik gedaan door stukken code te gebruiken van: subcatimagesv1.2 Zie: http://www.opencart.com/index.php?route ... on_id=3907

Nu zit ik echter met de vraag hoe ik deze categorieën gewoon mooi in raster kan krijgen en niet in 1 lijn verticaal naar beneden. Mijn kennis is te gering om de juiste aanpassingen te doen in de code. Kan iemand mij helpen om dit strak eruit te laten zien?

De code die ik in Category.tpl en Category.php heb aangepast:

Category.tpl origineel:

Code: Select all

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

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 origineel:

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)
				);
			}
na aanpassing:

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 12 guests