Any way to change the number of products shown?

  • Posts: 98
  • Thank you received: 2
10 years 7 months ago #126502

Hi there! I wander if there's any way to change overall quantity shown by the

hikashop_results_counter
for example to add a number or to reduce it by some number?
I got a PHP developer and he's stuck with it and I guess we need your commentary upon that.
We need simply the Overall Quantity Plus any number

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

  • Posts: 81604
  • Thank you received: 13083
  • MODERATOR
10 years 7 months ago #126533

Hi,

The best I think is to edit the file "listing" of the view "product" via the menu Display>Views and add such code at the beginning:

<?php
$suffix = $this->pagination->hikaSuffix;
$this->pagination = hikashop_get('helper.pagination', $this->pageInfo->elements->total+$xxx, $this->pageInfo->limit->start, $this->pageInfo->limit->value);
$this->pagination->hikaSuffix = $suffix;
?>
where $xxx is a variable with the number that you want to add to the total.

This will reset the pagination system for the listing with a new total before the pagination gets displayed using it.

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

  • Posts: 98
  • Thank you received: 2
10 years 6 months ago #129795

nicolas wrote: Hi,

The best I think is to edit the file "listing" of the view "product" via the menu Display>Views and add such code at the beginning:

<?php
$suffix = $this->pagination->hikaSuffix;
$this->pagination = hikashop_get('helper.pagination', $this->pageInfo->elements->total+$xxx, $this->pageInfo->limit->start, $this->pageInfo->limit->value);
$this->pagination->hikaSuffix = $suffix;
?>
where $xxx is a variable with the number that you want to add to the total.

This will reset the pagination system for the listing with a new total before the pagination gets displayed using it.


Thank you! It works but it also touches the counter of the "related products" on the product page. Any way to fix that?

Last edit: 10 years 6 months ago by Shulha.

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

  • Posts: 81604
  • Thank you received: 13083
  • MODERATOR
10 years 6 months ago #129867

Simply add a check on the task parameter like that:

<?php
if($_REQUEST['task']!='show'){
$suffix = $this->pagination->hikaSuffix;
$this->pagination = hikashop_get('helper.pagination', $this->pageInfo->elements->total+$xxx, $this->pageInfo->limit->start, $this->pageInfo->limit->value);
$this->pagination->hikaSuffix = $suffix;
}
?>

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

  • Posts: 98
  • Thank you received: 2
10 years 5 months ago #133985

nicolas wrote: Simply add a check on the task parameter like that:

<?php
if($_REQUEST['task']!='show'){
$suffix = $this->pagination->hikaSuffix;
$this->pagination = hikashop_get('helper.pagination', $this->pageInfo->elements->total+$xxx, $this->pageInfo->limit->start, $this->pageInfo->limit->value);
$this->pagination->hikaSuffix = $suffix;
}
?>


It helped but now I noticed that the same things goes on when you do the filtering... Despite the fact that only 5 products match the filtering criteria, it shows that there are these 5products +XXX number that I added and there are 8 pages in the pagionation. Could you please help me to fix that?

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

  • Posts: 13201
  • Thank you received: 2322
10 years 5 months ago #134096

Hi,

You can try to add this code after that one:

if(hikashop_level(2) && JRequest::getVar('hikashop_front_end_main',0) && JRequest::getVar('task','listing')=='listing' && $display_filters=='1'){
 	$this->setLayout('filter');
 	$htmlFilter = $this->loadTemplate();
}

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

  • Posts: 98
  • Thank you received: 2
10 years 3 months ago #140649

Xavier wrote: Hi,

You can try to add this code after that one:

if(hikashop_level(2) && JRequest::getVar('hikashop_front_end_main',0) && JRequest::getVar('task','listing')=='listing' && $display_filters=='1'){
 	$this->setLayout('filter');
 	$htmlFilter = $this->loadTemplate();
}


This code didnt help. I still get the same error:

Despite the fact that only 5 products match the filtering criteria, it shows that there are these 5products +XXX number that I added and there are 8 pages in the pagionation

Could you please help me? I need this quite much.

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

  • Posts: 81604
  • Thank you received: 13083
  • MODERATOR
10 years 3 months ago #140726

Instead of the code:

<?php
if($_REQUEST['task']!='show'){
$suffix = $this->pagination->hikaSuffix;
$this->pagination = hikashop_get('helper.pagination', $this->pageInfo->elements->total+$xxx, $this->pageInfo->limit->start, $this->pageInfo->limit->value);
$this->pagination->hikaSuffix = $suffix;
}
?>
you should try that code:
<?php
if($_REQUEST['task']!='show' && $_REQUEST['Itemid']!=YYY){
$suffix = $this->pagination->hikaSuffix;
$this->pagination = hikashop_get('helper.pagination', $this->pageInfo->elements->total+$xxx, $this->pageInfo->limit->start, $this->pageInfo->limit->value);
$this->pagination->hikaSuffix = $suffix;
}
?>
where YYY is the id of the menu item that you use for the filters search results display page.

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

Time to create page: 0.080 seconds
Powered by Kunena Forum