Empty page for empty categories

  • Posts: 31
  • Thank you received: 0
12 years 5 months ago #55625

Hello,

when i click the categories of my shop that are empty, i see an empty page.
[img size=Here] www.fiorionlinevotadoro.it/new/ [/img]
Is there anyway to have a message that tells to the customers "there are no products in this categories"?


Thanks

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

  • Posts: 82906
  • Thank you received: 13378
  • MODERATOR
12 years 4 months ago #55737

Hi,

You will have to edit the file "listing" of the view "product" via the menu Display->Views and change the code:
<?php }
$html = ob_get_clean();


to:
<?php }else{
echo 'there are no products in this categories';
}
$html = ob_get_clean();

Last edit: 12 years 4 months ago by nicolas.
The following user(s) said Thank You: d4rkcloud

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

  • Posts: 31
  • Thank you received: 0
12 years 4 months ago #55817

Perfect!

Thank you! B)

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

  • Posts: 60
  • Thank you received: 0
12 years 3 months ago #61708

This isn't working for me.

Did it but i see no effect. I also so no effect when altering tables in order to get show the product info below the image (read that in another post).

It is as if I am changing the wrong file that has nothing to do with this.

<?php } else {
echo "<p>There are no products in this category yet, please check back later.</p>";
}
$html = ob_get_clean();
if(!empty($html)){ ?>
  <div id="<?php echo $this->params->get('main_div_name');?>" class="hikashop_category_information hikashop_products_listing_main">

I even see the trashcan next to "listing" to remove the customization, and it's there when I exit and come back, but still nothing on the blank pages.

Any ideas?

p.s.

I cleared cache.

p.s.

I just got fed up with it and deleted everything from listing.php (yes, it's empty) and saved it, and it all still works like i didn't delete anything :laugh: Should I maybe make the change in the actual php file, rather than in the display > view section?

Last edit: 12 years 3 months ago by Dzumla.

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

  • Posts: 82906
  • Thank you received: 13378
  • MODERATOR
12 years 3 months ago #61874

Hi,

When you are in the menu Display->Views, you will have one occurrence of each hikashop view file for each one of your templates. So if you don't see the changes you're making in a view file, it means that you're probably editing the view file for another template than the one you're actually using on your front end.
Or that you have page caching on your website.

The following user(s) said Thank You: Dzumla

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

  • Posts: 60
  • Thank you received: 0
12 years 3 months ago #61875

It was the template problem. I didn't specify which to choose. Thanks!

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

  • Posts: 49
  • Thank you received: 0
11 years 1 month ago #125557

Hi
The text message is working fine as Nicolas has described it.
I have used a text variable LS_EMPTY_LIST, because I have a multi language page:

<?php }else{
echo "<font color='#FF00EB'>";
echo JText::_('LS_EMPTY_LIST');
echo "</font>";
}
$html = ob_get_clean();

Is there a chance to show a MODULE , ideal with a BACK button in that module, if the category is empty?
I did not find a way with the ADVANCED MODULE MANAGER.
Thank you
Lutz

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

  • Posts: 82906
  • Thank you received: 13378
  • MODERATOR
11 years 1 month ago #125591

Hi,

You can use such extension to add a module display wherever you want with a simple tag:
extensions.joomla.org/extensions/core-en...embed-a-include/6402

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

  • Posts: 49
  • Thank you received: 0
11 years 1 month ago #125846

Grazie Nicolas,

its working great.

Lutz

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

  • Posts: 27
  • Thank you received: 0
10 years 2 months ago #170544

Hi,

I tried to find the exact code on that file, but only found
}
}

$html = ob_get_clean();

It seems the code has changed. I tried to put the code before
$html = ob_get_clean();

but it didn't work. Where to put the code for empty categories here?

Thanks,
Andreas

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

  • Posts: 82906
  • Thank you received: 13378
  • MODERATOR
10 years 2 months ago #170598

Hi,

Now, you can replace the code:

if(!empty($html)) {
?>
	<div id="<?php echo $this->params->get('main_div_name');?>" class="hikashop_category_information hikashop_products_listing_main"><?php echo $html; ?></div>
<?php
	}
with:
if(!empty($html)) {
?>
	<div id="<?php echo $this->params->get('main_div_name');?>" class="hikashop_category_information hikashop_products_listing_main"><?php echo $html; ?></div>
<?php
	}else{
    echo "<p>There are no products in this category yet, please check back later.</p>";
}

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

  • Posts: 27
  • Thank you received: 0
10 years 2 months ago #170648

Hi Nicolas,

in the view product/listing I can not find the exact code but very similar:

if(!empty($html)){ ?>
	<div id="<?php echo $this->params->get('main_div_name');?>" class="hikashop_category_information hikashop_categories_listing_main">
		<?php echo $html; ?>
	</div>
<?php }	?>

If I replace it with the code you wrote there is still nothing displayed on empty categories.

Is the code in another view now?

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

  • Posts: 13201
  • Thank you received: 2322
10 years 2 months ago #170661

Hi,

The given code should work fine, are you sure that you are editing the view in the correct template ?

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

  • Posts: 27
  • Thank you received: 0
10 years 2 months ago #170770

Hi,

I double checked and I did everything as described. There is only a small difference in the code I found in my listing view (as I posted before).

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

  • Posts: 26159
  • Thank you received: 4028
  • MODERATOR
10 years 2 months ago #172267

Hi,

Are you sure that you edited the right view (I mean, for the right front-end template) ?
You can add some html content in the view in order to be sure that your modification is right displayed in the front-end.

If you're sure that you edited the right view for the right template, please provide a link to your website.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: innoads

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

  • Posts: 27
  • Thank you received: 0
10 years 2 months ago #173309

Hi,

yes I am sure and I placed some html code to verify it.

Before editing anything the code looks like the 1st attached file (I am using JM Creatrix template from joomlaman.com).

Link is attached in 2nd file. link attached to the issue ticket

Regards

Attachments:
Last edit: 10 years 1 month ago by Jerome.

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

  • Posts: 27
  • Thank you received: 0
10 years 1 month ago #175021

Hi,

did you have the chance to check the code?

Regards

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

  • Posts: 82906
  • Thank you received: 13378
  • MODERATOR
10 years 1 month ago #175028

Hi,

I just looked at the file www.hikashop.com/media/kunena/attachments/33433/listing.txt that you provided but I don't see the code change that I gave you added in.
Also, you provided a link to your website, but you didn't provide a direct link to the page where you want that to display so I checked your website but couldn't find it.

The following user(s) said Thank You: innoads

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

  • Posts: 27
  • Thank you received: 0
10 years 1 month ago #175142

Hi,

the problem was that I filtered product & my template in views. But I didn't realize that still category/listing.php and product/listing.php were in the list. So when I tried it out, I used category/listing.php and that was the problem.

Now it works.

Thank you very much!

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

  • Posts: 56
  • Thank you received: 0
  • Hikashop Business
9 years 11 months ago #183668

Hi,

I used the above code to add a note to empty categories which worked great but I have now spotted that the same note shows at the bottom of every product as well now. Any idea why this is happening? I only want it to show on empty catagories.

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

Time to create page: 0.101 seconds
Powered by Kunena Forum