Google Testing Tool shows errors in Magento Breadcrumbs - magento

I need help with Magento breadcrumbs. This is what google testing tool tells me:
Breadcrumb 1
url: http://domain.com/
title: Home
Breadcrumb 2
url: http://domain.com/category/
title: Category
Breadcrumb 3
title: missing and required
url: missing and required
And this is breadcrumbs.phtml
<?php if($crumbs && is_array($crumbs)): ?>
<div class="breadcrumbs" xmlns:v="http://rdf.data-vocabulary.org/#">
<ul>
<?php foreach($crumbs as $_crumbName=>$_crumbInfo): ?>
<li class="<?php echo $_crumbName ?>" typeof="v:Breadcrumb">
<?php if($_crumbInfo['link']): ?>
<a rel="v:url" property="v:title" href="<?php echo $_crumbInfo['link'] ?>" title="<?php echo $this->escapeHtml($_crumbInfo['title']) ?>"><?php echo $this->escapeHtml($_crumbInfo['label']) ?></a>
<?php elseif($_crumbInfo['last']): ?>
<strong><?php echo $this->escapeHtml($_crumbInfo['label']) ?></strong>
<?php else: ?>
<?php echo $this->escapeHtml($_crumbInfo['label']) ?>
<?php endif; ?>
<?php if(!$_crumbInfo['last']): ?>
<span>/ </span>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
How can I fix it?
Thanks in advance!
Ivan

I have use this code to resolve breadcrumb issue by google console warning please click here for test : https://search.google.com/structured-data/testing-tool#
<?php
$separator = $this->getBreadcrumbsSeparator();
?>
<?php if($crumbs && is_array($crumbs)): ?>
<div class="breadcrumbs" >
<ul itemscope itemtype="http://schema.org/BreadcrumbList">
<?php $i = 0; ?>
<?php foreach($crumbs as $_crumbName=>$_crumb): ?>
<li class="<?php echo $_crumbName ?>" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<?php if(!empty($_crumb['link']) && (!$_crumb['last'])): ?>
<a itemprop="item" href="<?php echo $_crumb['link'] ?>" title="<?php echo $this->htmlEscape($_crumb['label']) ?>" rel="v:url" property="v:title">
<?php echo $this->htmlEscape($_crumb['label']) ?>
<meta itemprop="position" content="<?php echo $i; ?>">
<meta itemprop="name" content="<?php echo $this->escapeHtml($_crumb['label']) ?>">
</a>
<?php elseif($_crumb['last']): ?>
<strong>
<?php echo $this->htmlEscape($_crumb['label']) ?>
<meta itemprop="position" content="<?php echo $i; ?>">
<meta itemprop="name" content="<?php echo $this->escapeHtml($_crumb['label']) ?>">
</strong>
<?php else: ?>
<?php echo $this->htmlEscape($_crumb['label']) ?>
<meta itemprop="position" content="<?php echo $i; ?>">
<meta itemprop="name" content="<?php echo $this->escapeHtml($_crumb['label']) ?>">
<?php endif; ?>
<?php if(!$_crumb['last']): ?>
<span><?php echo $separator; ?></span>
<meta itemprop="position" content="<?php echo $i; ?>">
<meta itemprop="name" content="<?php echo $this->escapeHtml($_crumb['label']) ?>">
<?php endif; ?>
</li>
<?php $i++; ?>
<?php endforeach; ?>
</ul>
</div>
Now, copy the code from a product page on your development site into the Google Web master Tools Google Structured Data. If Google can read your page then everything will be good. you can check there and if need then modify code little bit.to ckeck your code click here : https://search.google.com/structured-data/testing-tool

