将阵列从模型返回到块在Magento 1.9中不起作用

将阵列从模型返回到块在Magento 1.9中不起作用,magento,magento-1.9,Magento,Magento 1.9,每当我直接在模型上打印并在块中调用函数时,此代码都能正常工作。但它不在返回中工作,在块中获取该值比在PHTML中获取块更有效。它当前在块中返回哪个值?是否清除块输出缓存?@Dhiren Vasoya:每当我从Model@Attoui拉姆齐:是的,先生,我已经清除了所有的浏览器cache@YogeshKhasturi我不是在说你的浏览器缓存,我说的是magento缓存 public function loadByField($field,$value) { $table = $this

每当我直接在模型上打印并在块中调用函数时,此代码都能正常工作。但它不在返回中工作,在块中获取该值比在PHTML中获取块更有效。

它当前在块中返回哪个值?是否清除块输出缓存?@Dhiren Vasoya:每当我从Model@Attoui拉姆齐:是的,先生,我已经清除了所有的浏览器cache@YogeshKhasturi我不是在说你的浏览器缓存,我说的是magento缓存
public function loadByField($field,$value)

{
     $table = $this->getMainTable();
     $where = $this->_getReadAdapter()->quoteInto("$field = ?", $value);
     $select = $this->_getReadAdapter()->select()->from($table,array('id'))->where($where);

     $id = $this->_getReadAdapter()->fetchOne($select);
     // print_r($id);

     return $id;
}