Filter list all crashes website

  • Posts: 63
  • Thank you received: 3
11 years 6 months ago #104126

Hi there,

I have a shop with 5,500 products which is working OK, except that when I click to show all, I just get a blank screen and then cant get back to the product list again.

url is www.wslr.co.uk/index.php/resources-catalogue

Can I change the filter at the bottom of the page so it only displays up to 100 results and remove the "all" button.

I think the number of products is too much to expect many pc's / connections to cope.

Yours,

ian

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 6 months ago #104211

Hi,

When I try to open your link, I have got a 500 error page.
You can override the pagination system yes but in your case I think it will be easier to set a maximum limitation.

You can edit the file "components/com_hikashop/views/product/view.html.php" and add some code in the "listing()" function before

		$database->setQuery($select.$query,(int)$pageInfo->limit->start,(int)$pageInfo->limit->value);
		$rows = $database->loadObjectList();

		if(!empty($rows)){
			$ids = array();
			$productClass = hikashop_get('class.product');
Like:
// begin of lines to add
		if((int)$pageInfo->limit->value > 100)
			$pageInfo->limit->value = 100;
// end of lines to add
		$database->setQuery($select.$query,(int)$pageInfo->limit->start,(int)$pageInfo->limit->value);
At this moment, the listing won't display more than 100 elements.

Note that, it is a modification of a core file so, by updating HikaShop, you will loose your modification.

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.

  • Posts: 63
  • Thank you received: 3
11 years 6 months ago #105174

Hi Jerome,

Sorry the site wasn't available for you to look at. It's live again now.

Thanks for the code - it doesn't seem to work though.

I have the following code - have I misunderstood your post?


if((int)$pageInfo->limit->value > 100)
$pageInfo->limit->value = 100;

$database->setQuery($select.$query,(int)$pageInfo->limit->start,(int)$pageInfo->limit->value);
$rows = $database->loadObjectList();

if(!empty($rows)){
$ids = array();
$productClass = hikashop_get('class.product');
foreach($rows as $key => $row){
$ids[]=$row->product_id;
$productClass->addAlias($rows[$key]);

Yours,

ian

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
11 years 6 months ago #105224

The modification proposed by jerome won't remove the "all" option but it will limit the display of the products to maximum 100 per page.

If you want to remove the all option, you could remove the line:
$limits[] = JHTML::_('select.option', '0', JText::_('HIKA_ALL'));
in the file administrator/components/com_hikashop/helpers/pagination.php

The following user(s) said Thank You: ians

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

  • Posts: 63
  • Thank you received: 3
11 years 5 months ago #108846

Thank you Nicolas, This worked fine :-)

Ian

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

Time to create page: 0.059 seconds
Powered by Kunena Forum