型号代码:
class Excellence_File_Model_File extends Mage_Core_Model_Abstract
{
public function _construct()
{
parent::_construct();
$this->_init('file/file');
}
public function saveFile($quote_id,$filename,$type){
$this->getResource()->deleteFile($quote_id,$filename,$type);
$this->setFilename($filename);
$this->setQuoteId($quote_id);
$this->setType($type);
$this->save();
}
}
观察员代码:
public function saveQuoteAfter($evt){
$quote = $evt->getQuote();
$post = Mage::app()->getRequest()->getPost();
if(isset($post['file_upload_path'])){
$quote_id = $quote->getId();
$filename = $post['file_upload_path'];
$type = $post['file_upload_type'];
Mage::log($quote_id.'xx'.$filename);
Mage::getModel('file/file')->saveFile($quote_id,$filename,$type);
}
}
}
我查看了所有论坛,没有发现任何内容,我需要发布变量以将其插入数据库中,感谢您的帮助,谢谢!