Page 1 of 10

1.5 Subcategory Images

Posted: Tue Jun 28, 2011 5:09 am
by muddysmurf
In the older version, I could add an image to my Subcategories, and when someone would click the parent category of that sub cat, You would see a listing of just those images with the "title" of that sub category.

In this version, I go to the Parent Category, but instead of seeing images of a listing of my sub categories, I see a "Refine Search" and a text link of my sub category. I have an image attached to just the sub category. Do you know if there is a way to make this like it once was?

Thanks!

Re: 1.5 Subcategory Images

Posted: Tue Jun 28, 2011 5:34 am
by Miguelito
Noticed this one also when comparing to 1.4.9.x. Anyone (Q/Daniel) with a solution for this one?

Re: 1.5 Subcategory Images

Posted: Tue Jun 28, 2011 5:51 am
by Xsecrets
yeah unfortunately there's no quick solution. It involves some coding. I did it for one customer already. I may release a vqmod when I get a break.

Re: 1.5 Subcategory Images

Posted: Thu Jun 30, 2011 1:46 am
by muddysmurf
I would love for this to be a mod -- or for someone to point me in the right direction on how to code it. This will help my store out!

Re: 1.5 Subcategory Images

Posted: Tue Jul 05, 2011 7:27 pm
by teratyke
Hi
Here is my attempt at changing the display- there is a bit of extra css in there which isn't used in the default install.
This changes the list to divs and puts in the images.

Probably a much better way of doing this than I have here, but its the best I can manage - improvements welcome!
This is for 1.5.0.5
Thanks
Rob

Re: 1.5 Subcategory Images

Posted: Wed Jul 06, 2011 2:16 am
by muddysmurf
teratyke:

Took a little work on my part (lot more work on your part though), but I got it working. Thank you so much!!

Re: 1.5 Subcategory Images

Posted: Thu Jul 14, 2011 8:16 pm
by iamandy
I'd highly suggest adding a </div> in there.. as the footer appears in the product table because it hasn't been closed off!

Re: 1.5 Subcategory Images

Posted: Thu Jul 14, 2011 8:43 pm
by teratyke
Thanks for the feedback. I can't find a missing </div> nor do I see the error you mention when I browse my site (sorry its not live). Its possible I have made some other edit to the category.tpl file, that is hiding it from me, but I don't think so. I just checked the vqmod cached file and all the divs seem to match up. I'm using the base install of 1.5.05, no svn's applied.
Any ideas?

Re: 1.5 Subcategory Images

Posted: Tue Jul 19, 2011 6:32 pm
by iamandy
I see.

I've also ran into another problem.. I have one product on my site, but when you click on the sub cat for the product, it doesn't load up.. Any ideas?

Re: 1.5 Subcategory Images

Posted: Tue Jul 19, 2011 10:03 pm
by teratyke
iamandy wrote:I see.
Sorry, I don't follow...
I've also ran into another problem.. I have one product on my site, but when you click on the sub cat for the product, it doesn't load up.. Any ideas?
Is your site live? Posting a link would make it easier to help, or even what is happening when you click the product. Don't have a lot to go on at the moment.

Re: 1.5 Subcategory Images

Posted: Thu Jul 21, 2011 6:40 pm
by iamandy
Yes, I do..

Footballs is the main one it does it on. Check Adidas, Mitre and Nike.

http://firstsportsdirect.co.uk/equipment/footballs

Re: 1.5 Subcategory Images

Posted: Thu Jul 21, 2011 7:35 pm
by teratyke
Perhaps try turning SEO urls off, then test.
Its odd.
I wonder if your SEO urls aren't unique, or something like that.

Re: 1.5 Subcategory Images

Posted: Thu Jul 21, 2011 9:41 pm
by iamandy
Yeah, that seemed to have done the trick! Thanks

Re: 1.5 Subcategory Images

Posted: Wed Jul 27, 2011 12:02 am
by spitos
The code seems to have changed a fair bit in 1.5.1, does anyone know how to get this to work?

Re: 1.5 Subcategory Images

Posted: Wed Jul 27, 2011 12:09 am
by teratyke
Do you mean how to get the VQmod to work? For me at least it does work in 1.5.1.1. What problem are you having?