Replace your code with below code..
<?php if($crumbs && is_array($crumbs)): ?>
<div class="breadcrumbs">
<ul xmlns:v="http://rdf.data-vocabulary.org/#">
<?php foreach($crumbs as $_crumbName=>$_crumbInfo): ?>
<li class="<?php echo $_crumbName ?>" typeof="v:Breadcrumb">
<?php if($_crumbInfo['link']): ?>
<?php echo $this->escapeHtml($_crumbInfo['label']) ?>
<?php elseif($_crumbInfo['last']): ?>
<strong rel="v:url" property="v:title"><?php echo $this->escapeHtml($_crumbInfo['label']) ?></strong>
<?php else: ?>
<?php echo $this->escapeHtml($_crumbInfo['label']) ?>
<?php endif; ?>
<?php if(!$_crumbInfo['last']): ?>
<span>/ </span>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
Now, copy the code from a product page on your development site into the Google Web master Tools Google Structured Data. If Google can read your page then everything will be good. If not then Full Page Cache disappears them. You need to fix the problem of Magento not caching breadcrumbs. This site may help you to solve caching issue --> Fix Magento Cache Breadcrumb issue. I hope this will solve your issue. Another site to help -->> http://inchoo.net/magento/google-rich-snippets-in-magento/

You don't have a link for the last item of the breadcrumb. Google needs it to display the path instead of the URL
After <?php elseif($_crumbInfo['last']): ?>
add in front of <strong> and don't forget to close the tag in the end of course </strong>

I tried everything and nothing worked, so I ended up going with my own solution.
I created an override for app\design\frontend\base\default\template\page\html\breadcrumbs.phtml in my own theme and replaced this:
<?php if($crumbs && is_array($crumbs)): ?>
<div class="breadcrumbs">
<ul>
<?php foreach($crumbs as $_crumbName=>$_crumbInfo): ?>
<li class="<?php echo $_crumbName ?>">
<?php if($_crumbInfo['link']): ?>
<?php echo $this->escapeHtml($_crumbInfo['label']) ?>
<?php elseif($_crumbInfo['last']): ?>
<strong><?php echo $this->escapeHtml($_crumbInfo['label']) ?></strong>
<?php else: ?>
<?php echo $this->escapeHtml($_crumbInfo['label']) ?>
<?php endif; ?>
<?php if(!$_crumbInfo['last']): ?>
<span>/ </span>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
</div>
With this:
<?php if($crumbs && is_array($crumbs)): ?>
<div class="breadcrumbs">
<ul itemscope itemtype="http://schema.org/BreadcrumbList">
<?php $i = 0; ?>
<?php foreach($crumbs as $_crumbName=>$_crumbInfo): ?>
<li class="<?php echo $_crumbName ?>" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<?php if($_crumbInfo['link']): ?>
<a itemprop="item" href="<?php echo $_crumbInfo['link'] ?>" title="<?php echo $this->escapeHtml($_crumbInfo['title']) ?>">
<?php echo $this->escapeHtml($_crumbInfo['label']) ?>
<meta itemprop="position" content="<?php echo $i; ?>">
<meta itemprop="name" content="<?php echo $this->escapeHtml($_crumbInfo['label']) ?>">
</a>
<?php elseif($_crumbInfo['last']): ?>
<strong itemprop="item">
<?php echo $this->escapeHtml($_crumbInfo['label']) ?>
<meta itemprop="position" content="<?php echo $i; ?>">
<meta itemprop="name" content="<?php echo $this->escapeHtml($_crumbInfo['label']) ?>">
</strong>
<?php else: ?>
<span itemprop="item">
<?php echo $this->escapeHtml($_crumbInfo['label']) ?>
<meta itemprop="position" content="<?php echo $i; ?>">
<meta itemprop="name" content="<?php echo $this->escapeHtml($_crumbInfo['label']) ?>">
</span>
<?php endif; ?>
<?php if(!$_crumbInfo['last']): ?>
<span>/ </span>
<?php endif; ?>
</li>
<?php $i++; ?>
<?php endforeach; ?>
</ul>
</div>

Related

CTRL + Mouse click is not opening in new tab

