本文整理汇总了PHP中Mage_Eav_Model_Entity_Attribute_Backend_Abstract::afterSave方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Eav_Model_Entity_Attribute_Backend_Abstract::afterSave方法的具体用法?PHP Mage_Eav_Model_Entity_Attribute_Backend_Abstract::afterSave怎么用?PHP Mage_Eav_Model_Entity_Attribute_Backend_Abstract::afterSave使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Eav_Model_Entity_Attribute_Backend_Abstract
的用法示例。
在下文中一共展示了Mage_Eav_Model_Entity_Attribute_Backend_Abstract::afterSave方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: afterSave
/**
* Save uploaded file and set its name to entity
*
* @param Goodahead_Etm_Model_Entity $object
* @return void
*/
public function afterSave($object)
{
parent::afterSave($object);
$value = $object->getData($this->getAttribute()->getName());
if (is_array($value) && !empty($value['delete'])) {
$object->setData($this->getAttribute()->getName(), '');
$this->getAttribute()->getEntity()->saveAttribute($object, $this->getAttribute()->getName());
return $this;
}
$path = Mage::getBaseDir('media') . DS . 'goodahead' . DS . 'etm' . DS . 'images' . DS . $object->getEntityTypeInstance()->getEntityTypeCode() . DS . $this->getAttribute()->getAttributeCode() . DS;
try {
$uploader = new Varien_File_Uploader($this->getAttribute()->getName());
$uploader->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png'));
$uploader->setAllowRenameFiles(true);
$uploader->setAllowCreateFolders(true);
$uploader->setFilesDispersion(true);
$uploader->save($path);
$object->setData($this->getAttribute()->getName(), $uploader->getUploadedFileName());
$this->getAttribute()->getEntity()->saveAttribute($object, $this->getAttribute()->getName());
} catch (Exception $e) {
if ($e->getCode() != Varien_File_Uploader::TMP_NAME_EMPTY) {
Mage::logException($e);
}
/** @TODO ??? */
return $this;
}
return $this;
}
示例2: afterSave
public function afterSave($object)
{
parent::afterSave($object);
$object->getItemsCollection()->save();
$object->getShippingRatesCollection()->save();
return $this;
}
示例3: afterSave
public function afterSave($object)
{
parent::afterSave($object);
$object->getAddressesCollection()->save();
$object->getItemsCollection()->save();
$object->getPaymentsCollection()->save();
return $this;
}
示例4: afterSave
/**
* Explode the saved array again, because otherwise the indexer will think the value changed,
* even if it is the same (array(1,2,3) !== "1,2,3").
*
* @param Mage_Core_Model_Abstract $object
* @return Mage_Eav_Model_Entity_Attribute_Backend_Abstract
*/
public function afterSave($object)
{
$attributeCode = $this->getAttribute()->getAttributeCode();
$data = $object->getData($attributeCode);
if (is_string($data)) {
$object->setData($attributeCode, explode(',', $data));
}
return parent::afterSave($object);
}
示例5: afterSave
public function afterSave($object)
{
parent::afterSave($object);
/**
* Save creditmemo items
*/
foreach ($object->getAllItems() as $item) {
$item->save();
}
foreach ($object->getCommentsCollection() as $comment) {
$comment->save();
}
return $this;
}
示例6: afterSave
/**
* Method is invoked after save
*
* @param Varien_Object $object
* @return Mage_Sales_Model_Resource_Order_Invoice_Attribute_Backend_Parent
*/
public function afterSave($object)
{
parent::afterSave($object);
/**
* Save invoice items
*/
foreach ($object->getAllItems() as $item) {
$item->setOrderItem($item->getOrderItem());
$item->save();
}
foreach ($object->getCommentsCollection() as $comment) {
$comment->save();
}
return $this;
}
示例7: afterSave
/**
* Performed after data is saved
*
* @param Varien_Object $object
* @return Mage_Sales_Model_Resource_Order_Shipment_Attribute_Backend_Parent
*/
public function afterSave($object)
{
parent::afterSave($object);
/**
* Save Shipment items
*/
foreach ($object->getAllItems() as $item) {
$item->save();
}
/**
* Save Shipment tracks
*/
foreach ($object->getAllTracks() as $track) {
$track->save();
}
foreach ($object->getCommentsCollection() as $comment) {
$comment->save();
}
return $this;
}
示例8: afterSave
/**
* Perform operation after save
*
* @param Varien_Object $object
* @return Mage_Sales_Model_Resource_Order_Attribute_Backend_Parent
*/
public function afterSave($object)
{
parent::afterSave($object);
foreach ($object->getAddressesCollection() as $item) {
$item->save();
}
foreach ($object->getItemsCollection() as $item) {
$item->save();
}
foreach ($object->getPaymentsCollection() as $item) {
$item->save();
}
foreach ($object->getStatusHistoryCollection() as $item) {
$item->save();
}
foreach ($object->getRelatedObjects() as $object) {
$object->save();
}
return $this;
}
示例9: afterSave
/**
* Unserialize after saving
*
* @param Varien_Object $object
* @return Mage_Eav_Model_Entity_Attribute_Backend_Serialized
*/
public function afterSave($object)
{
parent::afterSave($object);
$this->_unserialize($object);
return $this;
}
示例10: afterSave
public function afterSave($object)
{
$storeId = $object->getStoreId();
$attributeId = $this->getAttribute()->getId();
$entityId = $object->getId();
$entityIdField = $this->getEntityIdField();
$entityTypeId = $this->getAttribute()->getEntity()->getTypeId();
$connection = $this->getConnection('write');
$values = $object->getData($this->getAttribute()->getName());
if (isset($values['position'])) {
foreach ((array) $values['position'] as $valueId => $position) {
if ($valueId >= 0) {
$condition = array($connection->quoteInto('value_id = ?', $valueId));
$data = array();
$data['position'] = $position;
$connection->update($this->getTable(), $data, $condition);
$valueIds[$valueId] = $valueId;
} else {
$data = array();
$data[$entityIdField] = $entityId;
$data['attribute_id'] = $attributeId;
$data['store_id'] = $storeId;
$data['position'] = $position;
$data['entity_type_id'] = $entityTypeId;
$connection->insert($this->getTable(), $data);
$valueIds[$valueId] = $connection->lastInsertId();
}
unset($uploadedFileName);
$types = $this->getImageTypes();
foreach ($types as $type) {
try {
$uploader = new Varien_File_Uploader($this->getAttribute()->getName() . '_' . $type . '[' . $valueId . ']');
$uploader->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png'));
} catch (Exception $e) {
continue;
}
if ($this->getAttribute()->getEntity()->getStoreId() == 0) {
$path = Mage::app()->getStore()->getConfig('system/filesystem/upload');
} else {
$path = $this->getAttribute()->getEntity()->getStore()->getConfig('system/filesystem/upload');
}
$uploader->save($path . '/' . $type . '/', 'image_' . $entityId . '_' . $valueIds[$valueId] . '.' . 'jpg');
if (!isset($uploadedFileName)) {
$uploadedFileName = $uploader->getUploadedFileName();
}
}
if (isset($uploadedFileName)) {
$condition = array($connection->quoteInto('value_id = ?', $valueIds[$valueId]));
$data = array();
$data['value'] = $uploadedFileName;
$connection->update($this->getTable(), $data, $condition);
} else {
if ($valueId < 0) {
$values['delete'][] = $valueIds[$valueId];
}
}
}
}
if (isset($values['delete'])) {
foreach ((array) $values['delete'] as $valueId) {
if ($valueId != '') {
$condition = array($connection->quoteInto('value_id = ?', $valueId));
$connection->delete($this->getTable(), $condition);
}
}
}
return parent::afterSave($object);
}
示例11: afterSave
/**
* Always update the related products after save.
*
* @param Varien_Object $object Object Model
* @return FireGento_DynamicCategory_Model_Entity_Attribute_Backend_Rule Self.
*/
public function afterSave($object)
{
$object->setIsChangedProductList(true);
return parent::afterSave($object);
}