RC6 Category.php
14 posts
• Page 1 of 1
RC6 Category.php
In version RC6
catalog/controller/ catagory.php
Missing description assignment, Should be
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
-

bthirsk - Posts: 121
- Joined: Wed Sep 03, 2008 3:33 am
- Location: Canada
Re: RC6 Category.php
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
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 4:17 am, edited 1 time in total.

Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
-

Qphoria - Administrator
- Posts: 18212
- Joined: Mon Jul 21, 2008 7:02 pm

Re: RC6 Category.php
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
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
-

bthirsk - Posts: 121
- Joined: Wed Sep 03, 2008 3:33 am
- Location: Canada
Re: RC6 Category.php
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
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 2:32 pm, edited 1 time in total.
Brent
-

bthirsk - Posts: 121
- Joined: Wed Sep 03, 2008 3:33 am
- Location: Canada
Re: RC6 Category.php
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:
Move:
Under:
OR
Use the fixed attached file.
Thanks for finding this one bthirsk
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

- Attachments
-
fixed_category_tpl.zip- (693 Bytes) Downloaded 293 times
Last edited by Qphoria on Thu Jan 08, 2009 2:50 pm, edited 1 time in total.

Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
-

Qphoria - Administrator
- Posts: 18212
- Joined: Mon Jul 21, 2008 7:02 pm

Re: RC6 Category.php
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
That is a good idea.
Thanks
Brent
-

bthirsk - Posts: 121
- Joined: Wed Sep 03, 2008 3:33 am
- Location: Canada
Re: RC6 Category.php
Yea it will only show the Parent category's description at the top of the page for each level

Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
-

Qphoria - Administrator
- Posts: 18212
- Joined: Mon Jul 21, 2008 7:02 pm

Re: RC6 Category.php
I modified my code to match yours. It works great.
On small modification.
move
, It creates HTML errorsOn small modification.
- Code: Select all
<?php if ($description) { ?>
<div id="category_description"><?php echo $description; ?>[color=red]</div>[/color]
<?php } ?>
move
- Code: Select all
<?php if ($description) { ?>
<div id="category_description"><?php echo $description; ?>
<?php } ?>[color=red]</div>[/color]
Brent
-

bthirsk - Posts: 121
- Joined: Wed Sep 03, 2008 3:33 am
- Location: Canada
Re: RC6 Category.php
ermm no. because if description is null, then you are going to add an extra unneeded

Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
-

Qphoria - Administrator
- Posts: 18212
- Joined: Mon Jul 21, 2008 7:02 pm

Re: RC6 Category.php
In future, please report the actual problem not just the solution.
Thanks!
Thanks!
-

hm2k - Global Moderator
- Posts: 583
- Joined: Tue Mar 11, 2008 1:06 am
- Location: UK
Re: RC6 Category.php
Sorry.
The problem is HTML errors on Category.tpl.
The errors are on lines:
The problem is HTML errors on Category.tpl.
The errors are on lines:
Brent
-

bthirsk - Posts: 121
- Joined: Wed Sep 03, 2008 3:33 am
- Location: Canada
Re: RC6 Category.php
I think the error makes it clear:
It doesn't like like:
It wants:
So if you find that in the category.tpl:
Change to:
It should work fine
Unrelated to the category descriptions tho
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

Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
-

Qphoria - Administrator
- Posts: 18212
- Joined: Mon Jul 21, 2008 7:02 pm

Re: RC6 Category.php
Are these issues related to the original bug report?
-

hm2k - Global Moderator
- Posts: 583
- Joined: Tue Mar 11, 2008 1:06 am
- Location: UK
14 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest













