コード例 #1
0
ファイル: Template.php プロジェクト: booklein/bookle
 /**
  * Assign page to store views
  *
  * @param Mage_Core_Model_Abstract $object
  */
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     // Code that flushes cache goes here
     Mage::app()->cleanCache(array(Mage_Core_Model_Store::CACHE_TAG, Mage_Cms_Model_Block::CACHE_TAG, Ves_BlockBuilder_Model_Block::CACHE_BLOCK_TAG));
     Mage::app()->cleanCache(array(Mage_Core_Model_Store::CACHE_TAG, Mage_Cms_Model_Block::CACHE_TAG, Ves_BlockBuilder_Model_Block::CACHE_PAGE_TAG));
     return parent::_afterSave($object);
 }
コード例 #2
0
ファイル: Store.php プロジェクト: jpbender/mage_virtual
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     parent::_afterSave($object);
     $this->_updateGroupDefaultStore($object->getGroupId(), $object->getId());
     $this->_changeGroup($object);
     return $this;
 }
コード例 #3
0
ファイル: Post.php プロジェクト: booklein/bookle
 /**
  * Assign page to store views
  *
  * @param Mage_Core_Model_Abstract $object
  */
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     $condition = $this->_getWriteAdapter()->quoteInto('post_id = ?', $object->getId());
     // process faq item to store relation
     $this->_getWriteAdapter()->delete($this->getTable('ves_blog/post_store'), $condition);
     $stores = $object->getData('stores');
     if ($stores) {
         foreach ((array) $object->getData('stores') as $store) {
             $storeArray = array();
             $storeArray['post_id'] = $object->getId();
             $storeArray['store_id'] = $store;
             $this->_getWriteAdapter()->insert($this->getTable('ves_blog/post_store'), $storeArray);
         }
     } else {
         $stores = $object->getStoreId();
         if ($stores) {
             foreach ((array) $stores as $store) {
                 $storeArray = array();
                 $storeArray['post_id'] = $object->getId();
                 $storeArray['store_id'] = $store;
                 $this->_getWriteAdapter()->insert($this->getTable('ves_blog/post_store'), $storeArray);
             }
         }
     }
     //Rewrite blog url
     $resroute = Mage::getStoreConfig('ves_blog/general_setting/route');
     $extension = ".html";
     Mage::getModel('core/url_rewrite')->loadByIdPath('venusblog/post/' . $object->getId())->setIdPath('venusblog/post/' . $object->getId())->setRequestPath($resroute . '/' . $object->getIdentifier() . $extension)->setTargetPath('venusblog/post/view/id/' . $object->getId())->save();
     return parent::_afterSave($object);
 }
コード例 #4
0
ファイル: Sliders.php プロジェクト: santhosh400/ecart
 /**
  *
  * @param Mage_Core_Model_Abstract $object
  */
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     $condition = $this->_getWriteAdapter()->quoteInto('slider_id = ?', $object->getId());
     // Stores
     $this->_getWriteAdapter()->delete($this->getTable('auguria_sliders/stores'), $condition);
     foreach ((array) $object->getData('stores') as $store) {
         $storeArray = array();
         $storeArray['slider_id'] = $object->getId();
         $storeArray['store_id'] = $store;
         $this->_getWriteAdapter()->insert($this->getTable('auguria_sliders/stores'), $storeArray);
     }
     // Cms pages
     $this->_getWriteAdapter()->delete($this->getTable('auguria_sliders/pages'), $condition);
     foreach ((array) $object->getData('pages') as $page) {
         $pageArray = array();
         $pageArray['slider_id'] = $object->getId();
         $pageArray['page_id'] = $page;
         $this->_getWriteAdapter()->insert($this->getTable('auguria_sliders/pages'), $pageArray);
     }
     // Category ids
     $this->_getWriteAdapter()->delete($this->getTable('auguria_sliders/categories'), $condition);
     foreach ((array) $object->getData('category_ids') as $category) {
         $categoryArray = array();
         $categoryArray['slider_id'] = $object->getId();
         $categoryArray['category_id'] = $category;
         $this->_getWriteAdapter()->insert($this->getTable('auguria_sliders/categories'), $categoryArray);
     }
     return parent::_afterSave($object);
 }
コード例 #5
0
ファイル: Status.php プロジェクト: cesarfelip3/clevermage_new
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     /** @var  Mirasvit_Helpdesk_Model_Status $object */
     if (!$object->getIsMassStatus()) {
     }
     return parent::_afterSave($object);
 }
