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

System Configuration CMS Block Field
 
PaulE
Member
 
Avatar
Total Posts:  43
Joined:  2008-12-09
 

I would like to see this in Magento, for now you can only use the CMS Page source model, i would like to see this:
adminhtml/system_config_source_cms_block

It doesn’t exist yet, but I created the following file in “/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Cms”:

Block.php

<?php

class Mage_Adminhtml_Model_System_Config_Source_Cms_Block
{
    
protected $_options;

    public function 
toOptionArray()
    
{
        
if(!$this -> _options)
        
{
            $this    
-> _options = array(
                array(
                    
'value'    => 0,
                    
'label'    => Mage::helper('catalog') -> __('Please select static block ...'),
                )
            );

            
$options Mage::getResourceModel('cms/block_collection') -> load() -> toOptionArray();
            
$this -> _options array_merge($this -> _options$options);
        
}

        
return $this->_options;
    
}
}

This allows you to select an CMS Block in the configuration.

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