Category product navigation with icons (pagination.php) override solution for u

Started by lanthan, January 31, 2013, 12:32:28 PM

Previous topic - Next topic

lanthan

Hi,
I was searching for a solution to use ICONS or a possibility to use text and different titletext (mouseover) for the sidenavigation for the products in the category view. I didn´t find a solution but saw many people seeking for a solution. So I want to share my solution with you. I added 4 new languagetexts in the language override (see below) and changed the pagination.php.

VM uses the pagenavigation from joomla (pagination.php). I created an override from this file. As you can´t copy the whole pagination file 1:1, because of the defined classes, protected functions aso, find below the pagination.php file for your folder ->templates/YOURTEMPLATE/html/pagination.php and add the following strings to you language override .ini file. In this example the Icons are in the vmgeneral folder. Instead of images tags you can of course use usual text, like "<<" "<" ans so on. Design your CSS as you like.

I hope this is useful for some of you. Bye.

language override .ini
JPREV="back"
JNEXT="Next"
JLIB_HTML_END="End"
JLIB_HTML_START="Start"

JPREV_IMG="<img src='templates/YOURTEMPLATE/html/com_virtuemart/assets/images/vmgeneral/back.png'>" (full path requiered)
JNEXT_IMG="<img src='templates/YOURTEMPLATE/html/com_virtuemart/assets/images/vmgeneral/prev.png'>"
JLIB_HTML_END_IMG='<img src="templates/YOURTEMPLATE/html/com_virtuemart/assets/images/vmgeneral/end.png'>"
JLIB_HTML_START_IMG='<img src="templates/YOURTEMPLATE/html/com_virtuemart/assets/images/vmgeneral/start.png'>"

<?php

defined
('JPATH_PLATFORM') or die;

   
/**
 * HTML Output
 */

function pagination_list_render($list)
{
// Reverse output rendering for right-to-left display.
$html '<ul>';
$html .= '<li class="pagination-start">' $list['start']['data'] . '</li>';
$html .= '<li class="pagination-prev">' $list['previous']['data'] . '</li>';
foreach ($list['pages'] as $page)
{
$html .= '<li>' $page['data'] . '</li>';
}
$html .= '<li class="pagination-next">' $list['next']['data'] . '</li>';
$html .= '<li class="pagination-end">' $list['end']['data'] . '</li>';
$html .= '</ul>';

return $html;
}

/**
 * Method to create the new active pagination link to the item
 */
 
function 
pagination_item_active(&$item)
{
$app JFactory::getApplication();
if ($app->isAdmin())
{
if ($item->base 0)
{
return "<a title=\"" $item->text "\" onclick=\"document.adminForm." $this->prefix "limitstart.value=" $item->base
"; Joomla.submitform();return false;\">" $item->text "</a>";
}
else
{
return "<a title=\"" $item->text "\" onclick=\"document.adminForm." $this->prefix
"limitstart.value=0; Joomla.submitform();return false;\">" $item->text "</a>";
}
}
else
{
if ($item->text == (JText::_('JLIB_HTML_START')))
{
return "<a title=\"" $item->text "\" href=\"" $item->link "\" class=\"pagenavstart\">" . (JText::_('JLIB_HTML_START_IMG')) . "</a>";
  }
elseif ($item->text == (JText::_('JPREV')))
{
return "<a title=\"" $item->text "\" href=\"" $item->link "\" class=\"pagenavback\">" . (JText::_('JPREV_IMG')) . "</a>";
  }
  elseif ($item->text == (JText::_('JNEXT')))
  {
return "<a title=\"" $item->text "\" href=\"" $item->link "\" class=\"pagenavnext\">" . (JText::_('JNEXT_IMG')) . "</a>";
  }
  elseif ($item->text == (JText::_('JLIB_HTML_END')))
  {
return "<a title=\"" $item->text "\" href=\"" $item->link "\" class=\"pagenavend\">" . (JText::_('JLIB_HTML_END_IMG')) . "</a>";
  }
return "<a title=\"" $item->text "\" href=\"" $item->link "\" class=\"pagenav\">" $item->text "</a>";
}
}

/**
 * Method to create the new inactive pagination link to the item
 */
 
function pagination_item_inactive(&$item)
{
$app JFactory::getApplication();
if ($app->isAdmin())
{
return "<span>" $item->text "</span>";
}
else
{
if ($item->text == (JText::_('JLIB_HTML_START')))
{
return "<span class=\"pagenavstart\">" . (JText::_('JLIB_HTML_START_IMG')) . "</span>";
  }
  elseif ($item->text == (JText::_('JPREV')))
  {
    return "<span class=\"pagenavback\">" . (JText::_('JPREV_IMG')) . "</span>";
  }
  elseif ($item->text == (JText::_('JNEXT')))
  {
    return "<span class=\"pagenavnext\">" . (JText::_('JNEXT_IMG')) . "</span>";
  }
  elseif ($item->text == (JText::_('JLIB_HTML_END')))
  {
    return "<span class=\"pagenavend\">" . (JText::_('JLIB_HTML_END_IMG')) . "</span>";
  }   
return "<span class=\"pagenav\">" $item->text "</span>";
}
}