コード例 #6
0
ファイル: News.php プロジェクト: zloadmin/modnyashka
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     $condition = $this->_getWriteAdapter()->quoteInto('news_id = ?', $object->getId());
     $this->_getWriteAdapter()->delete($this->getTable('news_store'), $condition);
     if (count($object->getData('stores')) && !in_array(0, (array) $object->getData('stores'))) {
         foreach ((array) $object->getData('stores') as $store) {
             $data = array();
             $data['news_id'] = $object->getId();
             $data['store_id'] = $store;
             $this->_getWriteAdapter()->insert($this->getTable('news_store'), $data);
         }
     } else {
         $data = array();
         $data['news_id'] = $object->getId();
         $data['store_id'] = '0';
         $this->_getWriteAdapter()->insert($this->getTable('news_store'), $data);
     }
     $condition = $this->_getWriteAdapter()->quoteInto('news_id = ?', $object->getId());
     $this->_getWriteAdapter()->delete($this->getTable('news_category'), $condition);
     foreach ((array) $object->getData('categories') as $category) {
         $data = array();
         $data['news_id'] = $object->getId();
         $data['category_id'] = $category;
         $this->_getWriteAdapter()->insert($this->getTable('news_category'), $data);
     }
     return parent::_afterSave($object);
 }
コード例 #7
0
ファイル: Set.php プロジェクト: codercv/urbansurprisedev
 /**
  * Perform actions after object save
  *
  * @param Mage_Core_Model_Abstract $object
  * @return Mage_Eav_Model_Mysql4_Entity_Attribute_Set
  */
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     if ($object->getGroups()) {
         /* @var $group Mage_Eav_Model_Entity_Attribute_Group */
         foreach ($object->getGroups() as $group) {
             $group->setAttributeSetId($object->getId());
             if ($group->itemExists() && !$group->getId()) {
                 continue;
             }
             $group->save();
         }
     }
     if ($object->getRemoveGroups()) {
         foreach ($object->getRemoveGroups() as $group) {
             /* @var $group Mage_Eav_Model_Entity_Attribute_Group */
             $group->delete();
         }
         Mage::getResourceModel('eav/entity_attribute_group')->updateDefaultGroup($object->getId());
     }
     if ($object->getRemoveAttributes()) {
         foreach ($object->getRemoveAttributes() as $attribute) {
             /* @var $attribute Mage_Eav_Model_Entity_Attribute */
             $attribute->deleteEntity();
         }
     }
     return parent::_afterSave($object);
 }
コード例 #8
0
ファイル: Post.php プロジェクト: ausger/myporto
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     $condition = $this->_getWriteAdapter()->quoteInto('post_id = ?', $object->getId());
     $this->_getWriteAdapter()->delete($this->getTable('store'), $condition);
     if (!$object->getData('stores')) {
         $storeArray = array();
         $storeArray['post_id'] = $object->getId();
         $storeArray['store_id'] = '0';
         $this->_getWriteAdapter()->insert($this->getTable('store'), $storeArray);
     } else {
         foreach ((array) $object->getData('stores') as $store) {
             $storeArray = array();
             $storeArray['post_id'] = $object->getId();
             $storeArray['store_id'] = $store;
             $this->_getWriteAdapter()->insert($this->getTable('store'), $storeArray);
         }
     }
     $condition = $this->_getWriteAdapter()->quoteInto('post_id = ?', $object->getId());
     $this->_getWriteAdapter()->delete($this->getTable('post_cat'), $condition);
     foreach ((array) $object->getData('cats') as $store) {
         $storeArray = array();
         $storeArray['post_id'] = $object->getId();
         $storeArray['cat_id'] = $store;
         $this->_getWriteAdapter()->insert($this->getTable('post_cat'), $storeArray);
     }
     return parent::_afterSave($object);
 }
コード例 #9
0
ファイル: Post.php プロジェクト: quanghuynt93/VesSmartshop
 /**
  * Assign page to store views
  *
  * @param Mage_Core_Model_Abstract $object
  */
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     $condition = $this->_getWriteAdapter()->quoteInto('post_id = ?', $object->getId());
     // process faq item to store relation
     $this->_getWriteAdapter()->delete($this->getTable('ves_blog/post_store'), $condition);
     $stores = $object->getData('stores');
     if ($stores) {
         foreach ((array) $object->getData('stores') as $store) {
             $storeArray = array();
             $storeArray['post_id'] = $object->getId();
             $storeArray['store_id'] = $store;
             $this->_getWriteAdapter()->insert($this->getTable('ves_blog/post_store'), $storeArray);
         }
     } else {
         $stores = $object->getStoreId();
         if ($stores) {
             foreach ((array) $stores as $store) {
                 $storeArray = array();
                 $storeArray['post_id'] = $object->getId();
                 $storeArray['store_id'] = $store;
                 $this->_getWriteAdapter()->insert($this->getTable('ves_blog/post_store'), $storeArray);
             }
         }
     }
     return parent::_afterSave($object);
 }
