How to add an <em> to toplinks in Magento - 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>

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

how can i display products on home page in magento Version 1.9.0.1 in magento?

I want to show all products of one category in home page.For that i added the code in cms->homepage
{{block type="catalog/product_list" name="home.catalog.product.list" alias="products_homepage" category_id="3" template="catalog/product/list.phtml"}}
but it is showing the error
Fatal error: Call to a member function getSortedChildren() on a non-object in E:\xampp\htdocs\princemagento\testing\app\design\frontend\rwd\default\template\catalog\product\list.phtml on line 180
the code in list.phtml page
<?php
$_productCollection=$this->getLoadedProductCollection();
$_helper = $this->helper('catalog/output');
?>
<?php if(!$_productCollection->count()): ?>
<p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
<?php else: ?>
<div class="category-products">
<?php echo $this->getToolbarHtml() ?>
<?php // List mode ?>
<?php if($this->getMode()!='grid'): ?>
<?php $_iterator = 0; ?>
<ol class="products-list" id="products-list">
<?php foreach ($_productCollection as $_product): ?>
<li class="item<?php if( ++$_iterator == sizeof($_productCollection) ): ?> last<?php endif; ?>">
<?php // Product Image ?>
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image">
<?php /* Based on the native RWD styling, product images are displayed at a max of ~400px wide when viewed on a
one column page layout with four product columns from a 1280px viewport. For bandwidth reasons,
we are going to serve a 300px image, as it will look fine at 400px and most of the times, the image
will be displayed at a smaller size (eg, if two column are being used or viewport is smaller than 1280px).
This $_imgSize value could even be decreased further, based on the page layout
(one column, two column, three column) and number of product columns. */ ?>
<?php $_imgSize = 300; ?>
<img id="product-collection-image-<?php echo $_product->getId(); ?>"
src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->keepFrame(false)->resize($_imgSize); ?>"
alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
</a>
<?php // Product description ?>
<div class="product-shop">
<div class="f-fix">
<div class="product-primary">
<?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?>
<h2 class="product-name"><?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?></h2>
<?php if($_product->getRatingSummary()): ?>
<?php echo $this->getReviewsSummaryHtml($_product) ?>
<?php endif; ?>
<?php
$_nameAfterChildren = $this->getChild('name.after')->getSortedChildren();
foreach($_nameAfterChildren as $_nameAfterChildName):
$_nameAfterChild = $this->getChild('name.after')->getChild($_nameAfterChildName);
$_nameAfterChild->setProduct($_product);
?>
<?php echo $_nameAfterChild->toHtml(); ?>
<?php endforeach; ?>
</div>
<div class="product-secondary">
<?php echo $this->getPriceHtml($_product, true) ?>
</div>
<div class="product-secondary">
<?php if($_product->isSaleable() && !$_product->canConfigure()): ?>
<p class="action"><button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button></p>
<?php elseif($_product->isSaleable()): ?>
<p class="action"><a title="<?php echo $this->__('View Details') ?>" class="button" href="<?php echo $_product->getProductUrl() ?>"><?php echo $this->__('View Details') ?></a></p>
<?php else: ?>
<p class="action availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
<?php endif; ?>
<ul class="add-to-links">
<?php if ($this->helper('wishlist')->isAllow()) : ?>
<li><?php echo $this->__('Add to Wishlist') ?></li>
<?php endif; ?>
<?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
<li><span class="separator">|</span> <?php echo $this->__('Add to Compare') ?></li>
<?php endif; ?>
</ul>
</div>
<div class="desc std">
<?php echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
<?php echo $this->__('Learn More') ?>
</div>
</div>
</div>
</li>
<?php endforeach; ?>
</ol>
<script type="text/javascript">decorateList('products-list', 'none-recursive')</script>
<?php else: ?>
<?php // Grid Mode ?>
<?php $_collectionSize = $_productCollection->count() ?>
<?php $_columnCount = $this->getColumnCount(); ?>
<ul class="products-grid products-grid--max-<?php echo $_columnCount; ?>-col">
<?php $i=0; foreach ($_productCollection as $_product): ?>
<?php /*if ($i++%$_columnCount==0): ?>
<?php endif*/ ?>
<li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image">
<?php $_imgSize = 210; ?>
<img id="product-collection-image-<?php echo $_product->getId(); ?>"
src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize($_imgSize); ?>"
alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
</a>
<div class="product-info">
<h2 class="product-name"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></h2>
<?php
$_nameAfterChildren = $this->getChild('name.after')->getSortedChildren();
foreach($_nameAfterChildren as $_nameAfterChildName):
$_nameAfterChild = $this->getChild('name.after')->getChild($_nameAfterChildName);
$_nameAfterChild->setProduct($_product);
?>
<?php echo $_nameAfterChild->toHtml(); ?>
<?php endforeach; ?>
<?php echo $this->getPriceHtml($_product, true) ?>
<?php if($_product->getRatingSummary()): ?>
<?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
<?php endif; ?>
<div class="actions">
<?php if($_product->isSaleable() && !$_product->canConfigure()): ?>
<button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
<?php elseif($_product->isSaleable()): ?>
<a title="<?php echo $this->__('View Details') ?>" class="button" href="<?php echo $_product->getProductUrl() ?>"><?php echo $this->__('View Details') ?></a>
<?php else: ?>
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
<?php endif; ?>
<ul class="add-to-links">
<?php if ($this->helper('wishlist')->isAllow()) : ?>
<li><?php echo $this->__('Add to Wishlist') ?></li>
<?php endif; ?>
<?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
<li><span class="separator">|</span> <?php echo $this->__('Add to Compare') ?></li>
<?php endif; ?>
</ul>
</div>
</div>
</li>
<?php /*if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
<?php endif*/ ?>
<?php endforeach ?>
</ul>
<script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
<?php endif; ?>
<div class="toolbar-bottom">
<?php echo $this->getToolbarHtml() ?>
</div>
</div>
<?php endif; ?>
<?php
//set product collection on after blocks
$_afterChildren = $this->getChild('after')->getSortedChildren();
foreach($_afterChildren as $_afterChildName):
$_afterChild = $this->getChild('after')->getChild($_afterChildName);
$_afterChild->setProductCollection($_productCollection);
?>
<?php echo $_afterChild->toHtml(); ?>
<?php endforeach; ?>
I think there will be any other method to show products in magento v1.9.0.1.
If anyone knows this,please help me out.
Thanks!
{{block type="catalog/product_list" category_id="8" template="catalog/product/featured.phtml"}}
add above code in cms page and add featured.phtml file in catalog/product and put this code
<?php $_productCollection=$this->getLoadedProductCollection() ?>
<?php if(!$_productCollection->count()): ?>
<div class="note-msg">
<?php echo $this->__('There are no products matching the selection. Please provide a category ID.') ?>
</div>
<?php else: ?>
<?php // Grid Mode ?>
<ul id="featured" class="jcarousel-skin-tango">
<?php $_collectionSize = $_productCollection->count() ?>
<?php $i=0; foreach ($_productCollection as $_product): ?>
<?php if($i++%4==0): ?>
<?php endif ?>
<li><a class="preview" rel="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(300, 300); ?>" href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>">
<img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(105, 105); ?>" width="105" height="105" alt="<?php echo $this->htmlEscape($_product->getName()) ?>" />
</a> </li>
<?php if ($i%4==0 && $i!=$_collectionSize): ?>
<?php endif ?>
<?php endforeach ?>
</ul>

To implement the magento quick login

I have install the Quick Login extension. I have followed the instruction to use the extension. I copy the code from app/design/frontend/default/default/quicklogin/top.links.phtml. i use the following code on the top of my screen to login or register, but i could not get any result.
<ul class="links"<?php if($this->getName()): ?> id="<?php echo $this->getName() ?>"<?php endif;?>>
<?php foreach($_links as $_link): ?>
<?php if($_link->getLabel() != 'Log In'): ?>
<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>
<?php endif; ?>
<?php endforeach; ?>
<?php if(!$this->helper('customer')->isLoggedIn()) :?>
<li><a class="top-link-last" title="<?php echo $this->__('Login / Register') ?>" id="alogin" href="javascript:void(0)" ><?php echo $this->__('Login / Register') ?></a></li>
<?php endif; ?>
</ul>

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!

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