Page 1 of 3
(SOLVED)Display Picture in Category
Posted: Sun Nov 13, 2011 9:24 am
by pumpkinpatch
Hi There,
I am using V 1.5.1.3 and I would like when you select a category for it to display the pictures on the sub category.
Is this possible?
http://www.thepumpkinpatch.ca
Thanks
Lisa
Re: Display Picture in Category
Posted: Sun Nov 13, 2011 5:04 pm
by grgr
Do you mean the 'Refine Search'? If so then click link below.
Re: Display Picture in Category
Posted: Sun Nov 13, 2011 6:24 pm
by pprmkr
I altered for you the catalog/controller/catalog.php and the catalog.tpl
It shows the category image with the name as link to the subcategory.
Please backup the existing files before you upload the ones in the archive.
Re: Display Picture in Category
Posted: Mon Nov 14, 2011 9:04 am
by pumpkinpatch
It works perfectly thanks so much!!
Re: (SOLVED)Display Picture in Category
Posted: Thu Mar 22, 2012 3:42 am
by jontycasson
Works with 1.5.2.1 as well as I have just used it again!
Re: (SOLVED)Display Picture in Category
Posted: Wed Apr 04, 2012 6:47 pm
by chris.dempsey
Created XML file for vQmod v2.1.5 from the work by pprmkr. Tested on OpenCart v1.5.1.3.
Going by jontycasson's post above it should also work with v1.5.2.1 as well.
Re: (SOLVED)Display Picture in Category
Posted: Fri Apr 06, 2012 10:51 pm
by gennady
With vQmod in subcategory
Notice: Undefined variable: result in mystore/vqmod/vqcache/vq2-catalog_controller_product_category.php on line 164
Re: (SOLVED)Display Picture in Category
Posted: Fri Apr 06, 2012 11:00 pm
by straightlight
Without knowing exactly if the following will fix the $result error message but what can be noticed is a bug from the XML:
Code: Select all
<file name="catalog/controller/product/category.php">
<operation>
<search position="after">
for:
Code: Select all
<file name="catalog/controller/product/category.php">
<operation>
<search position="after" index="1">
Re: (SOLVED)Display Picture in Category
Posted: Wed May 02, 2012 6:55 pm
by chris.dempsey
@Straightlight: you are correct, I added the same file to a different OpenCart install today (same version) and the error noted by gennady appeared. Adding index="1" resolves this but unsure why the error is not apparent on the first install I applied this to. Could be a combination of other vQmod files removing the second instance of the search term before this mod is parsed.
Re: (SOLVED)Display Picture in Category
Posted: Wed May 02, 2012 10:27 pm
by straightlight
Could be a combination of other vQmod files removing the second instance of the search term before this mod is parsed.
As I explained on other few topics, VQMod can be full of surprises while one or a few thinks there are actually no problems with the core. Most definitely, the quoted question sentence above is correct; there are currently no way - full proof - of knowing how or when a contribution could get or be conflicted with another contribution at this time nor there is a real reliable event tracker other than the VQMod logs or the OC logs from the admin which is still a non-proof method to track 'each' contributions when a conflict is involved which is the definite cause and started issues on why OC merchants wonders of the dis-functionality of distributors contribution most of the time when it isn't about coding issues.
Re: (SOLVED)Display Picture in Category
Posted: Thu May 03, 2012 2:37 am
by Calcite
This works great for me with 1.5.2.1 but my custom theme floats the image left so all are stacked in a column above each other. I'm not good at code so wonder how I might display them like a grid view?
Re: (SOLVED)Display Picture in Category
Posted: Thu May 03, 2012 2:51 pm
by pprmkr
The default them also floats the .category_info .image to the left.
Did you put the extra <div> around the category info?
Code: Select all
<?php foreach ($categories as $category) { ?>
<div>
<div class="image">
<?php if ( $category['image']){?>
<a href="<?php echo $category['href']; ?>"><img src="<?php echo $category['image'];?>" /></a>
<?php } ?>
</div>
<div class="name">
<a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a>
</div>
</div>
<?php } ?>
Re: (SOLVED)Display Picture in Category
Posted: Thu May 03, 2012 8:23 pm
by Calcite
I'm not good at this stuff so not sure where in the code you mean?
Here is the section from my existing XML fille
Code: Select all
<?php foreach ($categories as $category) { ?>
<div>
<div class="image">
<?php if ( $category['image']){?>
<a href="<?php echo $category['href']; ?>"><img src="<?php echo $category['image'];?>" /></a>
<?php } ?>
</div>
<div class="name">
<a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a>
</div>
</div>
<?php } ?>
</div>
<?php } ?>]]>
Re: (SOLVED)Display Picture in Category
Posted: Thu May 03, 2012 10:26 pm
by pprmkr
I count 1 closing </div> more than opening <div>
Where does that come from?
Can you post a link to your website, so I can take a look?
Re: (SOLVED)Display Picture in Category
Posted: Fri May 04, 2012 2:03 am
by Calcite
Unfortunately I am running on a local server and am just developing the site at the moment.
The code I posted comes directly from the Zip file posted by chris.dempsey further up this thread.
Re: (SOLVED)Display Picture in Category
Posted: Fri May 04, 2012 3:22 pm
by pprmkr
The code looks OK.
But also unfortunate, I don't use VQMod, so I cannot test the XML.
Can you send me your theme, so I can test it on my local server?
Re: (SOLVED)Display Picture in Category
Posted: Mon May 07, 2012 5:53 pm
by Calcite
First the bad news, then the good!
Things have taken a U turn as my partner wants to use a different template
I tried the Vqmod in the new template and it works fine

Re: (SOLVED)Display Picture in Category
Posted: Sat May 26, 2012 12:10 pm
by alex1
Does this work with 1.5.3?
Re: (SOLVED)Display Picture in Category
Posted: Mon May 28, 2012 4:19 pm
by pprmkr
Yes, it works in 1.5.3
In the controller
Code: Select all
$product_total = $this->model_catalog_product->getTotalProducts($data);
if ($result['image']) {
$image = $this->model_tool_image->resize($result['image'], $this->config->get('config_image_category_width'), $this->config->get('config_image_category_height'));
} else {
$image = false;
}
$this->data['categories'][] = array(
'name' => $result['name'] . ' (' . $product_total . ')',
'image' => $image,
'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url)
);
In the template:
Code: Select all
<?php if ($categories) { ?>
<h2><?php echo $text_refine; ?></h2>
<div>
<?php foreach ($categories as $category) { ?>
<div style="width: 130px; display: inline-block; vertical-align: top; margin-right: 20px; margin-bottom: 15px;">
<div class="image">
<?php if ( $category['image']){?>
<a href="<?php echo $category['href']; ?>"><img src="<?php echo $category['image'];?>" /></a>
<?php } ?>
</div>
<div class="name">
<a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a>
</div>
</div>
<?php } ?>
</div>
<?php } ?>
Re: (SOLVED)Display Picture in Category
Posted: Tue Nov 06, 2012 9:51 pm
by mmacpheat
Does anyone know if this works with 1.5.4.1