コード例 #10
0
ファイル: Post.php プロジェクト: ikommerce/fontis_blog
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     $writeAdapter = $this->_getWriteAdapter();
     $condition = $writeAdapter->quoteInto("post_id = ?", $object->getId());
     $writeAdapter->delete($this->getTable("store"), $condition);
     if ($object->getData("stores")) {
         foreach ((array) $object->getData("stores") as $store) {
             $storeArray = array();
             $storeArray["post_id"] = $object->getId();
             $storeArray["store_id"] = $store;
             $writeAdapter->insert($this->getTable("store"), $storeArray);
         }
     } else {
         $storeArray = array();
         $storeArray["post_id"] = $object->getId();
         $storeArray["store_id"] = Mage::app()->getStore(true)->getId();
         $writeAdapter->insert($this->getTable("store"), $storeArray);
     }
     $condition = $writeAdapter->quoteInto("post_id = ?", $object->getId());
     $writeAdapter->delete($this->getTable("post_cat"), $condition);
     foreach ((array) $object->getData("cats") as $catId) {
         $storeArray = array();
         $storeArray["post_id"] = $object->getId();
         $storeArray["cat_id"] = $catId;
         $writeAdapter->insert($this->getTable("post_cat"), $storeArray);
     }
     return parent::_afterSave($object);
 }
コード例 #11
0
ファイル: Hideprice.php プロジェクト: CE-Webmaster/CE-Hub
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     parent::_afterSave($object);
     // process object to store relation
     $stores = $object->getData('store_id');
     if (is_array($stores)) {
         if (empty($stores) || in_array('0', $stores, true)) {
             $stores = array('0');
         }
     } else {
         $stores = array_map('intval', explode(',', strval($stores)));
     }
     $mode = $object->getData('mode');
     $exclCh = $object->getData('exclude_children');
     $priority = $object->getData(self::FIELD_PRIORITY);
     $groups = $object->getData(self::FIELD_GROUPS);
     if (is_array($groups)) {
         $groups = implode(',', $groups);
     } else {
         $groups = (string) $groups;
     }
     foreach ($stores as $store) {
         $this->_getWriteAdapter()->delete($this->_storeTable, $this->_getWriteAdapter()->quoteInto('hp_id = ?', $object->getId()) . ' AND ' . $this->_getWriteAdapter()->quoteInto('store_id = ?', $store));
         if (!$object->getData('delete')) {
             $this->_getWriteAdapter()->insert($this->_storeTable, array(self::FIELD_HP_ID => $object->getId(), self::FIELD_STORE_ID => $store, self::FIELD_HIDEPRICE_MODE => $mode, self::FIELD_IS_EXCL_CHILDREN => (int) (bool) $exclCh, self::FIELD_GROUPS => $groups, self::FIELD_PRIORITY => (int) $priority));
         }
     }
     return $this;
 }
コード例 #12
0
ファイル: Rewrite.php プロジェクト: technomagegithub/olgo.nl
 /**
  * Call-back function
  */
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     if (!$object->getIsMassStatus()) {
         $this->_saveToStoreTable($object);
     }
     return parent::_afterSave($object);
 }
コード例 #13
0
 /**
  * Perform actions after object save
  *
  * @param Mage_Core_Model_Abstract $object
  * @return Mage_Core_Model_Mysql4_Website
  */
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     if ($object->getIsDefault()) {
         $this->_getWriteAdapter()->update($this->getMainTable(), array('is_default' => 0), 1);
         $this->_getWriteAdapter()->update($this->getMainTable(), array('is_default' => 1), $this->_getWriteAdapter()->quoteInto('website_id=?', $object->getId()));
     }
     return parent::_afterSave($object);
 }
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     /** @var  Mirasvit_Helpdesk_Model_Permission $object */
     if (!$object->getIsMassStatus()) {
         $this->saveDepartmentIds($object);
     }
     return parent::_afterSave($object);
 }
コード例 #15
0
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     /** @var  Mirasvit_Helpdesk_Model_Template $object */
     if (!$object->getIsMassStatus()) {
         $this->saveStoreIds($object);
     }
     return parent::_afterSave($object);
 }
