当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Sales_Model_Abstract::_beforeSave方法代码示例

本文整理汇总了PHP中Mage_Sales_Model_Abstract::_beforeSave方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Abstract::_beforeSave方法的具体用法?PHP Mage_Sales_Model_Abstract::_beforeSave怎么用?PHP Mage_Sales_Model_Abstract::_beforeSave使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Sales_Model_Abstract的用法示例。


在下文中一共展示了Mage_Sales_Model_Abstract::_beforeSave方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _beforeSave

 /**
  * Before object save
  *
  * @return Mage_Sales_Model_Order_Creditmemo_Comment
  */
 protected function _beforeSave()
 {
     parent::_beforeSave();
     if (!$this->getParentId() && $this->getCreditmemo()) {
         $this->setParentId($this->getCreditmemo()->getId());
     }
     return $this;
 }
开发者ID:codercv,项目名称:urbansurprisedev,代码行数:13,代码来源:Comment.php

示例2: _beforeSave

 /**
  * Before object save manipulations
  *
  * @return Mage_Sales_Model_Order_Creditmemo
  */
 protected function _beforeSave()
 {
     parent::_beforeSave();
     if (!$this->getOrderId() && $this->getOrder()) {
         $this->setOrderId($this->getOrder()->getId());
         $this->setBillingAddressId($this->getOrder()->getBillingAddress()->getId());
     }
     return $this;
 }
开发者ID:hirentricore,项目名称:devmagento,代码行数:14,代码来源:Creditmemo.php

示例3: _beforeSave

 /**
  * Processing object before save data
  *
  * @return Mage_Core_Model_Abstract
  */
 protected function _beforeSave()
 {
     parent::_beforeSave();
     $this->_checkState();
     if (!$this->getId()) {
         $store = $this->getStore();
         $name = array($store->getWebsite()->getName(), $store->getGroup()->getName(), $store->getName());
         $this->setStoreName(implode("\n", $name));
     }
     if (!$this->getIncrementId()) {
         $incrementId = Mage::getSingleton('eav/config')->getEntityType('order')->fetchNewIncrementId($this->getStoreId());
         $this->setIncrementId($incrementId);
     }
     /**
      * Process items dependency for new order
      */
     if (!$this->getId()) {
         $itemsCount = 0;
         foreach ($this->getAllItems() as $item) {
             $parent = $item->getQuoteParentItemId();
             if ($parent && !$item->getParentItem()) {
                 $item->setParentItem($this->getItemByQuoteItemId($parent));
             } elseif (!$parent) {
                 $itemsCount++;
             }
         }
         // Set items count
         $this->setTotalItemCount($itemsCount);
     }
     if ($this->getCustomer()) {
         $this->setCustomerId($this->getCustomer()->getId());
     }
     if ($this->hasBillingAddressId() && $this->getBillingAddressId() === null) {
         $this->unsBillingAddressId();
     }
     if ($this->hasShippingAddressId() && $this->getShippingAddressId() === null) {
         $this->unsShippingAddressId();
     }
     $this->setData('protect_code', substr(md5(uniqid(mt_rand(), true) . ':' . microtime(true)), 5, 6));
     return $this;
 }
开发者ID:blazeriaz,项目名称:youguess,代码行数:46,代码来源:Order.php

示例4: _beforeSave

 /**
  * Before object save
  *
  * @return Mage_Sales_Model_Order_Shipment
  */
 protected function _beforeSave()
 {
     if ((!$this->getId() || null !== $this->_items) && !count($this->getAllItems())) {
         Mage::throwException(Mage::helper('sales')->__('Cannot create an empty shipment.'));
     }
     if (!$this->getOrderId() && $this->getOrder()) {
         $this->setOrderId($this->getOrder()->getId());
         $this->setShippingAddressId($this->getOrder()->getShippingAddress()->getId());
     }
     if ($this->getPackages() && !is_scalar($this->getPackages())) {
         $this->setPackages(serialize($this->getPackages()));
     }
     return parent::_beforeSave();
 }
开发者ID:hyhoocchan,项目名称:mage-local,代码行数:19,代码来源:Shipment.php

示例5: _beforeSave

 /**
  * Processing object before save data
  *
  * @return Mage_Core_Model_Abstract
  */
 protected function _beforeSave()
 {
     parent::_beforeSave();
     $this->_checkState();
     if (!$this->getId()) {
         $store = $this->getStore();
         $name = array($store->getWebsite()->getName(), $store->getGroup()->getName(), $store->getName());
         $this->setStoreName(implode("\n", $name));
     }
     /**
      * Process items dependency for new order
      */
     if (!$this->getId()) {
         foreach ($this->getAllItems() as $item) {
             if ($parent = $item->getQuoteParentItemId() && !$item->getParentItem()) {
                 $item->setParentItem($this->getItemByQuoteItemId($parent));
             }
         }
     }
     return $this;
 }
开发者ID:HelioFreitas,项目名称:magento-pt_br,代码行数:26,代码来源:Order.php

示例6: _beforeSave

 /**
  * Processing object before save data
  *
  * @return Mage_Core_Model_Abstract
  */
 protected function _beforeSave()
 {
     parent::_beforeSave();
     $this->_checkState();
     if (!$this->getId()) {
         $store = $this->getStore();
         $name = array($store->getWebsite()->getName(), $store->getGroup()->getName(), $store->getName());
         $this->setStoreName(implode("\n", $name));
     }
     /**
      * Process items dependency for new order
      */
     if (!$this->getId()) {
         foreach ($this->getAllItems() as $item) {
             if ($parent = $item->getQuoteParentItemId() && !$item->getParentItem()) {
                 $item->setParentItem($this->getItemByQuoteItemId($parent));
             }
         }
     }
     if ($this->getCustomer()) {
         $this->setCustomerId($this->getCustomer()->getId());
     }
     $this->setData('protect_code', substr(md5(uniqid(mt_rand(), true) . ':' . microtime(true)), 5, 6));
     return $this;
 }
开发者ID:joebushi,项目名称:magento-mirror,代码行数:30,代码来源:Order.php

示例7: _beforeSave

 protected function _beforeSave()
 {
     if (!count($this->getAllItems())) {
         Mage::throwException(Mage::helper('sales')->__('Cannot create an empty shipment.'));
     }
     return parent::_beforeSave();
 }
开发者ID:Rinso,项目名称:magento-mirror,代码行数:7,代码来源:Shipment.php

示例8: _beforeSave

 /**
  * Set order again if required
  * @return Mage_Sales_Model_Order_Status_History
  */
 protected function _beforeSave()
 {
     if ($this->_shouldSetOrderBeforeSave) {
         $this->setOrder($this->_order);
     }
     return parent::_beforeSave();
 }
开发者ID:hunnybohara,项目名称:magento-chinese-localization,代码行数:11,代码来源:History.php


注:本文中的Mage_Sales_Model_Abstract::_beforeSave方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。