Category 'listing.php' Question

  • Posts: 62
  • Thank you received: 0
10 years 2 weeks ago #212699

-- HikaShop version -- : 2.5.0

Hi there, I want to be able to choose specific listing.php for different categories. Is there a way to do this? Because I am wanting tot display a menu on some categories but not on its parent, and since I am no creating menu items for them I cannot set the menu up to only display on those categories.

And I need the menu to be within the category description.

I know I could just add a HTML shortcode in the category html description to add the menu module in the categories I need them but I'd rather do it another way if possible so I don't have to put it in every time.

Thanks.

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

  • Posts: 62
  • Thank you received: 0
10 years 2 weeks ago #212719

<? if($this->element->category_id==36): ?>
 
<? else: ?>
  <div id="prod-menu-cat"> 
<? echo JHTML::_('content.prepare','{module Maximenu CK (4)}'); ?>
</div> 
<? endif; ?>

I found another post by someone else and I managed to achieve what I wanted with one category, but how do I add/edit the PHP to add more category numbers in that code above without having to duplicate it 20-30 times?

For instance to be able to do ==36, 37, 38 etc

Thanks

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

  • Posts: 62
  • Thank you received: 0
10 years 2 weeks ago #212722

After googling PHP coding of something similar, I worked out that it would be like this for adding multiple cat IDs:

<? if($this->element->category_id==36 || $this->element->category_id==43):

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

  • Posts: 26274
  • Thank you received: 4045
  • MODERATOR
10 years 2 weeks ago #212720

Hi,

<?php if(in_array($this->element->category_id, array(XXX, YYY, ZZZ))) { ?>

<?php } else { ?>

<?php } ?>

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.

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

Time to create page: 0.058 seconds
Powered by Kunena Forum