Post by carefree » Wed Nov 28, 2012 2:06 pm

I have 10 or less products per each main category, so I made a main category, then sub categories that are named the same thing as the product name. Then for each product, I linked it to both the main category and the sub category that it is named after. Then I changed the code on the category.php file as per the instructions in another post.

The result:
When I click on the main category, I get a page with a description of the category, and all the products listed below in grid form (I tweaked it to do this). I also see the main category on the left side bar and below it is a list of all the products (sub categories) that I can click on. So far so good . . .

What is wrong:
When I click on a product the categories go back the way they were (only displays the main category, no sub categories).

What I want:
I want the code that will make the subcategories show up on every product page that is within the main category so that no matter what product you are looking at, you can switch to another product within that same category without going back to the first page.

Does this make sense? :)
I need the template name and the code to replace. Seems like it shouldn't be too hard I hope.

Thanks in advance!

Newbie

Posts

Joined
Fri Nov 09, 2012 5:45 am

Post by carefree » Tue Dec 04, 2012 4:17 am

BUMP ...
anyone?

Newbie

Posts

Joined
Fri Nov 09, 2012 5:45 am

Post by webvet » Tue Dec 04, 2012 7:39 am

Have you got a link to a live site? Not quite sure I get what you mean...

???

Genuine, Honest Opencart Support @ http://webvetservices.com


User avatar
Active Member

Posts

Joined
Thu May 14, 2009 2:04 am
Location - Shropshire, UK

Post by carefree » Tue Dec 04, 2012 9:07 am

webvet wrote:Have you got a link to a live site? Not quite sure I get what you mean...

???
It is still under construction but here is what I have so far. The "THING" shirts are what I am working on.

http://carefreetees.com/store/index.php ... ry&path=20

You can see each of the products under the main category on this page. But when you click on one of the shirts to view it, the links disappear on the left sidebar.

This is my first shopping cart so maybe this way is not the best way to do this, but it seems intuitive to me since I do not have a lot of unique products.

Newbie

Posts

Joined
Fri Nov 09, 2012 5:45 am

Post by webvet » Wed Dec 05, 2012 8:57 pm

Essentially, if you have this how you would like it on the page you gave as a link, you need to make these changes in the catalog/view/theme/*/module/category.tpl file to make them appear on every page you have the 'category' module set on.

From what I can see, it might be worth trying this in place of your current category.tpl file:

Code: Select all

<div class="box">
  <div class="box-heading"><?php echo $heading_title; ?></div>
  <div class="box-content">
    <div class="box-category">
      <ul>
		<?php foreach ($categories as $category) { ?>
	
			<?php foreach ($category['children'] as $child) { ?>
		   	   <li>
			   <a href="<?php echo $child['href']; ?>"><?php echo $child['name']; ?></a>
			   </li>
			<?php } ?>
	
		<?php } ?>
     </ul>
  </div>
  </div>
</div>
Obviously, please save your current category.tpl file somewhere first - so you can replace it if this doesn't work. But this repalces the categories with the subcategories in the category module - which I think is what you are getting at.

Genuine, Honest Opencart Support @ http://webvetservices.com


User avatar
Active Member

Posts

Joined
Thu May 14, 2009 2:04 am
Location - Shropshire, UK
Who is online

Users browsing this forum: No registered users and 8 guests