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


PHP Mage_Sales_Model_Order::setData方法代码示例

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


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

示例1: 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

示例2: collect

 public function collect(Mage_Sales_Model_Order $order)
 {
     $order->setData('zitec_dpd_cashondelivery_surcharge', 0);
     $order->setData('base_zitec_dpd_cashondelivery_surcharge', 0);
     $amount = $order->getOrder()->getData('zitec_dpd_cashondelivery_surcharge');
     $order->setData('zitec_dpd_cashondelivery_surcharge', $amount);
     $amount = $order->getOrder()->getData('base_zitec_dpd_cashondelivery_surcharge');
     $order->setData('base_zitec_dpd_cashondelivery_surcharge', $amount);
     $order->setGrandTotal($order->getGrandTotal() + $order->getData('zitec_dpd_cashondelivery_surcharge'));
     $order->setBaseGrandTotal($order->getBaseGrandTotal() + $order->getData('base_zitec_dpd_cashondelivery_surcharge'));
     return $this;
 }
开发者ID:GabrielCC,项目名称:zitec-dpd-master,代码行数:12,代码来源:Cashondeliverysurchage.php

示例3: saveDeliveryForOrder

 public function saveDeliveryForOrder(Mage_Sales_Model_Order $order)
 {
     if ($deliveryData = Mage::app()->getRequest()->getPost('adj')) {
         if (is_array($deliveryData)) {
             // fix for delivery time
             if (Mage::getStoreConfig('checkout/adjdeliverydate/show_time') and !empty($deliveryData['delivery_date']) and !empty($deliveryData['delivery_time'])) {
                 $deliveryData['delivery_date'] .= ' ' . implode(':', $deliveryData['delivery_time']);
                 unset($deliveryData['delivery_time']);
             }
             $deliveryData['delivery_date'] = Mage::helper('adjdeliverydate')->convertDate($deliveryData['delivery_date']);
             foreach ($deliveryData as $name => $value) {
                 $order->setData($name, $value);
                 $order->setData($name . '_is_formated', true);
             }
             $order->save();
         }
     }
 }
开发者ID:kiutisuperking,项目名称:eatsmartboxdev,代码行数:18,代码来源:Quote.php

示例4: _enqueueOrder

 /**
  * @param Mage_Sales_Model_Order $order
  */
 protected function _enqueueOrder($order)
 {
     $order->setData('do_export_to_alvine', 1);
     $order->getResource()->saveAttribute($order, 'do_export_to_alvine');
     // Add Customer Source to Order if Exist
     if (array_key_exists('sxx_partner', $_COOKIE) && $_COOKIE['sxx_partner'] != "") {
         $partner = $_COOKIE['sxx_partner'];
         $order->setCustomerSource($partner);
         $order->getResource()->saveAttribute($order, "customer_source");
     }
 }
开发者ID:jronatay,项目名称:ultimo-magento-jron,代码行数:14,代码来源:Observer.php

