本文整理汇总了PHP中Mage_Sales_Model_Resource_Order_Abstract类的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Resource_Order_Abstract类的具体用法?PHP Mage_Sales_Model_Resource_Order_Abstract怎么用?PHP Mage_Sales_Model_Resource_Order_Abstract使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mage_Sales_Model_Resource_Order_Abstract类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _initVirtualGridColumns
/**
* Init virtual grid records for entity
*
* @return Mage_Sales_Model_Resource_Order_Invoice
*/
protected function _initVirtualGridColumns()
{
parent::_initVirtualGridColumns();
$adapter = $this->_getReadAdapter();
$checkedFirstname = $adapter->getIfNullSql('{{table}}.firstname', $adapter->quote(''));
$checkedLastname = $adapter->getIfNullSql('{{table}}.lastname', $adapter->quote(''));
$this->addVirtualGridColumn('billing_name', 'sales_flat_order_address', array('billing_address_id' => 'entity_id'), $adapter->getConcatSql(array($checkedFirstname, $adapter->quote(' '), $checkedLastname)))->addVirtualGridColumn('order_increment_id', 'sales_flat_order', array('order_id' => 'entity_id'), 'increment_id')->addVirtualGridColumn('order_created_at', 'sales_flat_order', array('order_id' => 'entity_id'), 'created_at');
return $this;
}
示例2: _initVirtualGridColumns
/**
* Init virtual grid records for entity
*
* @return Mage_Sales_Model_Resource_Order
*/
protected function _initVirtualGridColumns()
{
parent::_initVirtualGridColumns();
$adapter = $this->getReadConnection();
$ifnullFirst = $adapter->getIfNullSql('{{table}}.firstname', $adapter->quote(''));
$ifnullLast = $adapter->getIfNullSql('{{table}}.lastname', $adapter->quote(''));
$concatAddress = $adapter->getConcatSql(array($ifnullFirst, $adapter->quote(' '), $ifnullLast));
$this->addVirtualGridColumn('billing_name', 'sales_flat_order_address', array('billing_address_id' => 'entity_id'), $concatAddress)->addVirtualGridColumn('shipping_name', 'sales_flat_order_address', array('shipping_address_id' => 'entity_id'), $concatAddress);
return $this;
}
示例3: _afterSave
/**
* Update related grid table after object save
*
* @param Varien_Object $object
* @return Mage_Core_Model_Resource_Db_Abstract
*/
protected function _afterSave(Mage_Core_Model_Abstract $object)
{
$resource = parent::_afterSave($object);
if ($object->hasDataChanges() && $object->getOrder()) {
$gridList = array('sales/order' => 'entity_id', 'sales/order_invoice' => 'order_id', 'sales/order_shipment' => 'order_id', 'sales/order_creditmemo' => 'order_id');
// update grid table after grid update
foreach ($gridList as $gridResource => $field) {
Mage::getResourceModel($gridResource)->updateOnRelatedRecordChanged($field, $object->getParentId());
}
}
return $resource;
}
示例4: _beforeSave
/**
* Lookup for parent_id in already saved transactions of this payment by the order_id
* Also serialize additional information, if any
*
* @throws Mage_Core_Exception
*
* @param Mage_Sales_Model_Order_Payment_Transaction $transaction
* @return Mage_Sales_Model_Resource_Order_Payment_Transaction
*/
protected function _beforeSave(Mage_Core_Model_Abstract $transaction)
{
$parentTxnId = $transaction->getData('parent_txn_id');
$txnId = $transaction->getData('txn_id');
$orderId = $transaction->getData('order_id');
$paymentId = $transaction->getData('payment_id');
$idFieldName = $this->getIdFieldName();
if ($parentTxnId) {
if (!$txnId || !$orderId || !$paymentId) {
Mage::throwException(Mage::helper('sales')->__('Not enough valid data to save the parent transaction ID.'));
}
$parentId = (int) $this->_lookupByTxnId($orderId, $paymentId, $parentTxnId, $idFieldName);
if ($parentId) {
$transaction->setData('parent_id', $parentId);
}
}
// make sure unique key won't cause trouble
if ($transaction->isFailsafe()) {
$autoincrementId = (int) $this->_lookupByTxnId($orderId, $paymentId, $txnId, $idFieldName);
if ($autoincrementId) {
$transaction->setData($idFieldName, $autoincrementId)->isObjectNew(false);
}
}
return parent::_beforeSave($transaction);
}