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


PHP Mage_Sales_Model_Order::save方法代码示例

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


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

示例1: updateDatabase

 /**
  * Parent function to update the database with all information.
  */
 public function updateDatabase()
 {
     $orderId = isset($this->_receivedData['origin_order_id']) ? $this->_receivedData['origin_order_id'] : $this->_receivedData['order_id'];
     $this->_order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
     if ($this->_checkOrderInformation() && $this->_handleStateChange()) {
         $this->_order->save();
         return true;
     } else {
         return false;
     }
 }
开发者ID:KaiBerkemeyer,项目名称:Barzahlen-Magento-1,代码行数:14,代码来源:Ipn.php

示例2: cancelaPedido

 public function cancelaPedido(Mage_Sales_Model_Order $order)
 {
     $paymentMethod = $order->getPayment()->getMethodInstance()->getCode();
     $listPaymentMethodsIdeasa = Mage::helper('base')->listPaymentMethods();
     $this->logger->info('Processando cancelamento do pedido ' . $order->getRealOrderId() . ', do modulo: ' . $paymentMethod);
     try {
         if ($order->getState() != Mage_Sales_Model_Order::STATE_CANCELED) {
             $order->cancel();
             //força o cancelamento
             if ($order->getStatus() != Mage_Sales_Model_Order::STATE_CANCELED) {
                 $order->setState(Mage_Sales_Model_Order::STATE_CANCELED, true, Mage::helper('base')->__('Pedido cancelado'), $notified = false);
             } else {
                 $order->addStatusToHistory($order->getStatus(), Mage::helper('base')->__('Pedido cancelado.'));
             }
             if ($order->hasInvoices() != '') {
                 $order->setState(Mage_Sales_Model_Order::STATE_CANCELED, true, Mage::helper('base')->__('O pagamento e o pedido foram cancelados, mas não foi possível retornar os produtos ao estoque pois já havia uma fatura gerada para este pedido.'), $notified = false);
             }
             $order->save();
         }
         if (Mage::helper('base')->isIdeasaPaymentMethod($paymentMethod) && Mage::helper('base/module')->isPagSeguroDiretoExists() && $paymentMethod == $listPaymentMethodsIdeasa[0]) {
             Mage::getModel('pagsegurodireto/notification')->sendEmail($order);
         }
     } catch (Exception $e) {
         $this->logger->error("Erro ao cancelar pedido {$orderId} \n {$e->__toString}()");
     }
     $this->logger->info('Cancelamento do pedido foi concluido ' . $order->getRealOrderId() . ', do modulo: ' . $paymentMethod);
     return;
 }
开发者ID:adrianomelo5,项目名称:magento,代码行数:28,代码来源:ExpiraPedido.php

示例3: updateShippingInfo

 /**
  *
  * Update shipping info after notifyRequest
  * @param array $data
  */
 protected function updateShippingInfo($data)
 {
     try {
         $typeChosen = $data['Shipping']['ShippingType'];
         $cost = $data['Shipping']['ShippingCost']['Gross'];
         if (!empty($typeChosen)) {
             $quote = Mage::getModel('sales/quote')->load($this->_order->getQuoteId());
             $address = $quote->getShippingAddress();
             $shipping = Mage::getModel('shipping/shipping');
             $shippingRates = $shipping->collectRatesByAddress($address)->getResult();
             $shippingCostList = array();
             foreach ($shippingRates->getAllRates() as $rate) {
                 $type = $rate->getCarrierTitle() . ' - ' . $rate->getMethodTitle();
                 if ($type == $typeChosen) {
                     $this->_order->setShippingDescription($typeChosen);
                     $this->_order->setShippingMethod($rate->getCarrier() . "_" . $rate->getMethod());
                     $current = $this->_order->getShippingAmount();
                     $this->_order->setShippingAmount($cost / 100);
                     $this->_order->setGrandTotal($this->_order->getGrandTotal() + $this->_order->getShippingAmount() - $current);
                     $this->_order->save();
                 }
             }
         }
     } catch (Exception $e) {
         Mage::logException("shipping info error: " . $e);
     }
 }
开发者ID:par-orillonsoft,项目名称:plugin_magento,代码行数:32,代码来源:Payment.php