示例5: submitOrder

 public function submitOrder($force = false)
 {
     if (!$this->_order) {
         return false;
     }
     /** @var Payin7_Payments_Helper_Data $phelper */
     $phelper = Mage::helper('payin7payments');
     $logger = $phelper->getLogger();
     $logger->logInfo('Will submit payment to Payin7, ID: ' . $this->_order->getId());
     $already_sent = $this->getPayin7IsOrderSent();
     // check if already submitted
     if ($already_sent && !$force) {
         $logger->logWarn('Payment already submitted - not doing anything');
         return $this->getPayin7OrderIdentifier();
     }
     $payment = $this->_order->getPayment();
     $payment_method = $payment->getMethod();
     $payment_method_remote_code = $phelper->getPaymentMethodRemoteCode($payment_method);
     if (!$payment_method_remote_code) {
         return false;
     }
     // begin submitting
     $data = array('order_id' => $this->_order->getId(), 'payment_method' => $payment_method_remote_code, 'device_type' => $this->_device_type, 'ordered_by_ip_address' => $this->_ordered_by_ip_address, 'source' => $this->_source, 'order' => json_encode($this->_prepareOrderData()), 'items' => json_encode($this->_prepareOrderItems()), 'addresses' => json_encode($this->_prepareOrderAddresses()), 'customer' => json_encode($this->_prepareCustomerData()), 'sysinfo' => json_encode($this->_sysinfo));
     $logger->logInfo(($already_sent ? 'RE-' : null) . 'Submitting order to Payin7: ' . print_r(array('order_id' => $this->_order->getId(), 'payment_method' => $payment_method_remote_code), true));
     /** @var Payin7_Payments_Model_Remote_Client $client */
     $client = Mage::getModel('payin7payments/remote_client');
     $response = $client->postOrder($data);
     if (!$response['payin7_order_id']) {
         return false;
     }
     // update the order
     $this->_order->setData('payin7_order_identifier', $response['payin7_order_id']);
     $this->_order->setData('payin7_order_sent', true);
     $this->_order->setData('payin7_order_accepted', (bool) $response['is_accepted']);
     $this->_order->setData('payin7_access_token', $response['access_token']);
     $logger->logInfo('Payment ' . ($already_sent ? 're' : null) . 'submitted to Payin7, ID: ' . $this->_order->getId() . ', data: ' . print_r($response, true));
     if (!$already_sent) {
         $message = Mage::helper('payin7payments')->__('Order submitted to Payin7');
         $payment->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_ORDER, null, false, $message);
     }
     return $this->getPayin7OrderIdentifier();
 }
开发者ID:payin7-payments,项目名称:payin7-magento,代码行数:42,代码来源:Submit.php

示例6: saveOrderPrescriptionExemption

 public function saveOrderPrescriptionExemption(Varien_Event_Observer $observer)
 {
     $exemption = Mage::getSingleton("core/session")->getPrescriptionExemptionCheck();
     if ($exemption > 0) {
         $exemptions = Mage::getResourceModel('prescriptioncheckout/prescription_collection');
         foreach ($exemptions as $ex) {
             if ($ex->getID() == $exemption) {
                 $exemptionText = '<b>' . $ex->getTitle() . '</b>: ' . $ex->getDescriptions();
             }
         }
         $orderIds = $observer->getData('order_ids');
         foreach ($orderIds as $orderId) {
             $order = new Mage_Sales_Model_Order();
             $order->load($orderId);
             $order->setData('prescription_exemption', $exemptionText);
             $order->save();
         }
         Mage::getSingleton('core/session')->getPrescriptionExemptionCheck('');
     }
 }
开发者ID:newedge-media,项目名称:iwantmymeds,代码行数:20,代码来源:Observer.php

示例7: _setOrderState

 /**
  * WTF DOES THIS NEED TO BE PRIVATE?? ASK THE XTENTO DEVELOPERS
  *
  * @param Mage_Sales_Model_Order    $order
  * @param string                    $newOrderStatus
  */
 protected function _setOrderState(Mage_Sales_Model_Order $order, $newOrderStatus)
 {
     if (Mage::getStoreConfig('gridactions/general/force_status_change')) {
         return;
     }
     if (Mage::helper('xtcore/utils')->mageVersionCompare(Mage::getVersion(), '1.5.0.0', '>=')) {
         if (!isset($this->_orderStates)) {
             $this->_orderStates = Mage::getModel('sales/order_config')->getStates();
         }
         foreach ($this->_orderStates as $state => $label) {
             foreach (Mage::getModel('sales/order_config')->getStateStatuses($state, false) as $status) {
                 if ($status == $newOrderStatus) {
                     $order->setData('state', $state);
                     return;
                 }
             }
         }
     }
 }
开发者ID:AleksNesh,项目名称:pandora,代码行数:25,代码来源:Processor.php

示例8: rollback

 public function rollback(Mage_Sales_Model_Order $order)
 {
     $order->setData($this->getDataKey(), $this->getFrom());
     return $this;
 }
开发者ID:rjocoleman,项目名称:magpleasure_assignorder,代码行数:5,代码来源:Detail.php