we installed theme to our magento site.....
in that theme, there is a feature, in listings page, there is a pagination.
http://i.stack.imgur.com/TxA4E.png
once we click on that pages[ CTRL + Mouse click] its opening in new tab.
please scroll down fully last for below links.
working
but after we done lot of code chnages, now this feature is not working.
not working
is there any way we can find what is the problem.
frontend/base/default/template/page/html/pager.html
<?php if($this->getCollection()->getSize()): ?>
<?php if($this->getUseContainer()): ?>
<div class="pager">
<?php endif ?>
<?php if($this->getShowAmounts()): ?>
<p class="amount">
<?php if($this->getLastPageNum()>1): ?>
<?php echo $this->__('Items %s to %s of %s total', $this->getFirstNum(), $this->getLastNum(), $this->getTotalNum()) ?>
<?php else: ?>
<strong><?php echo $this->__('%s Item(s)', $this->getTotalNum()) ?></strong>
<?php endif; ?>
</p>
<?php endif ?>
<?php if($this->getShowPerPage()): ?>
<div class="limiter">
<label><?php echo $this->__('Show') ?></label>
<select onchange="setLocation(this.value)">
<?php foreach ($this->getAvailableLimit() as $_key=>$_limit): ?>
<option value="<?php echo $this->getLimitUrl($_key) ?>"<?php if($this->isLimitCurrent($_key)): ?> selected="selected"<?php endif ?>>
<?php echo $_limit ?>
</option>
<?php endforeach; ?>
</select> <?php echo $this->__('per page') ?>
</div>
<?php endif ?>
<?php if($this->getLastPageNum()>1): ?>
<div class="pages">
<strong><?php echo $this->__('Page:') ?></strong>
<ol>
<?php if (!$this->isFirstPage()): ?>
<li>
<a class="previous<?php if(!$this->getAnchorTextForPrevious()): ?> i-previous<?php endif;?>" href="<?php echo $this->getPreviousPageUrl() ?>" title="<?php echo $this->__('Previous') ?>">
<?php if(!$this->getAnchorTextForPrevious()): ?>
<img src="<?php echo $this->getSkinUrl('images/pager_arrow_left.gif') ?>" alt="<?php echo $this->__('Previous') ?>" class="v-middle" />
<?php else: ?>
<?php echo $this->getAnchorTextForPrevious() ?>
<?php endif;?>
</a>
</li>
<?php endif;?>
<?php if ($this->canShowFirst()): ?>
<li><a class="first" href="<?php echo $this->getFirstPageUrl() ?>">1</a></li>
<?php endif;?>
<?php if ($this->canShowPreviousJump()): ?>
<li><a class="previous_jump" title="" href="<?php echo $this->getPreviousJumpUrl() ?>">...</a></li>
<?php endif;?>
<?php foreach ($this->getFramePages() as $_page): ?>
<?php if ($this->isPageCurrent($_page)): ?>
<li class="current"><?php echo $_page ?></li>
<?php else: ?>
<li><?php echo $_page ?></li>
<?php endif;?>
<?php endforeach;?>
<?php if ($this->canShowNextJump()): ?>
<li><a class="next_jump" title="" href="<?php echo $this->getNextJumpUrl() ?>">...</a></li>
<?php endif;?>
<?php if ($this->canShowLast()): ?>
<li><a class="last" href="<?php echo $this->getLastPageUrl() ?>"><?php echo $this->getLastPageNum() ?></a></li>
<?php endif;?>
<?php if (!$this->isLastPage()): ?>
<li>
<a class="next<?php if(!$this->getAnchorTextForNext()): ?> i-next<?php endif; ?>" href="<?php echo $this->getNextPageUrl() ?>" title="<?php echo $this->__('Next') ?>">
<?php if(!$this->getAnchorTextForNext()): ?>
<img src="<?php echo $this->getSkinUrl('images/pager_arrow_right.gif') ?>" alt="<?php echo $this->__('Next') ?>" class="v-middle" />
<?php else: ?>
<?php echo $this->getAnchorTextForNext() ?>
<?php endif;?>
</a>
</li>
<?php endif;?>
</ol>
</div>
<?php endif; ?>
<?php if($this->getUseContainer()): ?>
</div>
<?php endif ?>
<?php endif ?>
Replace below code in your file
?php if($this->getCollection()->getSize()): ?>
<?php if($this->getUseContainer()): ?>
<div class="pager">
<?php endif ?>
<?php if($this->getShowAmounts()): ?>
<p class="amount">
<?php if($this->getLastPageNum()>1): ?>
<?php echo $this->__('Items %s to %s of %s total', $this->getFirstNum(), $this->getLastNum(), $this->getTotalNum()) ?>
<?php else: ?>
<strong><?php echo $this->__('%s Item(s)', $this->getTotalNum()) ?></strong>
<?php endif; ?>
</p>
<?php endif ?>
<?php if($this->getShowPerPage()): ?>
<div class="limiter">
<label><?php echo $this->__('Show') ?></label>
<select onchange="setLocation(this.value)">
<?php foreach ($this->getAvailableLimit() as $_key=>$_limit): ?>
<option value="<?php echo $this->getLimitUrl($_key) ?>"<?php if($this->isLimitCurrent($_key)): ?> selected="selected"<?php endif ?>>
<?php echo $_limit ?>
</option>
<?php endforeach; ?>
</select> <?php echo $this->__('per page') ?>
</div>
<?php endif ?>
<?php if($this->getLastPageNum()>1): ?>
<div class="pages">
<strong><?php echo $this->__('Page:') ?></strong>
<ol>
<?php if (!$this->isFirstPage()): ?>
<li>
<a target="_blank" class="previous<?php if(!$this->getAnchorTextForPrevious()): ?> i-previous<?php endif;?>" href="<?php echo $this->getPreviousPageUrl() ?>" title="<?php echo $this->__('Previous') ?>">
<?php if(!$this->getAnchorTextForPrevious()): ?>
<img src="<?php echo $this->getSkinUrl('images/pager_arrow_left.gif') ?>" alt="<?php echo $this->__('Previous') ?>" class="v-middle" />
<?php else: ?>
<?php echo $this->getAnchorTextForPrevious() ?>
<?php endif;?>
</a>
</li>
<?php endif;?>
<?php if ($this->canShowFirst()): ?>
<li><a target="_blank" class="first" href="<?php echo $this->getFirstPageUrl() ?>">1</a></li>
<?php endif;?>
<?php if ($this->canShowPreviousJump()): ?>
<li><a target="_blank" class="previous_jump" title="" href="<?php echo $this->getPreviousJumpUrl() ?>">...</a></li>
<?php endif;?>
<?php foreach ($this->getFramePages() as $_page): ?>
<?php if ($this->isPageCurrent($_page)): ?>
<li class="current"><?php echo $_page ?></li>
<?php else: ?>
<li><?php echo $_page ?></li>
<?php endif;?>
<?php endforeach;?>
<?php if ($this->canShowNextJump()): ?>
<li><a target="_blank" class="next_jump" title="" href="<?php echo $this->getNextJumpUrl() ?>">...</a></li>
<?php endif;?>
<?php if ($this->canShowLast()): ?>
<li><a target="_blank" class="last" href="<?php echo $this->getLastPageUrl() ?>"><?php echo $this->getLastPageNum() ?></a></li>
<?php endif;?>
<?php if (!$this->isLastPage()): ?>
<li>
<a target="_blank" class="next<?php if(!$this->getAnchorTextForNext()): ?> i-next<?php endif; ?>" href="<?php echo $this->getNextPageUrl() ?>" title="<?php echo $this->__('Next') ?>">
<?php if(!$this->getAnchorTextForNext()): ?>
<img src="<?php echo $this->getSkinUrl('images/pager_arrow_right.gif') ?>" alt="<?php echo $this->__('Next') ?>" class="v-middle" />
<?php else: ?>
<?php echo $this->getAnchorTextForNext() ?>
<?php endif;?>
</a>
</li>
<?php endif;?>
</ol>
</div>
<?php endif; ?>
<?php if($this->getUseContainer()): ?>
</div>
<?php endif ?>
just add "target='_blank'" property in <a> tag

