*/ class Mage_Widget_Model_Resource_Widget extends Mage_Core_Model_Resource_Db_Abstract { /** * Define main table * */ protected function _construct() { $this->_init('widget/widget', 'widget_id'); } /** * Retrieves pre-configured parameters for widget * * @param int $widgetId * @return array */ public function loadPreconfiguredWidget($widgetId) { $readAdapter = $this->_getReadAdapter(); $select = $readAdapter->select() ->from($this->getMainTable()) ->where($this->getIdFieldName() . '=:' . $this->getIdFieldName()); $bind = array($this->getIdFieldName() => $widgetId); $widget = $readAdapter->fetchRow($select, $bind); if (is_array($widget)) { if ($widget['parameters']) { $widget['parameters'] = unserialize($widget['parameters']); } return $widget; } return false; } }