示例9: _useFixedCurrency

 /**
  * @param Mage_Sales_Model_Order $order
  * @return boolean
  */
 public function _useFixedCurrency($order)
 {
     try {
         $useFixedCurrency = Mage::getStoreConfig(self::CONFIG_PATH_CURRENCY_CHECKOUT_USE_FIXED_CURRENCY);
         if (!$useFixedCurrency) {
             return false;
         }
         $fixedCurrencyCode = Mage::getStoreConfig(self::CONFIG_PATH_CURRENCY_CHECKOUT_FIXED_CURRENCY);
         $baseCurrencyCode = Mage::app()->getStore()->getBaseCurrencyCode();
         $baseCurrency = Mage::getModel('directory/currency')->load($baseCurrencyCode);
         $fixedCurrency = Mage::getModel('directory/currency')->load($fixedCurrencyCode);
         $imagecc_preserved_information = array('order_fields' => array(), 'item_fields' => array());
         $_coreHelper = Mage::helper('core');
         Mage::helper('imagecc')->log("Using fixed currency " . $order->getIncrementId());
         foreach ($this->_orderFields as $field) {
             $field2 = preg_replace('(^base_)', '', $field);
             $new_v = $order->getData($field);
             $new_v = $baseCurrency->convert($new_v, $fixedCurrency);
             $new_v2 = $new_v;
             /**
              * preserve information before change it
              */
             if ($field != $field2) {
                 $imagecc_preserved_information['order_fields'][] = array('field' => $field, 'original_value' => $order->getData($field), 'new_value' => $new_v);
                 $imagecc_preserved_information['order_fields'][] = array('field' => $field2, 'original_value' => $order->getData($field2), 'new_value' => $new_v2);
             }
             $order->setData($field, $new_v);
             $order->setData($field2, $new_v2);
             Mage::helper('imagecc')->log("{$field2} {$field} {$new_v}");
         }
         foreach ($order->getAllItems() as $item) {
             $arr = $this->_itemFields;
             $quoteItemId = $item->getData('quote_item_id');
             $imagecc_preserved_information['item_fields'][$quoteItemId] = array();
             foreach ($arr as $k) {
                 //$v = $item->getData($k);
                 //$new_v = $_coreHelper->currency($v, false, false);
                 $field2 = preg_replace('(^base_)', '', $k);
                 $new_v = $item->getData($k);
                 $new_v = $baseCurrency->convert($new_v, $fixedCurrency);
                 $new_v2 = $item->getData($field2);
                 $new_v2 = $new_v;
                 /**
                  * preserve information before change it
                  */
                 if ($k != $field2) {
                     $imagecc_preserved_information['item_fields'][$quoteItemId][] = array('field' => $k, 'original_value' => $item->getData($k), 'new_value' => $new_v);
                     $imagecc_preserved_information['item_fields'][$quoteItemId][] = array('field' => $field2, 'original_value' => $item->getData($field2), 'new_value' => $new_v2);
                 }
                 $item->setData($k, $new_v);
                 $item->setData($field2, $new_v2);
                 Mage::helper('imagecc')->log("{$field2} {$k} {$new_v}");
             }
             //$item->save();
         }
         $store_currency = $fixedCurrencyCode;
         /**
          * preserve information before change it
          */
         $imagecc_preserved_information['order_fields']['order_currency_code'] = array('original_value' => $order->getData('order_currency_code'), 'field' => 'order_currency_code', 'new_value' => $store_currency);
         $imagecc_preserved_information['order_fields']['global_currency_code'] = array('original_value' => $order->getData('global_currency_code'), 'field' => 'global_currency_code', 'new_value' => $store_currency);
         $imagecc_preserved_information['order_fields']['base_currency_code'] = array('original_value' => $order->getData('base_currency_code'), 'field' => 'base_currency_code', 'new_value' => $store_currency);
         $imagecc_preserved_information['order_fields']['store_currency_code'] = array('original_value' => $order->getData('store_currency_code'), 'field' => 'store_currency_code', 'new_value' => $store_currency);
         $order->setData('order_currency_code', $store_currency)->setData('global_currency_code', $store_currency)->setData('base_currency_code', $store_currency)->setData('store_currency_code', $store_currency)->setData('imagecc_preserved_information', json_encode($imagecc_preserved_information));
         return true;
     } catch (Exception $e) {
         Mage::helper('imagecc')->log("error during fixed currency " . $e->getMessage());
     }
     return false;
 }
开发者ID:vinayshuklasourcefuse,项目名称:sareez,代码行数:74,代码来源:Intellimage_CurrencyCheckout_Model_Observer.php

