public function deletebackgroundimageAction() { if ($datas = $this->getRequest()->getParams()) { try { if (empty($datas['value_id'])) { throw new Exception($this->_('An error occurred while deleting your picture')); } $option_value = new Application_Model_Option_Value(); $option_value->find($datas['value_id']); if (!$option_value->getId()) { throw new Exception($this->_('An error occurred while deleting your picture')); } $option_value->setBackgroundImage(null)->save(); $datas = array('success' => 1, 'background_image_url' => $option_value->reload()->getBackgroundImageUrl()); } catch (Exception $e) { $datas = array('error' => 1, 'message' => $e->getMessage()); } $this->getLayout()->setHtml(Zend_Json::encode($datas)); } }