예제 #1
0
 /**
  * add to configuration array all existing in database static blocks
  * with their configuration
  *
  * @todo find better solution to get store ids for block (not using direct query)
  */
 protected function _save()
 {
     /** @var \Mage_Cms_Model_Resource_Block_Collection $staticBlockCollection */
     $staticBlockCollection = \Mage::getModel('cms/block')->getCollection();
     $this->_parser = Parser::getInstance();
     /** @var \Nexway_Cms_Model_Block $staticBlock */
     foreach ($staticBlockCollection as $staticBlock) {
         try {
             $data = $staticBlock->getData();
             $messageAction = 'block/save/' . $this->_truncate($data['title'], 40, '...');
             $this->_showActionMessage([$messageAction], $this->_configurationCounter);
             $data['content'] = $this->_parser->convert($data['content']);
             $data['stores'] = $this->_joinBlockStoreIds($data['block_id']);
             unset($data['block_id']);
             $this->_completeConfiguration[] = ['action' => 'block/create', 'parameters' => ['data' => $data]];
             echo $this->_colorizeString("[OK]\n", 'green');
         } catch (\Exception $error) {
             echo $this->_colorizeString("[ERROR]\n", 'red');
             $this->_prepareErrorMessage($error, $this->_configurationCounter);
         }
         $this->_configurationCounter++;
     }
     return TRUE;
 }