Joomla loginform gives 500 error on bad attempt

At http://falkotl76.seventysix.axc.nl/youcollect/nl/inloggen I have a joomla loginform as a menu-item and it shows well.
When I make an attempt to login without any details it gives me a 500error and I cant figure out how to solve that.
Does anybody know how I can solve this ?
Thanks in regards,
Falko
Once I had the same issue and I fixed it by giving write permission to error.php file.
Path is - your joomla folder/log/error.php
Also make sure log and tmp path is correct in configuration.php
You need to load the client side validation javascript library. Create a template override for the com_users login view file default_login.php. At the top, add the JHtml::_('behavior.formvalidation'); line to load the library. And then add the class 'form-validate' to the form element. Below is an example:
defined('_JEXEC') or die;
JHtml::_('behavior.keepalive');
JHtml::_('behavior.formvalidation');
?>
<div class="login<?php echo $this->pageclass_sfx?>">
<?php if ($this->params->get('show_page_heading')) : ?>
<h1>
<?php echo $this->escape($this->params->get('page_heading')); ?>
</h1>
<?php endif; ?>
<?php if (($this->params->get('logindescription_show') == 1 && str_replace(' ', '', $this->params->get('login_description')) != '') || $this->params->get('login_image') != '') : ?>
<div class="login-description">
<?php endif ; ?>
<?php if($this->params->get('logindescription_show') == 1) : ?>
<?php echo $this->params->get('login_description'); ?>
<?php endif; ?>
<?php if (($this->params->get('login_image')!='')) :?>
<img src="<?php echo $this->escape($this->params->get('login_image')); ?>" class="login-image" alt="<?php echo JTEXT::_('COM_USER_LOGIN_IMAGE_ALT')?>"/>
<?php endif; ?>
<?php if (($this->params->get('logindescription_show') == 1 && str_replace(' ', '', $this->params->get('login_description')) != '') || $this->params->get('login_image') != '') : ?>
</div>
<?php endif ; ?>
<form action="<?php echo JRoute::_('index.php?option=com_users&task=user.login'); ?>" method="post" class="form-validate">
<fieldset>
<?php foreach ($this->form->getFieldset('credentials') as $field): ?>
<?php if (!$field->hidden): ?>
<div class="login-fields"><?php echo $field->label; ?>
<?php echo $field->input; ?></div>
<?php endif; ?>
<?php endforeach; ?>
<?php if (JPluginHelper::isEnabled('system', 'remember')) : ?>
<div class="login-fields">
<label id="remember-lbl" for="remember"><?php echo JText::_('JGLOBAL_REMEMBER_ME') ?></label>
<input id="remember" type="checkbox" name="remember" class="inputbox" value="yes" alt="<?php echo JText::_('JGLOBAL_REMEMBER_ME') ?>" />
</div>
<?php endif; ?>
<button type="submit" class="button"><?php echo JText::_('JLOGIN'); ?></button>
<input type="hidden" name="return" value="<?php echo base64_encode($this->params->get('login_redirect_url', $this->form->getValue('return'))); ?>" />
<?php echo JHtml::_('form.token'); ?>
</fieldset>
</form>
</div>
<div>
<ul>
<li>
<a href="<?php echo JRoute::_('index.php?option=com_users&view=reset'); ?>">
<?php echo JText::_('COM_USERS_LOGIN_RESET'); ?></a>
</li>
<li>
<a href="<?php echo JRoute::_('index.php?option=com_users&view=remind'); ?>">
<?php echo JText::_('COM_USERS_LOGIN_REMIND'); ?></a>
</li>
<?php
$usersConfig = JComponentHelper::getParams('com_users');
if ($usersConfig->get('allowUserRegistration')) : ?>
<li>
<a href="<?php echo JRoute::_('index.php?option=com_users&view=registration'); ?>">
<?php echo JText::_('COM_USERS_LOGIN_REGISTER'); ?></a>
</li>
<?php endif; ?>
</ul>
</div>
I added a couple of links of template overrides for reference. This should solve your issue.
http://docs.joomla.org/How_to_override_the_output_from_the_Joomla!_core
http://docs.joomla.org/Understanding_Output_Overrides