示例4: seamlessConfirmAction

 /**
  * Confirm Controller for Seamless Payments
  */
 public function seamlessConfirmAction()
 {
     try {
         $data = $this->_checkReturnedPost(true);
         $storeId = $this->order->getStoreId();
         $methodCode = $this->paymentInst->getCode();
         $secretKey = Mage::getStoreConfig('payment/' . $methodCode . '/secret_key', $storeId);
         $confirmResponse = WirecardCEE_Client_QPay_Return::generateConfirmResponseString();
         $return = WirecardCEE_Client_QPay_Return::createReturnInstance($data['raw'], $secretKey);
         if ($return->validate()) {
             $this->_confirmState($data['post'], $return);
         } else {
             throw new Exception('Unhandled Wirecard Checkout Seamless action "' . $data['paymentState'] . '".');
         }
         $this->order->save();
         // send confirmation for status change
         die($confirmResponse);
     } catch (Exception $e) {
         $orderId = !empty($data['orderId']) ? $data['orderId'] : '';
         Mage::log('Wirecard Checkout Page transaction status update failed: ' . $e->getMessage() . '(' . $orderId . ')');
         Mage::log($e->getMessage() . "\n" . $e->getTraceAsString(), null, 'wirecard_checkout_page_exception.log');
         $confirmResponse = WirecardCEE_Client_QPay_Return::generateConfirmResponseString($e->getMessage());
         die($confirmResponse);
     }
 }
开发者ID:netzkollektiv,项目名称:wirecard-checkout-magento,代码行数:28,代码来源:ProcessingController.php

示例5: successAction

 public function successAction()
 {
     $order = new Mage_Sales_Model_Order();
     $lastOrderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
     $order->loadByIncrementId($lastOrderId);
     $quoteId = $order->getQuoteId();
     $quote = Mage::getModel("sales/quote")->load($quoteId);
     try {
         $order->setTransactionIdBcash($quote->getTransactionIdBcash())->setStatusBcash($quote->getStatusBcash())->setDescriptionStatusBcash($quote->getDescriptionStatusBcash())->setPaymentLinkBcash($quote->getPaymentLinkBcash())->setPaymentMethodBcash($quote->getPaymentMethodBcash())->setInstallmentsBcash($quote->getInstallmentsBcash());
         $order->save();
         $order->sendNewOrderEmail();
     } catch (Exception $ex) {
     }
     $type = null;
     $payment_method_bcash = $order->getPaymentMethodBcash();
     if ($payment_method_bcash) {
         $helper = new Bcash_Pagamento_Helper_PaymentMethod();
         $type = $helper->getPaymentMethod($payment_method_bcash);
     }
     $this->loadLayout();
     $this->getLayout()->getBlock('root')->setTemplate('page/2columns-right.phtml');
     $block = $this->getLayout()->createBlock('Mage_Core_Block_Template', 'link_pagamento_bcash', array('template' => 'bcash/pagamento/checkout/success.phtml'));
     $block->setOrder($order);
     $block->setQuote($quote);
     $block->setType($type);
     $this->getLayout()->getBlock('content')->append($block);
     $this->_initLayoutMessages('checkout/session');
     Mage::dispatchEvent('checkout_onepage_controller_success_action', array('order_ids' => array($lastOrderId)));
     $this->renderLayout();
 }
开发者ID:payu-br,项目名称:bcash-magento-transparente,代码行数:30,代码来源:PaymentController.php

示例6: _registerPaymentVoid

 /**
  * Process voided authorization
  */
 protected function _registerPaymentVoid()
 {
     $this->_importPaymentInformation();
     $parentTxnId = $this->getRequestData('transaction_entity') == 'auth' ? $this->getRequestData('txn_id') : $this->getRequestData('parent_txn_id');
     $this->_order->getPayment()->setPreparedMessage($this->_createIpnComment(''))->setParentTransactionId($parentTxnId)->registerVoidNotification();
     $this->_order->save();
 }
开发者ID:quyip8818,项目名称:Mag,代码行数:10,代码来源:Ipn.php

