Magento Forum

How to bring Pagination in our own block ? 
 
john4u4u
Jr. Member
 
Total Posts:  6
Joined:  2008-02-06
 

Hi Moshe,

kindly help me.

I have created a CMS page for the newproducts in admin panel and i have created new.phtml page and linked to the cms page. the content of New products are coming fine. but i need to add pagination for that. kindly help me.

The code has follows (new.phtml)

<?php 

    $toolbar 
$this->getToolbarBlock();
    
$toolbar->setCollection($this->getProductCollection());

?>

<?php 
if (($_products $this->getProductCollection()) && $_products->getSize()): ?>

    
<h3><?php echo $this->__('New Products'?></h3>
   
    
    
    
    
    
       
   
      <
div class="atl_venteflash" >        
   
     
   
      
<?php $write Mage::getSingleton('core/resource')->getConnection('core_write'); ?>
   
     <?php $i
=0; foreach ($_products->getItems() as $_product): ?>
      
<div class="atl_displayproduct">
  
         
          
          
<?php //echo var_dump($_product); ?>
        
      
                  
            
<class="atl_venteproductname"><?php echo $this->htmlEscape($_product->getName())?></p>
            <
class="atl_venteproductref"><?php echo nl2br($_product->getsku()) ?></p>
            <
div class="atl_imgleft"
            
                          
        <
img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(125, 77); ?>"  alt="<?php echo $this->htmlEscape($_product->getName()) ?>" />  
                        
            </
div>
            
<?php // Product description ?>
            
<div class="atl_productdetails" >      
            <
class="list_tab_title">Caractéristiques : </p
            
            <
table class="list_table" cellpadding="0" cellspacing="0" >
    <
tbody>
    <
tr>
    <
td >&nbsp;</td>
    <
td <?php //echo nl2br($_product->getdesignation()) ?></td>
    
</tr>
       
<?php  
       
        $id 
$_product->entity_id
        
        
            
            
$readresult=$write->query("SELECT DISTINCT `ccev`.`value` FROM `catalog_category_entity_varchar` AS `ccev` INNER 

JOIN `catalog_category_product` AS `ccp` ON ccp.category_id = ccev.entity_id WHERE 

(ccp.product_id = "
.$id.") AND (ccev.attribute_id = 31) AND (ccev.store_id = 0)");

       
while (
$row $readresult->fetch() ) {
$val
=$row['value'];
}

            ?>
            
    
<tr>
    <
td class="list_tab_td1">Catégories :</td>
    <
td class="list_tab_td2"><?php  echo $val;//    echo $catname;   ?></td>
    
</tr>
    
<?php 
$readresult
=$write->query("select value from  `catalog_product_entity_varchar` where attribute_id='451' and entity_id='".$id."'");

       
while (
$row $readresult->fetch() ) {
$val
=$row['value'];
}



?>
    
<tr>
    <
td class="list_tab_td1">Marques auto :</td>
    <
td class="list_tab_td2"><?php echo $val;//echo nl2br($_product->getmarque_auto()) ?></td>
    
</tr>
    
<?php 
$readmodel
=$write->query("select value from  `catalog_product_entity_varchar` where attribute_id='452' and entity_id='".$id."'");


while (
$row $readmodel->fetch() ) {
$valmodel
=$row['value'];
}


?>

    
<tr>
    <
td class="list_tab_td1">Modèle :</td>
    <
td class="list_tab_td2"><?php echo $valmodel;
    
//echo nl2br($_product->getmodeles()) ?></td>
    
</tr>
    </
tbody>
    </
table>    
    
</
div>
            <
div class="clear_float"></div>
        <
div class="list_bottom">
            <
class="text_align_right">
                <
a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>">
                
voir la fiche produit
                
<img class="imgmiddle" style="margin-left: 6px;" title="voir" alt="voir" src="<?php echo $this->getSkinUrl('images/bout-arrow.gif')?>"/> 
                </
a>
            </
p>
        </
div>
    </
div>
      
<?php endforeach ?> 
 
      
<script language="Javascript1.2">
function 
printpage() {
window
.print();  
}
</script>

<div class="bout_bas_page">
<?php if ($_SESSION['nval'== 2{ ?>
<img title="Imprimer" onclick="[removed]printpage();" alt="Imprimer" src="<?php echo $this->getSkinUrl('images/bout-imprimereng.gif')?>"/>
<?php } else { ?>
<img title="Imprimer" onclick="[removed]printpage();" alt="Imprimer" src="<?php echo $this->getSkinUrl('images/bout-imprimer.gif')?>"/>
<?php } ?>

</div>
  
     
  
      <
script type="text/javascript">decorateTable('product-list-table')</script> 
  
       
  
      
</div>  
<?php endif; ?>
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top