How to show pages on main category Magento

I have a project on Magento, and I have a weird problem. I have a main category, let's call it Main 1. And this main category has several sub categories. Let's call them Sub1, Sub2, ....
Main 1, Sub1, Sub2 have products inside. I have like 50 products in total for Main 1.
When I navigate to a subcategory, I have more products than I can see per page, so I have a pager.
But I don't know what happened on Main 1, that I can't see that pager. I have more products than I can see on Main 1, but I don't know what happened with the pager.
I suppose that there's been some change that I don't know on that main category, but I can't figure out which one.
So any ideas on how to recover that pager would be really appreciated.
Thanks!
This is my pager.html:
<?php if($this->getCollection()->getSize()): ?>
<?php if($this->getUseContainer()): ?>
<div class="pager">
<?php endif ?>
<?php if($this->getShowAmounts()): ?>
<p class="amount">
<?php if($this->getLastPageNum()>1): ?>
<?php echo $this->__('Items %s to %s of %s total', $this->getFirstNum(), $this->getLastNum(), $this->getTotalNum()) ?>
<?php else: ?>
<strong><?php echo $this->__('%s Item(s)', $this->getTotalNum()) ?></strong>
<?php endif; ?>
</p>
<?php endif ?>
<?php if($this->getShowPerPage()): ?>
<div class="limiter">
<label><?php echo $this->__('Show') ?></label>
<select onchange="setLocation(this.value)">
<?php foreach ($this->getAvailableLimit() as $_key=>$_limit): ?>
<option value="<?php echo $this->getLimitUrl($_key) ?>"<?php if($this->isLimitCurrent($_key)): ?> selected="selected"<?php endif ?>>
<?php echo $_limit ?>
</option>
<?php endforeach; ?>
</select> <?php echo $this->__('per page') ?>
</div>
<?php endif ?>
<?php if($this->getLastPageNum()>1): ?>
<div class="pages">
<strong><?php echo $this->__('Page:') ?></strong>
<ol>
<?php if (!$this->isFirstPage()): ?>
<li>
<a class="previous<?php if(!$this->getAnchorTextForPrevious()): ?> i-previous<?php endif;?>" href="<?php echo $this->getPreviousPageUrl() ?>" title="<?php echo $this->__('Previous') ?>">
<?php if(!$this->getAnchorTextForPrevious()): ?>
<img src="<?php echo $this->getSkinUrl('images/pager_arrow_left.gif') ?>" alt="<?php echo $this->__('Previous') ?>" class="v-middle" />
<?php else: ?>
<?php echo $this->getAnchorTextForPrevious() ?>
<?php endif;?>
</a>
</li>
<?php endif;?>
<?php if ($this->canShowFirst()): ?>
<li><a class="first" href="<?php echo $this->getFirstPageUrl() ?>">1</a></li>
<?php endif;?>
<?php if ($this->canShowPreviousJump()): ?>
<li><a class="previous_jump" title="" href="<?php echo $this->getPreviousJumpUrl() ?>">...</a></li>
<?php endif;?>
<?php foreach ($this->getFramePages() as $_page): ?>
<?php if ($this->isPageCurrent($_page)): ?>
<li class="current"><?php echo $_page ?></li>
<?php else: ?>
<li><?php echo $_page ?></li>
<?php endif;?>
<?php endforeach;?>
<?php if ($this->canShowNextJump()): ?>
<li><a class="next_jump" title="" href="<?php echo $this->getNextJumpUrl() ?>">...</a></li>
<?php endif;?>
<?php if ($this->canShowLast()): ?>
<li><a class="last" href="<?php echo $this->getLastPageUrl() ?>"><?php echo $this->getLastPageNum() ?></a></li>
<?php endif;?>
<?php if (!$this->isLastPage()): ?>
<li>
<a class="next<?php if(!$this->getAnchorTextForNext()): ?> i-next<?php endif; ?>" href="<?php echo $this->getNextPageUrl() ?>" title="<?php echo $this->__('Next') ?>">
<?php if(!$this->getAnchorTextForNext()): ?>
<img src="<?php echo $this->getSkinUrl('images/pager_arrow_right.gif') ?>" alt="<?php echo $this->__('Next') ?>" class="v-middle" />
<?php else: ?>
<?php echo $this->getAnchorTextForNext() ?>
<?php endif;?>
</a>
</li>
<?php endif;?>
</ol>
</div>
<?php endif; ?>
<?php if($this->getUseContainer()): ?>
</div>
<?php endif ?>
Solved. The layout rendered was different for main categories!