示例10: updateOrder

 /**
  * @param Mage_Sales_Model_Order $order
  */
 protected function updateOrder(Mage_Sales_Model_Order $order)
 {
     if ($this->getPaymentMethod() instanceof Payone_Core_Model_Payment_Method_Creditcard) {
         $order->setData('payone_payment_method_type', $this->getPayment()->getData('cc_type'));
     } elseif ($this->getPaymentMethod() instanceof Payone_Core_Model_Payment_Method_OnlineBankTransfer) {
         $order->setData('payone_payment_method_type', $this->getPayment()->getData('payone_onlinebanktransfer_type'));
     } elseif ($this->getPaymentMethod() instanceof Payone_Core_Model_Payment_Method_Financing) {
         $order->setData('payone_payment_method_type', $this->getPayment()->getData('payone_financing_type'));
     } elseif ($this->getPaymentMethod() instanceof Payone_Core_Model_Payment_Method_SafeInvoice) {
         $order->setData('payone_payment_method_type', $this->getPayment()->getData('payone_safe_invoice_type'));
     }
 }
开发者ID:romfr,项目名称:payone-magento,代码行数:15,代码来源:Abstract.php

示例11: addInformationToObject

 /**
  * Given a model and id load the information from the database into this model
  *
  * @param Mage_Sales_Model_Order|Mage_Sales_Model_Quote $oObject
  * @param Sitewards_DeliveryDate_Model_Quote|Sitewards_DeliveryDate_Model_Order $oModel
  */
 protected function addInformationToObject($oObject, $oModel)
 {
     $aData = $oModel->getByObject($oObject->getId());
     foreach ($aData as $sKey => $sValue) {
         $oObject->setData($sKey, $sValue);
     }
 }
开发者ID:victso,项目名称:DeliveryDate,代码行数:13,代码来源:Observer.php

示例12: firstStep

 public function firstStep($payDataComercio, $payDataOperacion)
 {
     $order = new Mage_Sales_Model_Order();
     $order->loadByIncrementId($payDataOperacion['OPERATIONID']);
     try {
         require_once Mage::getBaseDir('lib') . '/metododepago2/TodoPago.php';
         $http_header = $this->get_http_header();
         $wsdl = $this->get_wsdls();
         $end_point = $this->get_end_point();
         $todopago_connector = new TodoPago($http_header, $wsdl, $end_point);
         Mage::log("Modulo de pago - TodoPago ==> payDataComercio --> " . json_encode($payDataComercio));
         Mage::log("Modulo de pago - TodoPago ==> payDataOperacion --> " . json_encode($payDataOperacion));
         $first_step = $todopago_connector->sendAuthorizeRequest($payDataComercio, $payDataOperacion);
         Mage::log("Modulo de pago - TodoPago ==> respuesta de sendAuthorizeRequest -->" . json_encode($first_step));
         $order->setData('todopagoclave', $first_step['RequestKey']);
         $order->save();
         $todopagotable = new Todopago_Modulodepago2_Model_Todopagotable();
         $todopagotable->setOrderId($payDataOperacion['OPERATIONID']);
         $todopagotable->setRequestKey($first_step['RequestKey']);
         $todopagotable->setSendauthorizeanswerStatus(Mage::getModel('core/date')->date('Y-m-d H:i:s') . " - " . $first_step["StatusCode"] . " - " . $first_step['StatusMessage']);
         $todopagotable->save();
         if ($first_step["StatusCode"] == -1) {
             if (Mage::getStoreConfig('payment/modulodepago2/modo_test_prod') == "test") {
                 $order->setStatus('test_todopago_processing');
                 $order->addStatusHistoryComment("Todo Pago (TEST): " . $first_step['StatusMessage']);
             } else {
                 $order->setStatus(Mage::getStoreConfig('payment/todopago_avanzada/order_status'));
                 $order->addStatusHistoryComment("Todo Pago: " . $first_step['StatusMessage']);
             }
             $order->save();
             Mage::log("Modulo de pago - TodoPago ==> redirige a: " . $first_step['URL_Request']);
             $this->_redirectUrl($first_step['URL_Request']);
         } else {
             if (Mage::getStoreConfig('payment/modulodepago2/modo_test_prod') == "test") {
                 $order->setStatus('test_todopago_canceled');
                 $order->addStatusHistoryComment("Todo Pago (TEST): " . $first_step['StatusMessage']);
             } else {
                 $order->setStatus(Mage::getStoreConfig('payment/todopago_avanzada/estado_denegada'));
                 $order->addStatusHistoryComment("Todo Pago: " . $first_step['StatusMessage']);
             }
             $order->save();
             Mage::log("Modulo de pago - TodoPago ==> redirige a: checkout/onepage/failure");
             Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/failure', array('_secure' => true));
         }
     } catch (Exception $e) {
         Mage::log("Modulo de pago - TodoPago ==> Exception: " . $e);
         if (Mage::getStoreConfig('payment/modulodepago2/modo_test_prod') == "test") {
             $order->setStatus('test_todopago_canceled');
             $order->addStatusHistoryComment("Todo Pago (TEST)(Exception): " . $e);
         } else {
             $order->setStatus(Mage::getStoreConfig('payment/todopago_avanzada/estado_denegada'));
             $order->addStatusHistoryComment("Todo Pago (Exception): " . $e);
         }
         $order->save();
         Mage::log("Modulo de pago - TodoPago ==> redirige a: checkout/onepage/failure");
         Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/failure', array('_secure' => true));
     }
 }