示例7: hookToOrderSaveEvent

 public function hookToOrderSaveEvent()
 {
     $order = new Mage_Sales_Model_Order();
     $incrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
     $order->loadByIncrementId($incrementId);
     //Fetch the data from select box and throw it here
     $_heared4us_data = null;
     $_heared4us_data = Mage::getSingleton('core/session')->getInchooHeared4us();
     //Save fhc id to order obcject
     $order->setData(self::ORDER_ATTRIBUTE_FHC_ID, $_heared4us_data);
     $order->setData("affiliate_sale_type", $_heared4us_data);
     $order->save();
     $write = Mage::getSingleton('core/resource')->getConnection('core_write');
     $sql = "UPDATE sales_flat_order_grid SET affiliate_sale_type = {$_heared4us_data} WHERE entity_id = '{$order->getEntityId()}'";
     $write->query($sql);
     if ($_heared4us_data != 3) {
         $entity = $order->getEntityId();
         $customer_id = $order->getCustomerId();
         $expired = Mage::getModel('affiliate/affiliateexpired')->load($customer_id)->getData();
         $historic = '[{"order":"' . $entity . '"}]';
         $today = date("Y-m-d 23:59:59");
         $expired_date = new DateTime($today);
         $interval = new DateInterval('P1M');
         $expired_date->add($interval);
         $final = $expired_date->format('Y-m-d h:i:s');
         $write = Mage::getSingleton('core/resource')->getConnection('core_write');
         if ($expired) {
             $sql = "UPDATE mw_affiliate_expired SET historic='{$historic}',  expired_package = '{$final}' WHERE customer_id = '{$customer_id}'";
         } else {
             $sql = "INSERT INTO mw_affiliate_expired VALUES({$customer_id}, '{$final}', NULL, '{$historic}')";
         }
         $write->query($sql);
     }
 }
开发者ID:Gilbertoavitia1,项目名称:AHBS,代码行数:34,代码来源:Observer.php

示例8: save

 public function save()
 {
     if (!$this->getId()) {
         $this->_getMongo()->saveOrder($this);
     } else {
         return parent::save();
     }
 }
开发者ID:eniuz,项目名称:MongoDB-OrderTransactions,代码行数:8,代码来源:Order.php

示例9: setUp

 public function setUp()
 {
     parent::setUp();
     $order = new Mage_Sales_Model_Order();
     $order->load('100000001', 'increment_id');
     $order->getPayment()->setMethod(Mage_Paypal_Model_Config::METHOD_PAYFLOWLINK);
     $order->save();
     $session = Mage::getSingleton('Mage_Checkout_Model_Session');
     $session->setLastRealOrderId($order->getRealOrderId())->setLastQuoteId($order->getQuoteId());
 }
开发者ID:NatashaOlut,项目名称:Mage_Test,代码行数:10,代码来源:PayflowController.php