How to add an <em> to toplinks in Magento

Is there a way to edit the customer.xml file to add an tag to My account link from header?
I want something like this:
<ul class="links">
<li class="first">WISHLIST</li>
<li class="has-arrow">MY ACCOUNT <em class="sprite arrow-s type-1"></em></li>
<li class="last">LOGOUT</li>
</ul>
If it can't be done from customer.XML what file should I edit? Thanks.
Well, apparently you can't use in customer.xml something like <liParams> or <beforeText>. If you go in /base/default/template/page/template/links.phtml (the template file responsibile for rendering the links) you will see these lines:
<li<?php if($_link->getIsFirst()||$_link->getIsLast()): ?> class="<?php if($_link->getIsFirst()): ?>first<?php endif; ?><?php if($_link->getIsLast()): ?> last<?php endif; ?>"<?php endif; ?> <?php echo $_link->getLiParams() ?>>
<?php echo $_link->getBeforeText() ?>
<a href="<?php echo $_link->getUrl() ?>" title="<?php echo $_link->getTitle() ?>" <?php echo $_link->getAParams() ?>>
<?php echo $_link->getLabel() ?>
</a>
<?php echo $_link->getAfterText() ?>
</li>
So before the closing tag </a> it's only the label. So in order to add the <em> I've modified the code using this:
<li<?php if($_link->getIsFirst()||$_link->getIsLast()): ?> class="<?php if($_link->getIsFirst()): ?>first<?php endif; ?><?php if($_link->getIsLast()): ?> last<?php endif; ?>"<?php endif; ?> <?php echo $_link->getLiParams() ?>>
<?php echo $_link->getBeforeText() ?>
<a href="<?php echo $_link->getUrl() ?>" title="<?php echo $_link->getTitle() ?>" <?php echo $_link->getAParams() ?>>
<?php echo $_link->getLabel() ?>
<?php echo ($_link['label'] == 'My Account') ? '<em class="sprite arrow-s type-1"></em>' : '' ?>
</a>
<?php echo $_link->getAfterText() ?>
</li>

