Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Products with pager on view
 
spider
Jr. Member
 
Avatar
Total Posts:  19
Joined:  2007-10-12
 

I have a new class a I need to retrieve all products with attribute promotion equal 1 And I know how to do that but the question is how to add in view layer a pager witch enable switching pages of this products. How to do that.

 
Magento Community Magento Community
Magento Community
Magento Community
 
jgautheron
Jr. Member
 
Avatar
Total Posts:  7
Joined:  2007-12-04
 

That’s a good question for I have no answer.
Cheers.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

In few last releases there was a block included Mage_Catalog_Block_Product_List_Random that shows example of product pager block implementation, that shows random 3 products.

so in your case it would be:

<?php

class Mage_Spider_Block_Product_List_Promotion extends Mage_Catalog_Block_Product_List
{
    
protected function _getProductCollection()
    
{
        
if (is_null($this->_productCollection)) {
            $collection 
Mage::getResourceModel('catalog/product_collection');
            
Mage::getModel('catalog/layer')->prepareProductCollection($collection);
// your custom filter
            
$collection->addAttributeToFilter('promotion'1);

            
$this->_productCollection $collection;
        
}
        
return $this->_productCollection;
    
}
}

Now, given that you have declared your blocks group, you can put this in your cms page:
{{block type="spider/product_list_promotion"}}

 
Magento Community Magento Community
Magento Community
Magento Community
 
Hugoto
Member
 
Avatar
Total Posts:  33
Joined:  2008-08-11
 

Hi, where is the Toolbar helper or better said how I can instantiate it?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top