开发者ID:simondole,项目名称:Plugin-Magento,代码行数:58,代码来源:PaymentController.php

示例13: _saveOrder

 /**
  * Saves the Order, to complete the full life-cycle of the Order
  * Order status will now show as Complete
  *
  * @param $order Mage_Sales_Model_Order
  */
 protected function _saveOrder(\Mage_Sales_Model_Order $order)
 {
     $order->setData('state', \Mage_Sales_Model_Order::STATE_COMPLETE);
     $order->setData('status', \Mage_Sales_Model_Order::STATE_COMPLETE);
     $order->save();
     return $this;
 }
开发者ID:tboulogne,项目名称:magento-facebookstorefront,代码行数:13,代码来源:CreateInvoiceAndShipping.php

示例14: _saveOrder

 /** Saves the Order, to complete the full life-cycle of the Order
  * Order status will now show as Complete
  * @param $order Mage_Sales_Model_Order
  */
 protected function _saveOrder(Mage_Sales_Model_Order $order)
 {
     $totalQtyOrdered = (double) $order->getTotalQtyOrdered();
     $qtyShipped = '';
     foreach ($order->getAllItems() as $_eachItem) {
         $qtyShipped += (double) $_eachItem->getQtyShipped();
     }
     if ($qtyShipped < $totalQtyOrdered) {
         $order->setData('state', Mage_Sales_Model_Order::STATE_PROCESSING);
         $order->setData('status', Mage_Sales_Model_Order::STATE_PROCESSING);
     } else {
         $order->setData('state', Mage_Sales_Model_Order::STATE_COMPLETE);
         $order->setData('status', Mage_Sales_Model_Order::STATE_COMPLETE);
     }
     $order->save();
     return $this;
 }
开发者ID:DeveshKumarThakur,项目名称:cosmetics,代码行数:21,代码来源:Order.php

示例15: _anonymizeOrder

 /**
  * @param Mage_Sales_Model_Order $order
  * @param array $randomData
  */
 protected function _anonymizeOrder($order, $randomData)
 {
     /** @var $order Mage_Sales_Model_Order */
     foreach ($this->_getOrderMapping() as $orderKey => $randomDataKey) {
         if (!$order->getData($orderKey)) {
             continue;
         }
         if (strlen($randomDataKey)) {
             $order->setData($orderKey, $randomData[$randomDataKey]);
         } else {
             $order->setData($orderKey, '');
         }
     }
     $order->getResource()->save($order);
     $this->_anonymizedOrderIds[] = $order->getId();
     /* @var $quote Mage_Sales_Model_Quote */
     $quote = Mage::getModel('sales/quote')->load($order->getQuoteId());
     if ($quote->getId()) {
         $this->_anonymizeQuote($quote, $randomData);
     }
 }
开发者ID:buro71a,项目名称:Anonymizer,代码行数:25,代码来源:Anonymizer.php


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