Example #1
0
 /**
  * After save process
  *
  * @param Mage_Core_Model_Abstract $object
  * @return Mage_Bundle_Model_Resource_Option
  */
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     parent::_afterSave($object);
     $condition = array('option_id = ?' => $object->getId(), 'store_id = ? OR store_id = 0' => $object->getStoreId());
     $write = $this->_getWriteAdapter();
     $write->delete($this->getTable('bundle/option_value'), $condition);
     $data = new Varien_Object();
     $data->setOptionId($object->getId())->setStoreId($object->getStoreId())->setTitle($object->getTitle());
     $write->insert($this->getTable('bundle/option_value'), $data->getData());
     /**
      * also saving default value if this store view scope
      */
     if ($object->getStoreId()) {
         $data->setStoreId(0);
         $data->setTitle($object->getDefaultTitle());
         $write->insert($this->getTable('bundle/option_value'), $data->getData());
     }
     return $this;
 }
Example #2
0
 /**
  * After save process
  *
  * @param Mage_Core_Model_Abstract $object
  * @return Mage_Bundle_Model_Mysql4_Option
  */
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     parent::_afterSave($object);
     $condition = $this->_getWriteAdapter()->quoteInto('option_id = ?', $object->getId());
     $condition .= ' and (' . $this->_getWriteAdapter()->quoteInto('store_id = ?', $object->getStoreId());
     $condition .= ' or store_id = 0)';
     $this->_getWriteAdapter()->delete($this->getTable('option_value'), $condition);
     $data = new Varien_Object();
     $data->setOptionId($object->getId())->setStoreId($object->getStoreId())->setTitle($object->getTitle());
     $this->_getWriteAdapter()->insert($this->getTable('option_value'), $data->getData());
     /**
      * also saving default value if this store view scope
      */
     if ($object->getStoreId()) {
         $data->setStoreId('0');
         $data->setTitle($object->getDefaultTitle());
         $this->_getWriteAdapter()->insert($this->getTable('option_value'), $data->getData());
     }
     return $this;
 }