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

Customising New.php - Page loads to dead (doesn’t show anything other then a white page and the loading icon in the browserbar)
 
dlange
Jr. Member
 
Total Posts:  8
Joined:  2008-07-17
 

Hello,

I tried to modify the New.php, so that it fetches products with my custom attribute “new_product”. By doing this the page simply doesn’t stop to load and nothing shows up. Here is my Code:

class Mage_Catalog_Block_Product_New extends Mage_Catalog_Block_Product_Abstract
{
    
public function __construct()
    
{
        parent
::__construct();

        
$storeId    Mage::app()->getStore()->getId();

        
$product    Mage::getModel('catalog/product');
        
/* @var $product Mage_Catalog_Model_Product */
        /*

         */
        
$todayDate  $product->getResource()->formatDate(time());
        
$products   $product->setStoreId($storeId)->getCollection()
            ->
addAttributeToFilter('new_product', array('yes'=>true))
//            ->addAttributeToFilter('news_from_date', array('date'=>true, 'to'=> $todayDate))
//            ->addAttributeToFilter(array(array('attribute'=>'news_to_date', 'date'=>true, 'from'=>$todayDate), array('attribute'=>'news_to_date', 'is' => new Zend_Db_Expr('null'))),'','left')
            
->addAttributeToSort('name','desc')
            ->
addAttributeToSelect(array('name''price''small_image''short_description'), 'inner')
            ->
addAttributeToSelect(array('special_price''special_from_date''special_to_date'), 'left')
        ;
        
/* @var $products Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection */

        
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
        
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);

        
$products->setOrder('name')->setPageSize(5)->setCurPage(1);

        
$this->setProductCollection($products);
    
}
}

Does anybody know what the problem could be?

Thanks, Daniel

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