Few Product Listing With Categories At One Page

  • Posts: 108
  • Thank you received: 2
12 years 10 months ago #19566

Hello All.

I have tried for a long time to get my home page to display a category description and below a few products from the same category while in the page there are few categories or all, so it will look like having category 1 description and below products, category 2 description and below products etc.

I have managed to display one category description with 3 products with the Product listing menu, but i did not manage to get more on the same page including via modules. I used the module to display a different category's product but i couldn't add the description.

Thank you for reading.
Any suggestion will be welcomed.

Please Log in or Create an account to join the conversation.

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
12 years 10 months ago #19572

You should indeed display your others categories' products with a module listing products of that category.
For the description of the category though, hikashop does not display the description of the category no matter the options of the module.
We didn't thought that it would be something people want.
You would have to edit the file listing of the view product for your template via the menu Display->Views and change the code:
if(!$this->module){
if(($this->params->get('show_image') && !empty($this->element->file_path))|| ($this->params->get('show_description')&&!empty($this->element->category_description))){

to:
if(true){ if(true){
$class = hikashop_get('class.category');
$this->element = $class->get(reset($this->pageInfo->filter->cid),true);


and the code:
if($this->params->get('show_description')&&!empty($this->element->category_description)){

to:
if(true){

That will force the description to always be displayed on a listing of products

Please Log in or Create an account to join the conversation.

  • Posts: 108
  • Thank you received: 2
12 years 10 months ago #19576

I looked at product / listing.php and didn't find the line :

if(!$this->module){
if(($this->params->get('show_image') && !empty($this->element->file_path))|| ($this->params->get('show_description')&&!empty($this->element->category_description))){

or this line:

if($this->params->get('show_description')&&!empty($this->element->category_description)){

i think i looked in the right place, any thoughts?

Please Log in or Create an account to join the conversation.

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
12 years 10 months ago #19587

Are you sure that you opened the view of the front end and not the view of the back end ?

Please Log in or Create an account to join the conversation.

  • Posts: 108
  • Thank you received: 2
12 years 10 months ago #19634

Ok i found something similar to this and i replace the similar parts (if statments were divided) but i ran into and error when i changed the first line to:
if(true){ if(true){
$class = hikashop_get('class.category');
$this->element = $class->get(reset($this->pageInfo->filter->cid),true);


Fatal error: Call to undefined function hikashop_get() in .../html/com_hikashop/product/listing.php on line 35

Please Log in or Create an account to join the conversation.

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
12 years 10 months ago #19637

It should be $class = hikashop::get('class.category'); and not $class = hikashop_get('class.category'); if you use a version of HikaShop prior to 1.5.2

Please Log in or Create an account to join the conversation.

  • Posts: 108
  • Thank you received: 2
12 years 10 months ago #19662

First of all i want to say thank you for the support you are giving!

Second, i noticed the update and i updated to 1.5.2 so i did what you said to replace at the first time, but it still does not working.

This is the part i changed, as far as i know PHP i cannot seem to find the problem.

if(true){
if(true){
?>
<div class="hikashop_category_description">
<?php
if(true){
$class = hikashop_get('class.category');
$this->element = $class->get(reset($this->pageInfo->filter->cid),true);
jimport('joomla.filesystem.file');
if(JFile::exists($this->image->getPath($this->element->file_path),false)){
?>
<img src="<?php echo $this->image->getPath($this->element->file_path); ?>" class="hikashop_category_image"/>
<?php
}
}
if(true){
?>
<p>
<?php echo JHTML::_('content.prepare',$this->element->category_description); ?>
</p>
<?php
}
?></div><?php
}

Last edit: 12 years 10 months ago by bars92.

Please Log in or Create an account to join the conversation.

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
12 years 10 months ago #19663

Yes that's good. If you don't see the modification, it probably means that you're not editing the correct file (for the good template, or something like that).

Please Log in or Create an account to join the conversation.

  • Posts: 108
  • Thank you received: 2
12 years 10 months ago #19669

So stupid of me to not notice that!
Working like a charm.
Thank you :)

Please Log in or Create an account to join the conversation.

Time to create page: 0.069 seconds
Powered by Kunena Forum