示例10: _processOrder

 /**
  * Operate with order using information from silent post
  *
  * @param Mage_Sales_Model_Order $order
  */
 protected function _processOrder(Mage_Sales_Model_Order $order)
 {
     $response = $this->getResponse();
     $payment = $order->getPayment();
     $payment->setTransactionId($response->getPnref())->setIsTransactionClosed(0);
     $canSendNewOrderEmail = true;
     if ($response->getResult() == self::RESPONSE_CODE_FRAUDSERVICE_FILTER || $response->getResult() == self::RESPONSE_CODE_DECLINED_BY_FILTER) {
         $canSendNewOrderEmail = false;
         $fraudMessage = $this->_getFraudMessage() ? $response->getFraudMessage() : $response->getRespmsg();
         $payment->setIsTransactionPending(true)->setIsFraudDetected(true)->setAdditionalInformation('paypal_fraud_filters', $fraudMessage);
     }
     if ($response->getAvsdata() && strstr(substr($response->getAvsdata(), 0, 2), 'N')) {
         $payment->setAdditionalInformation('paypal_avs_code', substr($response->getAvsdata(), 0, 2));
     }
     if ($response->getCvv2match() && $response->getCvv2match() != 'Y') {
         $payment->setAdditionalInformation('paypal_cvv2_match', $response->getCvv2match());
     }
     switch ($response->getType()) {
         case self::TRXTYPE_AUTH_ONLY:
             $payment->registerAuthorizationNotification($payment->getBaseAmountAuthorized());
             break;
         case self::TRXTYPE_SALE:
             $payment->registerCaptureNotification($payment->getBaseAmountAuthorized());
             break;
     }
     $order->save();
     $customerId = $order->getCustomerId();
     if ($response->getResult() == self::RESPONSE_CODE_APPROVED && $response->getMethod() == 'CC' && $customerId && $payment->hasAdditionalInformation('cc_save_future') && $payment->getAdditionalInformation('cc_save_future') == 'Y') {
         // Obtain CC type
         $ccType = 'OT';
         $responseCcType = $response->getCardtype();
         if (!is_null($responseCcType)) {
             $payflowResponseCcTypesMap = array(0 => 'VI', 1 => 'MC', 2 => 'DI', 3 => 'AE', 4 => 'OT', 5 => 'JCB');
             if (isset($payflowResponseCcTypesMap[$responseCcType])) {
                 $ccType = $payflowResponseCcTypesMap[$responseCcType];
             }
         }
         $ccExpMonth = $response->getExpdate() ? substr($response->getExpdate(), 0, 2) : '';
         if ($ccExpMonth[0] == '0') {
             $ccExpMonth = $ccExpMonth[1];
         }
         // Create new stored card
         $customerstoredModel = Mage::getModel('cls_paypal/customerstored');
         $customerstoredModel->setData(array('transaction_id' => $response->getPnref(), 'customer_id' => $customerId, 'cc_type' => $ccType, 'cc_last4' => $response->getAcct() ? substr($response->getAcct(), -4) : '', 'cc_exp_month' => $ccExpMonth, 'cc_exp_year' => $response->getExpdate() ? '20' . substr($response->getExpdate(), 2) : '', 'date' => Varien_Date::formatDate(true, true), 'payment_method' => $payment->getMethod()));
         $customerstoredModel->save();
     }
     try {
         if ($canSendNewOrderEmail) {
             $order->sendNewOrderEmail();
         }
         Mage::getModel('sales/quote')->load($order->getQuoteId())->setIsActive(false)->save();
     } catch (Exception $e) {
         Mage::throwException(Mage::helper('paypal')->__('Can not send new order email.'));
     }
 }
开发者ID:xiaoguizhidao,项目名称:bb,代码行数:60,代码来源:Payflowlink.php

示例11: testRedirectActionIsContentGenerated

 public function testRedirectActionIsContentGenerated()
 {
     $order = new Mage_Sales_Model_Order();
     $order->load('100000001', 'increment_id');
     $order->getPayment()->setMethod(Mage_Paypal_Model_Config::METHOD_WPS);
     $order->save();
     $session = Mage::getSingleton('Mage_Checkout_Model_Session');
     $session->setLastRealOrderId($order->getRealOrderId())->setLastQuoteId($order->getQuoteId());
     $this->dispatch('paypal/standard/redirect');
     $this->assertContains('<form action="https://www.paypal.com/webscr" id="paypal_standard_checkout"' . ' name="paypal_standard_checkout" method="POST">', $this->getResponse()->getBody());
 }
开发者ID:NatashaOlut,项目名称:Mage_Test,代码行数:11,代码来源:StandardController.php

示例12: directLinkTransact

 /**
  * Creates Transactions for directlink activities
  *
  * @param Mage_Sales_Model_Order $order
  * @param int $transactionID - persistent transaction id
  * @param int $subPayID - identifier for each transaction
  * @param array $arrInformation - add dynamic data
  * @param string $typename - name for the transaction exp.: refund
  * @param string $comment - order comment
  *
  * @return Netresearch_OPS_Helper_Directlink $this
  */
 public function directLinkTransact($order, $transactionID, $subPayID, $arrInformation = array(), $typename, $comment, $closed = 0)
 {
     $payment = $order->getPayment();
     $payment->setTransactionId($transactionID . "/" . $subPayID);
     $transaction = $payment->addTransaction($typename, null, false, $comment);
     $transaction->setParentTxnId($transactionID);
     $transaction->setIsClosed($closed);
     $transaction->setAdditionalInformation("arrInfo", serialize($arrInformation));
     $transaction->save();
     $order->save();
     return $this;
 }
开发者ID:roshu1980,项目名称:add-computers,代码行数:24,代码来源:Directlink.php

