Pagination override and customizations

  • Posts: 127
  • Thank you received: 1
10 years 4 months ago #200994

-- HikaShop version -- : 2.4.0
-- Joomla version -- : 3.4.1
-- PHP version -- : 5.3.28
-- Browser(s) name and version -- : Google Chrome
-- Error-message(debug-mod must be tuned on) -- : No error message.

Hello,

I have the pagination.php file in my template's html folder and the override is fully working for the Joomla core, but only partially working for HikaShop. The pagination_item_active and pagination_item_inactive functions are not being used by HikaShop when displaying the pagination list items. The function pagination_list_render is being used correctly. It is wrapping the links and span tags in an unordered list, but none of the <li> tags are being used. Am I missing a step?

Another issue is related to the numbers used by the display limit box. How can I make it use the default Joomla limits (5, 10, 15 etc.) instead of its own custom numbers (20, 40, 60, etc.)?

Any help is greatly appreciated. Thank you.

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

  • Posts: 84304
  • Thank you received: 13698
  • MODERATOR
10 years 4 months ago #201006

Hi,

I invite you to look at the code of the file administrator/components/com_hikashop/helpers/pagination.php
You'll see that the HikaShop pagination do call the override functions pagination_item_active and pagination_item_inactive.

The numbers used in the limit box depend on what you configured in the "number of items" of the settings of your listing.
If you see 5, 10, 15, etc, it means that you changed it from the default 20 to 5. So you would have to edit your menu item via the menu Display>Content menus to change it back to 20.

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

  • Posts: 127
  • Thank you received: 1
10 years 4 months ago #201163

Hello,

I have those two functions already in my pagination.php override file, but they are not applying to HikaShop. They are only affecting the Joomla core pagination. I have included the two functions below.

Item Inactive

function pagination_item_inactive(&$item)
{
	// Check for "Start" item
	if ($item->text == JText::_('JLIB_HTML_START'))
	{
		return '<li class="disabled"><a><i class="icon-first"></i></a></li>';
	}

	// Check for "Prev" item
	if ($item->text == JText::_('JPREV'))
	{
		return '<li class="disabled"><a><i class="icon-previous"></i></a></li>';
	}

	// Check for "Next" item
	if ($item->text == JText::_('JNEXT'))
	{
		return '<li class="disabled"><a><i class="icon-next"></i></a></li>';
	}

	// Check for "End" item
	if ($item->text == JText::_('JLIB_HTML_END'))
	{
		return '<li class="disabled"><a><i class="icon-last"></i></a></li>';
	}

	// Check if the item is the active page
	if (isset($item->active) && ($item->active))
	{
		return '<li class="active hidden-phone"><span>' . $item->text . '</span></li>';
	}

	// Doesn't match any other condition, render a normal item
	return '<li class="disabled hidden-phone"><a>' . $item->text . '</a></li>';
}

Item Active
function pagination_item_active(&$item)
{
	$class = '';

	// Check for "Start" item
	if ($item->text == JText::_('JLIB_HTML_START'))
	{
		$display = '';
	}

	// Check for "Prev" item
	if ($item->text == JText::_('JPREV'))
	{
		$display = JText::_('JPREV');
	}

	// Check for "Next" item
	if ($item->text == JText::_('JNEXT'))
	{
		$display = JText::_('JNEXT');
	}

	// Check for "End" item
	if ($item->text == JText::_('JLIB_HTML_END'))
	{
		$display = '';
	}

	// If the display object isn't set already, just render the item with its text
	if (!isset($display))
	{
		$display = $item->text;
		$class   = ' class="hidden-phone"';
	}

	return '<li' . $class . '><a title="' . $item->text . '" href="' . $item->link . '" class="pagenav">' . $display . '</a></li>';
}

The list limit only seems to apply to the items displayed on the parent menu item and not on the individual brand/category pages. If I change the number of items from 20 to 5, the parent menu item only displays 5 items with pagination, but the brand/category pages keep using 20, 40, 60, etc. This is not a big issue, but it would be nice if HikaShop inherited the core list limit set in the configuration file, then gave an option to override that value.

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

  • Posts: 84304
  • Thank you received: 13698
  • MODERATOR
10 years 4 months ago #201170

Hi,

1. I can't say much without the full code of the pagination.php file. It could be a side effect of something else.

2. That's already how it is. There is a main setting in the configuration of HikaShop, and then each module and menu has again the setting which overrides the setting in the configuration if you set it.

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

Time to create page: 0.058 seconds
Powered by Kunena Forum