Magento pagination - Page numbers not displaying correctly when records per page is 45

I am dealing with a strange problem. In my product listing page, the pagination is not working properly.
I have a total of 187 items. In the pagination, the number of pages displayed is three. ie; 1,2,3
When I select 45 number of records per page, and selecting the 4 th page , the items are loaded correctly, but the pagination links are still displayed as 1, 2, 3 instead of 2,3,4 .
the template i am using is the frontend\mycompany\default\template\page/html/pager.phtml
and the block is MageWorx_SeoSuite_Block_Page_Html_Pager .
The pagination works without any problem for the number of records 15 and 30, the issue only appears when selecting 45 records per page.
The content of pager.phtml is,
<?php if($this->getCollection()->getSize()): ?>
<?php if($this->getUseContainer()): ?>
<div class="pager">
<?php endif ?>
<?php if($this->getShowAmounts()): ?>
<p class="amount">
<?php if($this->getLastPageNum()>1): ?>
<?php echo $this->__('Items %s to %s of %s total', $this->getFirstNum(), $this->getLastNum(), $this->getTotalNum()) ?>
<?php else: ?>
<strong><?php echo $this->__('%s Item(s)', $this->getTotalNum()) ?></strong>
<?php endif; ?>
</p>
<?php endif ?>
<?php if($this->getShowPerPage()): ?>
<div class="limiter">
<label><?php echo $this->__('Show') ?></label>
<select onchange="setLocation(this.value)">
<?php foreach ($this->getAvailableLimit() as $_key=>$_limit): ?>
<option value="<?php echo $this->getLimitUrl($_key) ?>"<?php if($this->isLimitCurrent($_key)): ?> selected="selected"<?php endif ?>>
<?php echo $_limit ?>
</option>
<?php endforeach; ?>
</select> <?php echo $this->__('per page') ?>
</div>
<?php endif ?>
<?php if($this->getLastPageNum()>1): ?>
<div class="pages">
<!-- <strong><?php echo $this->__('Page:') ?></strong>-->
<ol>
<?php if (!$this->isFirstPage()): ?>
<li>
<a class="previous<?php if(!$this->getAnchorTextForPrevious()): ?> i-previous<?php endif;?>" href="<?php echo $this->getPreviousPageUrl() ?>" title="<?php echo $this->__('Previous') ?>">
<?php if(!$this->getAnchorTextForPrevious()): ?>
<img src="<?php echo $this->getSkinUrl('images/pager_arrow_left.gif') ?>" alt="<?php echo $this->__('Previous') ?>" class="v-middle" />
<?php else: ?>
<?php echo $this->getAnchorTextForPrevious() ?>
<?php endif;?>
</a>
</li>
<?php endif;?>
<?php if ($this->canShowFirst()): ?>
<li><a class="first" href="<?php echo $this->getFirstPageUrl() ?>">1</a></li>
<?php endif;?>
<?php if ($this->canShowPreviousJump()): ?>
<li><a class="previous_jump" title="" href="<?php echo $this->getPreviousJumpUrl() ?>">...</a></li>
<?php endif;?>
<?php $i=0;foreach ($this->getFramePages() as $_page):if($i<3): ?>
<?php if ($this->isPageCurrent($_page)): ?>
<li class="current"><?php echo $_page ?></li>
<?php else: ?>
<li><?php echo $_page ?></li>
<?php endif;?>
<?php $i++;endif; endforeach;?>
<?php if ($this->canShowNextJump()): ?>
<li><a class="next_jump" title="" href="<?php echo $this->getNextJumpUrl() ?>">...</a></li>
<?php endif;?>
<?php if ($this->canShowLast()): ?>
<li><a class="last" href="<?php echo $this->getLastPageUrl() ?>"><?php echo $this->getLastPageNum() ?></a></li>
<?php endif;?>
<?php if (!$this->isLastPage()): ?>
<li>
<a class="next<?php if(!$this->getAnchorTextForNext()): ?> i-next<?php endif; ?>" href="<?php echo $this->getNextPageUrl() ?>" title="<?php echo $this->__('Next') ?>">
<?php if(!$this->getAnchorTextForNext()): ?>
<img src="<?php echo $this->getSkinUrl('images/pager_arrow_right.gif') ?>" alt="<?php echo $this->__('Next') ?>" class="v-middle" />
<?php else: ?>
<?php echo $this->getAnchorTextForNext() ?>
<?php endif;?>
</a>
</li>
<?php endif;?>
</ol>
</div>
<?php endif; ?>
<?php if($this->getUseContainer()): ?>
</div>
<?php endif ?>
I am a beginner to magento .
I fixed the problem.
In the Mage_Page_Block_Html_Pager class there is a protected variable $_displayPages and it is set as
protected $_displayPages = 5; // Page length for the navigation
So in my pager.html (frontend\mycompany\default\template\page\html\pager.phtml ) I made a small change as follows
<?php $i=0;foreach ($this->getFramePages() as $_page):if($i<5): ?>
We can simply change the page length according to our requirement. To do this, just override the Mage_Page_Block_Html_Pager class and change the protected $_displayPages variable.
We can also set the page length from adminside

Resources