示例13: testCancelActionIsContentGenerated

 public function testCancelActionIsContentGenerated()
 {
     $order = new Mage_Sales_Model_Order();
     $order->load('100000001', 'increment_id');
     $order->getPayment()->setMethod(Mage_Paypal_Model_Config::METHOD_HOSTEDPRO);
     $order->save();
     $session = Mage::getSingleton('Mage_Checkout_Model_Session');
     $session->setLastRealOrderId($order->getRealOrderId())->setLastQuoteId($order->getQuoteId());
     $this->dispatch('paypal/hostedpro/cancel');
     $this->assertContains('window.top.checkout.gotoSection("payment");', $this->getResponse()->getBody());
     $this->assertContains('window.top.document.getElementById(\'checkout-review-submit\').show();', $this->getResponse()->getBody());
     $this->assertContains('window.top.document.getElementById(\'iframe-warning\').hide();', $this->getResponse()->getBody());
 }
开发者ID:NatashaOlut,项目名称:Mage_Test,代码行数:13,代码来源:HostedproController.php

示例14: save

 public function save()
 {
     $this->_order->setStoreId($this->_getStore()->getId());
     $this->_order->createFromQuoteAddress($this->_quote->getShippingAddress());
     $this->_order->validate();
     $this->_order->setInitialStatus();
     $this->_order->save();
     $this->_order->setCreatedAt($this->_getRandomDate());
     $this->_order->save();
     $this->_quote->setIsActive(false);
     $this->_quote->save();
     return $this;
 }
开发者ID:hirentricore,项目名称:devmagento,代码行数:13,代码来源:Random.php

示例15: _createCustomer

 /**
  * @param Mage_Sales_Model_Order $order
  * @return int
  */
 protected function _createCustomer(Mage_Sales_Model_Order $order)
 {
     /** @var $customer Mage_Customer_Model_Customer */
     $customer = Mage::getModel('customer/customer')->setWebsiteId($order->getStore()->getWebsiteId())->loadByEmail($order->getCustomerEmail());
     $customerGroupId = 1;
     // @todo load general customer group ID?
     if (!$customer->getId()) {
         $customer->addData(array('prefix' => $order->getCustomerPrefix(), 'firstname' => $order->getCustomerFirstname(), 'middlename' => $order->getCustomerMiddlename(), 'lastname' => $order->getCustomerLastname(), 'suffix' => $order->getCustomerSuffix(), 'email' => $order->getCustomerEmail(), 'group_id' => $customerGroupId, 'taxvat' => $order->getCustomerTaxvat(), 'website_id' => $order->getStore()->getWebsiteId(), 'default_billing' => '_item1', 'default_shipping' => '_item2'));
         // Billing Address
         /** @var $billingAddress Mage_Sales_Model_Order_Address */
         $billingAddress = $order->getBillingAddress();
         /** @var $customerBillingAddress Mage_Customer_Model_Address */
         $customerBillingAddress = Mage::getModel('customer/address');
         $billingAddressArray = $billingAddress->toArray();
         unset($billingAddressArray['entity_id']);
         unset($billingAddressArray['parent_id']);
         unset($billingAddressArray['customer_id']);
         unset($billingAddressArray['customer_address_id']);
         unset($billingAddressArray['quote_address_id']);
         $customerBillingAddress->addData($billingAddressArray);
         $customerBillingAddress->setPostIndex('_item1');
         $customer->addAddress($customerBillingAddress);
         // Shipping Address
         /** @var $shippingAddress Mage_Sales_Model_Order_Address */
         $shippingAddress = $order->getShippingAddress();
         /** @var $customerShippingAddress Mage_Customer_Model_Address */
         $customerShippingAddress = Mage::getModel('customer/address');
         $shippingAddressArray = $shippingAddress->toArray();
         unset($shippingAddressArray['entity_id']);
         unset($shippingAddressArray['parent_id']);
         unset($shippingAddressArray['customer_id']);
         unset($shippingAddressArray['customer_address_id']);
         unset($shippingAddressArray['quote_address_id']);
         $customerShippingAddress->addData($shippingAddressArray);
         $customerShippingAddress->setPostIndex('_item2');
         $customer->addAddress($customerShippingAddress);
         // Save the customer
         $customer->setPassword($customer->generatePassword());
         $customer->save();
     }
     // Link customer to order
     $order->setCustomerId($customer->getId());
     $order->setCustomerIsGuest(0);
     $order->setCustomerGroupId($customerGroupId);
     $order->save();
     return $customer->getId();
 }
开发者ID:hsq,项目名称:Ho_Customer,代码行数:51,代码来源:GuestOrders.php


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