Re: 1.5 Subcategory Images

Posted: Wed Jul 27, 2011 12:27 am
by spitos
I've installed the vqmod but all i got was a blank category page.

I looked at the xml file and compared it against the file that gets changed but the code cannot be found:

Code: Select all

<file name="catalog/controller/product/category.php">
<operation>
<search position="after"><![CDATA[
$product_total = $this->model_catalog_product->getTotalProducts(array('filter_category_id' => $result['category_id']));
]]></search>
<add><![CDATA[
$image = $this->model_tool_image->resize($result['image'], $this->config->get('config_image_category_width'), $this->config->get('config_image_category_height'));
]]></add>
</operation>

Re: 1.5 Subcategory Images

Posted: Wed Jul 27, 2011 12:32 am
by spitos
Should've mentioned that i downloaded the latest SVN today to fix some bugs, just looked at my old 1.5.1.1 file and the code is in there. The SVN version of the file has it formatted differently.

In the file before i updated to the SVN, the code is this:

Code: Select all

$this->data['categories'] = array();
			
			$results = $this->model_catalog_category->getCategories($category_id);
			
			foreach ($results as $result) {
				$product_total = $this->model_catalog_product->getTotalProducts(array('filter_category_id' => $result['category_id']));
				
				$this->data['categories'][] = array(
					'name'  => $result['name'] . ' (' . $product_total . ')',
					'href'  => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url)
				);
			}
But the latest version has the code like this:

Code: Select all

$this->data['categories'] = array();
			
			$results = $this->model_catalog_category->getCategories($category_id);
			
			foreach ($results as $result) {
				$data = array(
					'filter_category_id'  => $result['category_id'],
					'filter_sub_category' => true	
				);
							
				$product_total = $this->model_catalog_product->getTotalProducts($data);
				
				$this->data['categories'][] = array(
					'name'  => $result['name'] . ' (' . $product_total . ')',
					'href'  => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url)
				);
			}
Any ideas?

Re: 1.5 Subcategory Images

Posted: Wed Jul 27, 2011 12:38 am
by teratyke
The problem with the VQmod I made is it finds a line and replaces it and the next 22 line. That might need adjusted for this new version. I've just lost ftp access to my host so I can't check at the moment. I'll get back to you as soon as I sort this ftp problem out.

THanks

Re: 1.5 Subcategory Images

Posted: Wed Jul 27, 2011 12:59 am
by teratyke
Ah ok I just checked the svn - try this - dont forget to rename the old vqmod first - might be handy to keep both, but only enable one..

Re: 1.5 Subcategory Images

Posted: Wed Jul 27, 2011 4:24 pm
by spitos
Thanks for the quick reply, I was unable to test properly until this morning.

I tried with the new file you sent but still couldn't get it to work and just had a blank page, so I made a few changes and managed to get it working properly.

I changed the search position and search text in the first operation, as well as what it adds so what used to be this:

Code: Select all

<file name="catalog/view/theme/default/template/product/category.tpl">
<operation>
<search position="replace" offset="22"><![CDATA[<?php if ($categories) { ?>]]></search>
<add><![CDATA[
  <?php if ($categories) { ?>
  <div class="box">
	<div class="box-heading"><?php echo $text_refine; ?></div>
	<div class="box-content">
		<div class="box-product box-subcat">
			<?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 } ?>
				<div class="name subcatname"><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a></div>
			</div>
			<?php } ?>
		</div>
	</div>
  </div>
  <?php } ?>
]]></add>
</operation>	
</file>
Is now:

Code: Select all

<file name="catalog/view/theme/default/template/product/category.tpl">
<operation>
<search position="replace" offset="24"><![CDATA[<h2><?php echo $text_refine; ?></h2>]]></search>
<add><![CDATA[
  <div class="box">
	<div class="box-heading"><?php echo $text_refine; ?></div>
	<div class="box-content">
		<div class="box-product box-subcat">
			<?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 } ?>
				<div class="name subcatname"><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a></div>
			</div>
			<?php } ?>
		</div>
	</div>
  </div>
]]></add>
</operation>	
</file>
Thanks for the pointers.
You can test my version here, definitely works for me: