Roel_tje Posted March 1, 2015 Share Posted March 1, 2015 Hallo, I'm using a Pavothems design in my Opencart webshop. 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=product/category&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=extension/extension/info&extension_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: <?php foreach ($categories as $category) { ?> <li><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a></li> <?php } ?> Changed: <?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: '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: '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 ); } } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.