Skip to main content

Disable pagination on selected categories

More
13 years 10 months ago #76980 by verzevoul
Hi!
Is it possible to disable the pagination in a selected category? Not all via css.
I need to have in my mainpage a product listing category with no pagination and all the other categories,should display pagination.

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

More
13 years 10 months ago - 13 years 10 months ago #77114 by Jerome
Hi,

You can edit the view "product / listing_div" (if it the type of listing you use).
At the end of the view, there is a block which would display the pagination. You can add a condition in order to not display it for a specific category.
You would find this
Code:
<?php if(in_array($pagination,array('bottom','both')) && $this->params->get('show_limit') && $this->pageInfo->elements->total){ $this->pagination->form = '_bottom'; ?>
And you can replace it by
Code:
<?php $currentCategory = (int)trim($this->category_selected, '_'); if($currentCategory != 10 && in_array($pagination,array('bottom','both')) && $this->params->get('show_limit') && $this->pageInfo->elements->total){ $this->pagination->form = '_bottom'; ?>
Just change the "$currentCategory != 10" by the ID of the target category.

Regards,

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Last edit: 13 years 10 months ago by Jerome.

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

More
13 years 10 months ago #77405 by verzevoul
a comma seperated ids is an option to add more categories to be excluded?

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

More
13 years 10 months ago #77411 by Xavier
Hi,

To add more categories to be excluded, you have to use "&& $currentCategory != 11" (etc) in the if condition.

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

More
13 years 10 months ago #77413 by verzevoul
I tried with 1 category and it doesn t work. Which id should I use. I tried both. Hikashop cat id and joomla menu id

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

More
13 years 10 months ago - 13 years 10 months ago #77418 by Xavier
You can find the hikashop categories in HikaShop > Products > Categories, then you will find the id.
The id should start at "11".

To add more categories, you can too use:
Code:
$hideCategory = array('10','11'); if(!in_array($currentCategory,$hideCategory) && in_array($pagination,array('bottom','both')) ...
Last edit: 13 years 10 months ago by Xavier.

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

More
13 years 10 months ago - 13 years 10 months ago #77420 by verzevoul
I understand but I tried
Code:
<?php $currentCategory = (int)trim($this->category_selected, '_'); if($currentCategory != 26 && in_array($pagination,array('bottom','both')) && $this->params->get('show_limit') && $this->pageInfo->elements->total){ $this->pagination->form = '_bottom'; ?>

and pagination is still there
Last edit: 13 years 10 months ago by Jerome. Reason: fix code

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

More
13 years 10 months ago #77507 by Jerome
Hi,

Can you give us a link to your product listing ?

Thanks,

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

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

More
13 years 10 months ago #77511 by verzevoul
pmd thanks!

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

More
13 years 10 months ago #77512 by Jerome
Hi,

I've just see that there was a double "$this->" in my code (width "$this->$this->category_selected").
I have modified my code and yours, please update it in your website.

Regards,

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

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

More
13 years 10 months ago #77521 by verzevoul
Can you please post the final code, for than one categories.. thanks!

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

More
13 years 10 months ago #77599 by Jerome
Hi,

As I said, I modified the code in your previous post.
Code:
<?php $currentCategory = (int)trim($this->category_selected, '_'); if($currentCategory != 26 && in_array($pagination,array('bottom','both')) && $this->params->get('show_limit') && $this->pageInfo->elements->total){ $this->pagination->form = '_bottom'; ?>

Regards,

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

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

Time to create page: 0.254 seconds
Powered by Kunena Forum