コード例 #16
0
 /**
  * Processing object after save data
  * Update app_code as Store + Device + 123 (increment).
  *
  * @param Mage_Core_Model_Abstract $object
  * @return Mage_Core_Model_Abstract
  */
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     $appCode = $object->getCode();
     $isCodePrefixed = $object->isCodePrefixed();
     if (!$isCodePrefixed) {
         $this->_getWriteAdapter()->update($this->getMainTable(), array('code' => $appCode . $object->getId()), $this->_getWriteAdapter()->quoteInto($this->getIdFieldName() . '=?', $object->getId()));
     }
     return parent::_afterSave($object);
 }
コード例 #17
0
ファイル: Rule.php プロジェクト: bevello/bevello
 /**
  * Perform actions after object save
  *
  * @param Mage_Core_Model_Abstract $rule
  *
  * @return Mage_Core_Model_Mysql4_Abstract
  */
 protected function _afterSave(Mage_Core_Model_Abstract $rule)
 {
     if ($rule->hasData('website_ids')) {
         $this->_saveWebsiteIds($rule);
     }
     if ($rule->hasData('store_messages')) {
         $this->_saveMessageData($rule);
     }
     return parent::_afterSave($rule);
 }
コード例 #18
0
 /**
  * Perform actions after object save
  *
  * @param Mage_Core_Model_Abstract $object
  */
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     if ($object->getAttributes()) {
         foreach ($object->getAttributes() as $attribute) {
             $attribute->setAttributeGroupId($object->getId());
             $attribute->save();
         }
     }
     return parent::_afterSave($object);
 }
コード例 #19
0
ファイル: Department.php プロジェクト: protechhelp/gamamba
 /**
  * @param Mage_Core_Model_Abstract $object
  *
  * @return $this|Mage_Core_Model_Resource_Db_Abstract
  */
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     $_result = parent::_afterSave($object);
     if (strlen($object->getStoreIds()) > 0) {
         $object->setStoreIds(array_map('intval', explode(',', $object->getStoreIds())));
     } else {
         $object->setStoreIds(array());
     }
     return $_result;
 }
コード例 #20
0
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     $queueCollection = Mage::getModel('email/queue')->getCollection()->addFieldToFilter('recipient_email', $object->getEmail())->addFieldToFilter('status', Mirasvit_Email_Model_Queue::STATUS_PENDING);
     if ($object->getTriggerId() > 0) {
         $queueCollection->addFieldToFilter('trigger_id', $object->getTriggerId());
     }
     foreach ($queueCollection as $item) {
         $item->unsubscribe();
     }
     return parent::_afterSave($object);
 }
コード例 #21
0
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     // fix for Varien_Db_Adapter_Pdo_Mysql::prepareColumnValue
     // an empty string cannot be saved -> NULL is saved instead
     // for Magento version > 1.6.x.x
     foreach ($object->getData() as $key => $value) {
         if ($value instanceof Zend_Db_Expr && $value->__toString() === '\'\'') {
             $object->setData($key, '');
         }
     }
     return parent::_afterSave($object);
 }
コード例 #22
0
 /**
  *
  * @param Mage_Core_Model_Abstract $object
  *
  * @return Zitec_Dpd_Model_Mysql4_Dpd_Manifest
  */
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     $result = parent::_afterSave($object);
     $manifest = $object;
     /* @var $manifest Zitec_Dpd_Model_Dpd_Manifest */
     foreach ($manifest->getShipsForManifest() as $ship) {
         /* @var $ship Zitec_Dpd_Model_Dpd_Ship */
         $ship->setManifestId($manifest->getId());
         $ship->save();
     }
     return $result;
 }
コード例 #23
0
ファイル: Rule.php プロジェクト: jpbender/mage_virtual
 /**
  * Save Customer Segment relations after save rule
  *
  * @param Enterprise_TargetRule_Model_Rule $object
  * @return Enterprise_TargetRule_Model_Mysql4_Rule
  */
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     parent::_afterSave($object);
     //        $this->_saveCustomerSegmentRelations($object);
     $this->_prepareRuleProducts($object);
     if (!$object->isObjectNew() && $object->getOrigData('apply_to') != $object->getData('apply_to')) {
         Mage::getResourceModel('enterprise_targetrule/index')->cleanIndex();
     } else {
         Mage::getResourceModel('enterprise_targetrule/index')->cleanIndex($object->getData('apply_to'));
     }
     return $this;
 }
