Post by bthirsk » Thu Jan 08, 2009 11:27 am

In version RC6
catalog/controller/ catagory.php

Code: Select all

       		foreach ($results as $result) {
          			$category_data[] = array(
            			'name'  		=> $result['name'],
            			'href'  		=> $url->href('category', FALSE, array('path' => ($request->gethtml('path')) ? $request->gethtml('path') . '_' . $result['category_id'] : $result['category_id'])),
                        'thumb' 		=> (isset($result['filename']) && file_exists(DIR_IMAGE . $result['filename'])) ? $image->resize($result['filename'], $config->get('config_image_width'), $config->get('config_image_height')) : NULL
          			);
        		}
Missing description assignment,  Should be

Code: Select all

    		foreach ($results as $result) {
          			$category_data[] = array(
            			'name'  => $result['name'],
            			'href'  => $url->href('category', FALSE, array('path' => ($request->gethtml('path')) ? $request->gethtml('path') . '_' . $result['category_id'] : $result['category_id'])),
                        [color=red]'description' => $result['description'],[/color]
						'thumb' => (isset($result['filename']) && file_exists(DIR_IMAGE . $result['filename'])) ? $image->resize($result['filename'], $config->get('config_image_width'), $config->get('config_image_height')) : NULL
          			);
        		}

Brent


Active Member

Posts

Joined
Wed Sep 03, 2008 11:33 am
Location - Canada

Post by Qphoria » Thu Jan 08, 2009 12:10 pm

How do you figure?
The category description is at the top of the category. We don't want to show the description under the thumbnail for each sub category. We only want to show the description for the currently opened category.

See here to understand how it works:
http://forum.opencart.com/index.php/top ... l#msg13572

Moving this out of bug reports
Last edited by Qphoria on Thu Jan 08, 2009 12:17 pm, edited 1 time in total.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by bthirsk » Thu Jan 08, 2009 8:47 pm

Ok, I get it.
I just did the up data to RC6 and got this error.
Notice: Undefined index: description in www\catalog\template\alternate\content\category.tpl on line 16

I added that code to make it go away.
I'll have to look at it further.
Thanks

Brent


Active Member

Posts

Joined
Wed Sep 03, 2008 11:33 am
Location - Canada

Post by bthirsk » Thu Jan 08, 2009 9:42 pm

This Problem Only occurs when you have Child categories. It will not occur in top level categories.
This is how I fixed it. Category.tpl

Code: Select all

<div class="categories">
  <?php if ($category['thumb'] != NULL) { ?>
    <a href="<?php echo $category['href']; ?>">
    <img src="<?php echo $category['thumb']; ?>" title="<?php echo $category['name']; ?>" alt="<?php echo $category['name']; ?>">
    </a><br>
  <?php } ?> 
  <a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a>
[color=red]  <?php if (isset($category['description'])){
      echo $category['description'];
	 } ?>[/color]
</div>
Last edited by Anonymous on Thu Jan 08, 2009 10:32 pm, edited 1 time in total.

Brent


Active Member

Posts

Joined
Wed Sep 03, 2008 11:33 am
Location - Canada

Post by Qphoria » Thu Jan 08, 2009 10:47 pm

ah ok i see the problem, it is a bug. I was at one point going to add the description to the thumbnail.. then i removed the code but didnt remove the tpl call.

But then I see there was a bigger problem, the description call was only being called if the category had products, not subcats.

So the proper fix in SVN r319 is:

delete:

Code: Select all

<?php echo $category['description']; ?>
Move:

Code: Select all

<?php if ($description) { ?>
<div id="category_description"><?php echo $description; ?></div>
<?php } ?>
Under:

Code: Select all

<div class="breadcrumb">
  <?php foreach ($breadcrumbs as $breadcrumb) { ?>
  <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
  <?php } ?>
</div>
OR
Use the fixed attached file.


Thanks for finding this one bthirsk :)
Last edited by Qphoria on Thu Jan 08, 2009 10:50 pm, edited 1 time in total.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by bthirsk » Thu Jan 08, 2009 11:27 pm

