本文整理汇总了PHP中Mage_Sales_Model_Order::getData方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order::getData方法的具体用法?PHP Mage_Sales_Model_Order::getData怎么用?PHP Mage_Sales_Model_Order::getData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order::getData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: _saveOrderHistory
protected function _saveOrderHistory(Mage_Sales_Model_Order $order, $change_type, $data = null)
{
$uid = $order->getData('payin7_order_identifier');
$order_sent = $order->getData('payin7_order_sent');
if (!$uid || !$order_sent) {
return false;
}
$m = Mage::getModel('payin7payments/payin7orderhistory');
$m->setData(array('order_id' => $order->getId(), 'order_unique_id' => $uid, 'created_on' => date('Y-m-d H:i:s'), 'change_type' => $change_type, 'data' => $data ? @serialize($data) : null));
$m->save();
return $this;
}
示例3: createReservationDocument
public function createReservationDocument($event)
{
$order = new Mage_Sales_Model_Order();
$incrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$order->loadByIncrementId($incrementId);
$orderData = $order->getData();
$customerID = sprintf("WEBC%010d", $order['customer_id']);
$orderDate = date('Y-m-d H:i:s');
$XML = "\n <TrumpasPardRezDok>\n <sKlientas>{$customerID}</sKlientas>\n <tData>{$orderDate}</tData>\n <sSerija></sSerija>\n <sDokumentas></sDokumentas>\n <sValiuta>{$orderData['order_currency_code']}</sValiuta>";
$VAT = 21;
foreach ($order->getAllItems() as $item) {
$children = $item->getChildrenItems();
if (!empty($children)) {
continue;
// bundle
}
$itemData = $item->getData();
$priceVat = round($itemData['price_incl_tax'], 4);
$priceNoVat = round($priceVat / ($VAT / 100 + 1), 4);
$priceVatValue = round($priceVat - $priceNoVat, 4);
$qty = intval($itemData['qty_ordered']);
$XML .= "\n <PardDokPrekeDetEil>\n <sKodas>{$itemData['sku']}</sKodas>\n <sPavadinimas>{$itemData['name']}</sPavadinimas>\n <sSandelis>CENTR.</sSandelis>\n <nKiekis>{$qty}</nKiekis>\n <dSumaL>{$priceNoVat}</dSumaL>\n <dSumaV>{$priceNoVat}</dSumaV>\n <dSumaPVMV>{$priceVatValue}</dSumaPVMV>\n <dSumaPVML>{$priceVatValue}</dSumaPVML>\n </PardDokPrekeDetEil>";
}
$shippingAmountVat = round($order->getShippingAmount(), 4);
$shippingAmountNoVat = round($shippingAmountVat / ($VAT / 100 + 1), 4);
$shippingVatValue = round($shippingAmountVat - $shippingAmountNoVat, 4);
$XML .= "\n <PardDokPaslaugaDetEil>\n <sKodas>TRANSPORTAV</sKodas>\n <nKiekis>100</nKiekis>\n <dSumaV>{$shippingAmountNoVat}</dSumaV>\n <dSumaL>{$shippingAmountNoVat}</dSumaL>\n <dSumaPVMV>{$shippingVatValue}</dSumaPVMV>\n <dSumaPVML>{$shippingVatValue}</dSumaPVML>\n \t </PardDokPaslaugaDetEil>\n ";
$XML .= "</TrumpasPardRezDok>";
/** @var $fvs Srautas_Finvalda_Webservice */
$fvs = Mage::getSingleton('finvalda/webservice');
$fvs->InsertNewOperation(array('ItemClassName' => 'TrumpasPardRezDok', 'sParametras' => 'PIRMAS', 'xmlString' => $XML));
return $this;
}
示例4: createCustomer
/**
* @param Mage_Sales_Model_Order $order
* @param Mage_Customer_Model_Customer $customer
*
* @return bool|int|null
*/
protected function createCustomer($order, $customer)
{
$billing = $order->getBillingAddress();
if (Mage::app()->getStore()->isAdmin()) {
$customer = Mage::getSingleton('adminhtml/session_quote')->getCustomer();
} else {
$customer->setWebsiteId(Mage::app()->getWebsite()->getId());
$customer->loadByEmail($billing->getEmail());
}
//TODO fix user being created again if validation fails
if (!($userCode = $customer->getVindiUserCode())) {
$userCode = 'mag-' . $customer->getId() . '-' . time();
$customer->setVindiUserCode($userCode);
$customer->save();
}
$address = ['street' => $billing->getStreet(1), 'number' => $billing->getStreet(2), 'additional_details' => $billing->getStreet(3), 'neighborhood' => $billing->getStreet(4), 'zipcode' => $billing->getPostcode(), 'city' => $billing->getCity(), 'state' => $billing->getRegionCode(), 'country' => $billing->getCountry()];
$customerVindi = ['name' => $billing->getFirstname() . ' ' . $billing->getLastname(), 'email' => $order->getBillingAddress()->getEmail(), 'registry_code' => $order->getData('customer_taxvat'), 'code' => $userCode, 'address' => $address];
if (Mage::getStoreConfig('vindi_subscription/general/send_nfe_information')) {
switch ($this->getCustomerTipoPessoa($customer)) {
case "Física":
$customerVindi['metadata'] = ['carteira_de_identidade' => $customer->getIe()];
break;
case "Jurídica":
$customerVindi['metadata'] = ['inscricao_estadual' => $customer->getIe()];
break;
}
}
$customerId = $this->api()->findOrCreateCustomer($customerVindi);
if ($customerId === false) {
Mage::throwException('Falha ao registrar o usuário. Verifique os dados e tente novamente!');
}
return $customerId;
}
示例5: loadByOrder
/**
* Load a ship note by order
*
* @param Mage_Sales_Model_Order $order
* @return bool|Dh_ShipNote_Model_Note
*/
public function loadByOrder(Mage_Sales_Model_Order $order)
{
$shipNoteId = $order->getData('ship_note_id');
if (null !== $shipNoteId) {
return Mage::getModel('shipnote/note')->load($shipNoteId);
}
return false;
}
示例6: checkIfPostalShippingMethod
/**
* checkIfPostalShippingMethod
*
* @param Mage_Sales_Model_Order $order
* @param string $pattern # regex pattern to apply against the order's shipping description
* @return string
*/
public function checkIfPostalShippingMethod(Mage_Sales_Model_Order $order, $pattern = self::USPS_SHIPPING_METHODS_PATTERN)
{
$matches = $this->_matchesCarrier($order->getData('shipping_description'), $pattern);
if (!empty($matches)) {
$shippingMethod = $matches[1];
} else {
$shippingMethod = '';
}
return $shippingMethod;
}
示例7: invoiceChanges
/**
* Create invoice for order changes
*
* @param Mage_Sales_Model_Order $origOrder
* @param Mage_Sales_Model_Order $newOrder
* @param $changes
* @return $this
*/
public function invoiceChanges(Mage_Sales_Model_Order $origOrder, Mage_Sales_Model_Order $newOrder, $changes)
{
$invoice = Mage::getModel('sales/service_order', $newOrder)->prepareInvoice();
foreach ($this->_availableTotals as $code) {
$diff = $newOrder->getData($code) - $origOrder->getData($code);
if (!$diff) {
continue;
}
$invoice->setData($code, $diff);
}
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
$invoice->register();
$transaction = Mage::getModel('core/resource_transaction')->addObject($invoice)->addObject($invoice->getOrder());
$transaction->save();
$this->updateInvoicedItems($newOrder);
return $this;
}
示例8: refundChanges
/**
* Create creditmemo for order changes
*
* @param Mage_Sales_Model_Order $origOrder
* @param Mage_Sales_Model_Order $newOrder
* @param $changes
* @return $this
*/
public function refundChanges(Mage_Sales_Model_Order $origOrder, Mage_Sales_Model_Order $newOrder, $changes)
{
$cmData = array();
$cmData['qtys'] = $this->getItemsToRefund();
$creditmemo = Mage::getModel('sales/service_order', $newOrder)->prepareCreditmemo($cmData);
foreach ($this->_availableTotals as $code) {
$diff = $origOrder->getData($code) - $newOrder->getData($code);
if (!$diff) {
continue;
}
$creditmemo->setData($code, $diff);
}
// Return refunded items to stock
foreach ($creditmemo->getAllItems() as $creditmemoItem) {
$creditmemoItem->setBackToStock(true);
}
$creditmemo->register();
$creditmemo->save();
$creditmemo->getOrder()->save();
return $this;
}
示例9: writeOrder
/**
* Writes the row(s) for the given order in the csv file.
* A row is added to the csv file for each ordered item.
*
* @param Mage_Sales_Model_Order $order The order to write csv of
* @param $fp The file handle of the csv file
*/
protected function writeOrder($order, $fp)
{
$customerDetails = $order->getBillingAddress();
$orderdate = substr_replace($order->getData('created_at'), '', -8);
$orderId = $order->getData('increment_id');
$customerFirstName = $customerDetails->getFirstname();
$customerLastName = $customerDetails->getLastname();
$fullName = $customerFirstName . $customerLastName;
$grandTotal = $order->getData('subtotal');
$taxAmount = $order->getData('tax_amount');
$paymentMethod = $this->getPaymentMethod($order);
$taxcode = $this->setTaxCode($customerDetails->getCountry(), $order);
$csvData = array('SI', date("Y/m/d"), '4000', '0', $orderdate, $orderId, $fullName, $grandTotal, $taxcode, $taxAmount, '1', $paymentMethod, 'import');
fputcsv($fp, $csvData, self::DELIMITER, self::ENCLOSURE);
}
示例10: getPayin7IsOrderSent
public function getPayin7IsOrderSent()
{
return $this->_order ? $this->_order->getData('payin7_order_sent') : null;
}
示例11: importOrder
/**
* Import order information to the subscription.
*
* @param Mage_Sales_Model_Order $order
* @return Customweb_Subscription_Model_Subscription
*/
public function importOrder(Mage_Sales_Model_Order $order)
{
$this->getSubscription()->setInitialOrderId($order->getId());
if ($order->getPayment() && $order->getPayment()->getMethod()) {
$this->getSubscription()->setMethodInstance($order->getPayment()->getMethodInstance());
if (!$this->getSubscription()->isMethodSuspendOnPendingPayment()) {
$this->getSubscription()->activate();
}
}
$orderInfo = $order->getData();
$this->_cleanupArray($orderInfo);
$this->getSubscription()->setOrderInfo($orderInfo);
$addressInfo = $order->getBillingAddress()->getData();
$this->_cleanupArray($addressInfo);
$this->getSubscription()->setBillingAddressInfo($addressInfo);
if (!$order->getIsVirtual()) {
$addressInfo = $order->getShippingAddress()->getData();
$this->_cleanupArray($addressInfo);
$this->getSubscription()->setShippingAddressInfo($addressInfo);
}
$this->getSubscription()->setCurrencyCode($order->getBaseCurrencyCode());
$this->getSubscription()->setCustomerId($order->getCustomerId());
if ($order->getCustomerId() != null) {
$customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
$this->getSubscription()->setSubscriberName($customer->getName());
} else {
$this->getSubscription()->setSubscriberName($order->getBillingAddress()->getName());
}
$this->getSubscription()->setStoreId($order->getStoreId());
$this->getSubscription()->setLastDatetime(Mage::helper('customweb_subscription')->toDateString(Zend_Date::now()));
if ($order->getPayment()) {
$this->getSubscription()->setPaymentId($order->getPayment()->getId());
}
if ($this->getSubscription()->getData('shipping_amount_type') == 'fixed') {
$this->getSubscription()->setShippingAmount($this->getSubscription()->getData('shipping_amount'));
} else {
$this->getSubscription()->setShippingAmount($order->getShippingAmount() + $order->getShippingTaxAmount());
}
$this->getSubscription()->setInitAmount($order->getSubscriptionInitAmount());
$this->getSubscription()->setLastOrderId($order->getId());
return $this->getSubscription();
}
示例12: _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
示例13: _getChargeCode
/**
* @param Mage_Sales_Model_Order $order
* @return string
*/
protected function _getChargeCode(Mage_Sales_Model_Order $order)
{
list($carrierCode, $chargeCode) = explode('_', $order->getData('shipping_method'));
/** @var Fontis_Australia_Helper_Eparcel $helper */
$helper = Mage::helper('australia/eparcel');
$chargeCode = strtoupper($chargeCode);
if ($helper->isValidChargeCode($chargeCode)) {
return $chargeCode;
}
/* Is this customer is in a ~business~ group ? */
$isBusinessCustomer = in_array($order->getData('customer_group_id'), explode(',', Mage::getStoreConfig('doghouse_eparcelexport/charge_codes/business_groups')));
return $isBusinessCustomer ? Mage::getStoreConfig('doghouse_eparcelexport/charge_codes/default_charge_code_business') : Mage::getStoreConfig('doghouse_eparcelexport/charge_codes/default_charge_code_individual');
}
示例14: getOrderItemValue
/**
* Retrieve order item value by key
*
* @param Mage_Sales_Model_Order $order
* @param string $key
* @return string
*/
public function getOrderItemValue(Mage_Sales_Model_Order $order, $key)
{
$escape = true;
switch ($key) {
case 'order_increment_id':
$value = $order->getIncrementId();
break;
case 'created_at':
$value = $this->helper('core')->formatDate($order->getCreatedAt(), 'short', true);
break;
case 'shipping_address':
$value = $order->getShippingAddress() ? $this->htmlEscape($order->getShippingAddress()->getName()) : $this->__('N/A');
break;
case 'order_total':
$value = $order->formatPrice($order->getGrandTotal());
$escape = false;
break;
case 'status_label':
$value = $order->getStatusLabel();
break;
case 'view_url':
$value = $this->getUrl('*/order/view', array('order_id' => $order->getId()));
break;
default:
$value = $order->getData($key) ? $order->getData($key) : $this->__('N/A');
}
return $escape ? $this->escapeHtml($value) : $value;
}
示例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);
}
}