コード例 #24
0
ファイル: Member.php プロジェクト: bele90/magento-test2
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     $condition = $this->_getWriteAdapter()->quoteInto('member_id = ?', $object->getId());
     $this->_getWriteAdapter()->delete($this->getTable('bluecom_team/memdept'), $condition);
     foreach ((array) $object->getData('departments') as $department) {
         $data = array();
         $data['member_id'] = $object->getId();
         $data['department_id'] = $department;
         $this->_getWriteAdapter()->insert($this->getTable('bluecom_team/memdept'), $data);
     }
     return parent::_afterSave($object);
 }
コード例 #25
0
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     $condition = $this->_getWriteAdapter()->quoteInto('agreement_id = ?', $object->getId());
     $this->_getWriteAdapter()->delete($this->getTable('checkout/agreement_store'), $condition);
     foreach ((array) $object->getData('stores') as $store) {
         $storeArray = array();
         $storeArray['agreement_id'] = $object->getId();
         $storeArray['store_id'] = $store;
         $this->_getWriteAdapter()->insert($this->getTable('checkout/agreement_store'), $storeArray);
     }
     return parent::_afterSave($object);
 }
コード例 #26
0
ファイル: Email.php プロジェクト: cesarfelip3/clevermage_new
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     /** @var  Mirasvit_Helpdesk_Model_Email $object */
     if (!$object->getIsMassStatus()) {
     }
     if ($object->getAttachmentMessageId()) {
         $resource = Mage::getSingleton('core/resource');
         $writeConnection = $resource->getConnection('core_write');
         $query = "UPDATE {$resource->getTableName('helpdesk/attachment')} SET message_id = '{$object->getAttachmentMessageId()}' WHERE email_id = {$object->getId()}";
         $writeConnection->query($query);
     }
     return parent::_afterSave($object);
 }
コード例 #27
0
 /**
  * Perform actions after object save
  *
  * @param Mage_Core_Model_Abstract $object
  * @return Mage_Core_Model_Mysql4_Variable
  */
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     parent::_afterSave($object);
     if ($object->getUseDefaultValue()) {
         /*
          * remove store value
          */
         $this->_getWriteAdapter()->delete($this->getTable('core/variable_value'), array('variable_id = ?' => $object->getId(), 'store_id = ?' => $object->getStoreId()));
     } else {
         $this->_getWriteAdapter()->insertOnDuplicate($this->getTable('core/variable_value'), array('variable_id' => $object->getId(), 'store_id' => $object->getStoreId(), 'plain_value' => $object->getPlainValue(), 'html_value' => $object->getHtmlValue()), array('plain_value', 'html_value'));
     }
     return $this;
 }
コード例 #28
0
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     if (!$object->getIsMassStatus()) {
         if ($object->getPath() == '/') {
             $object->setPath($object->getId());
             $this->_savePath($object);
         } elseif (substr($object->getPath(), -1) == '/') {
             $object->setPath($object->getPath() . $object->getId());
             $this->_savePath($object);
         }
         $this->_saveStore($object);
     }
     return parent::_afterSave($object);
 }
コード例 #29
0
ファイル: Segment.php プロジェクト: jpbender/mage_virtual
 /**
  * Perform actions after object save
  *
  * @param Mage_Core_Model_Abstract $object
  */
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     $id = $object->getId();
     $this->_getWriteAdapter()->delete($this->getTable('enterprise_customersegment/event'), array('segment_id = ?' => $id));
     if ($object->getMatchedEvents() && is_array($object->getMatchedEvents())) {
         foreach ($object->getMatchedEvents() as $event) {
             $data = array('segment_id' => $id, 'event' => $event);
             $this->_getWriteAdapter()->insert($this->getTable('enterprise_customersegment/event'), $data);
         }
     }
     if ($object->hasData('website_ids')) {
         $this->_saveWebsiteIds($object);
     }
     return parent::_afterSave($object);
 }
コード例 #30
0
ファイル: Event.php プロジェクト: jpbender/mage_virtual
 /**
  * Save assigned processes
  *
  * @param   Mage_Core_Model_Abstract $object
  * @return  Mage_Index_Model_Mysql4_Event
  */
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     $processIds = $object->getProcessIds();
     if (is_array($processIds)) {
         $processTable = $this->getTable('index/process_event');
         if (empty($processIds)) {
             $this->_getWriteAdapter()->delete($processTable);
         } else {
             foreach ($processIds as $processId => $processStatus) {
                 $data = array('process_id' => $processId, 'event_id' => $object->getId(), 'status' => $processStatus);
                 $this->_getWriteAdapter()->insertOnDuplicate($processTable, $data, array('status'));
             }
         }
     }
     return parent::_afterSave($object);
 }