Looking at the code you did, I assume it should now give a main category description when only displaying subcategories.

That is a good idea.
Thanks

Brent


Active Member

Posts

Joined
Wed Sep 03, 2008 11:33 am
Location - Canada

Post by Qphoria » Thu Jan 08, 2009 11:47 pm

Yea it will only show the Parent category's description at the top of the page for each level

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by bthirsk » Fri Jan 09, 2009 10:17 pm

I modified my code to match yours. It works great.
On small modification.

Code: Select all

<?php if ($description) { ?>
<div id="category_description"><?php echo $description; ?>[color=red]</div>[/color]
<?php } ?>
move , It creates HTML errors

Code: Select all

<?php if ($description) { ?>
<div id="category_description"><?php echo $description; ?>
<?php } ?>[color=red]</div>[/color]

Brent


Active Member

Posts

Joined
Wed Sep 03, 2008 11:33 am
Location - Canada

Post by Qphoria » Fri Jan 09, 2009 10:25 pm

ermm no. because if description is null, then you are going to add an extra unneeded

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by hm2k » Sat Jan 10, 2009 2:17 am

In future, please report the actual problem not just the solution.

Thanks!

UK Web Hosting


User avatar
Global Moderator

Posts

Joined
Tue Mar 11, 2008 9:06 am
Location - UK

Post by bthirsk » Sat Jan 10, 2009 3:05 am

Sorry.
The problem is HTML errors on Category.tpl.
The errors are on lines:

  W3C Error: Doc type does not allow this element SELECT here
[/color]
  W3C Error: end tag for "Form" which is not finished

The problem does not appear to be with the form, but further up the page.

The only thing I can find is » in front of $breadcrumb
The first breadcrumb HTTP output is HOME. This has no 'separator', which is passed as false from the controller.
Any following breadcrumbs have some output as per controller:
            'separator' => $language->get('text_separator')

I looked in language/english/controller/category.php
I can't find reference to separator. I have no idea what it's for or where it's supposed to be.
I commented out the separator line in desperation and it seems to have fixed the problem for now.
  ">
 

Is there some function for this separator?
 

Brent


Active Member

Posts

Joined
Wed Sep 03, 2008 11:33 am
Location - Canada

Post by Qphoria » Sat Jan 10, 2009 3:20 am

I think the error makes it clear:

It doesn't like like:







It wants:








So if you find that in the category.tpl:

Code: Select all

<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data">
      <select name="page" onchange="this.form.submit();">
        <?php foreach ($pages as $pages) { ?>
        <?php if ($pages['value'] == $page) { ?>
        <option value="<?php echo $pages['value']; ?>" SELECTED><?php echo $pages['text']; ?></option>
        <?php } else { ?>
        <option value="<?php echo $pages['value']; ?>"><?php echo $pages['text']; ?></option>
        <?php } ?>
        <?php } ?>
      </select>
    </form>
Change to:

Code: Select all

<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data">
      [color=red]<div>[/color]
      <select name="page" onchange="this.form.submit();">
        <?php foreach ($pages as $pages) { ?>
        <?php if ($pages['value'] == $page) { ?>
        <option value="<?php echo $pages['value']; ?>" SELECTED><?php echo $pages['text']; ?></option>
        <?php } else { ?>
        <option value="<?php echo $pages['value']; ?>"><?php echo $pages['text']; ?></option>
        <?php } ?>
        <?php } ?>
      </select>
      [color=red]</div>[/color]
    </form>
It should work fine

Unrelated to the category descriptions tho

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by hm2k » Tue Jan 13, 2009 2:36 am

Are these issues related to the original bug report?

UK Web Hosting


User avatar
Global Moderator

Posts

Joined
Tue Mar 11, 2008 9:06 am
Location - UK

Post by bthirsk » Tue Jan 13, 2009 5:19 am

No, these are solved.
The original should be closed. It is also fixed

Brent


Active Member

Posts

Joined
Wed Sep 03, 2008 11:33 am
Location - Canada
Who is online

Users browsing this forum: No registered users and 28 guests