Post by sroblesruiz » Mon Dec 08, 2008 6:22 am

Hi,

For design reasons, I need to pass to category.tpl the category_id and the language_id from the category_description table, so I can be able to add a description for each category depending on the language selected by the user, with an if cycle...

Thanks in advanced for the help,

Sergio

New member

Posts

Joined
Wed Nov 05, 2008 9:56 am

User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by sroblesruiz » Tue Dec 09, 2008 3:56 am

Great! :D

Thank you

New member

Posts

Joined
Wed Nov 05, 2008 9:56 am

Post by sroblesruiz » Tue Dec 09, 2008 4:14 am

Me again...

Maybe a dumb question, but, where's going to show the category description ?...

What I was thinking, is show the desc in the product page, example:

http://lyvjoyeria.com/tienda/index.php? ... ry&path=22 here, at the top...

(already added a desc to that category)

Sergio

New member

Posts

Joined
Wed Nov 05, 2008 9:56 am

Post by Qphoria » Tue Dec 09, 2008 4:59 am

Yea, that is where it "should" show it. Is it not showing it there?

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by sroblesruiz » Tue Dec 09, 2008 6:51 am

Nop...

New member

Posts

Joined
Wed Nov 05, 2008 9:56 am

Post by fido-x » Tue Dec 09, 2008 10:04 am

The "Category Description" package only contains the administrative components and doesn't contain the catalog components (you need to add these yourself).

In "catalog/controller/category.php", change line 19 from -

Code: Select all

$category_info = $database->getRow("select distinct name from category c left join category_description cd on (c.category_id = cd.category_id) where c.category_id = '" . (int)((!$request->gethtml('path')) ? '0' : (int)end(explode('_', $request->gethtml('path')))) . "' and cd.language_id = '" . (int)$language->getId() . "'");
to

Code: Select all

$category_info = $database->getRow("select distinct name, description from category c left join category_description cd on (c.category_id = cd.category_id) where c.category_id = '" . (int)((!$request->gethtml('path')) ? '0' : (int)end(explode('_', $request->gethtml('path')))) . "' and cd.language_id = '" . (int)$language->getId() . "'");
Insert at line 83 in the same file -

Code: Select all

$view->set('description', html_entity_decode($category_info['description']));
Then insert the following line to "catalog/template/default/content/category.tpl" (line 7):-

Code: Select all

<?php echo $description; ?>
This should get the category description displaying on the category page when there are products or sub-categories attached to it.

Fido-X.

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by sroblesruiz » Tue Dec 09, 2008 12:38 pm

Thank you for your answer :)

I guess was because my OC version, but I had to change the 'gethtml('path'))' part to 'get('path'))', and the output for description by line 19th ...

Thanks anyway :D

Sergio

New member

Posts

Joined
Wed Nov 05, 2008 9:56 am

Post by jty » Tue Dec 09, 2008 12:43 pm

sroblesruiz wrote: I guess was because my OC version, but I had to change the 'gethtml('path'))' part to 'get('path'))', and the output for description by line 19th ...
gethtml was added in 0.7.9RC4. For versions before 0.7.9RC4 you need to change gethtml to get. This will happen more as new contributions come and people try to apply it to versions before 0.7.9RC4

The answer to your question can also be found by searching "category descriptions". The original answer in this forum doesn't have the gethtml problem

jty
Active Member

Posts

Joined
Sat Aug 30, 2008 8:19 am
Who is online

Users browsing this forum: No registered users and 3 guests