本文整理汇总了PHP中Mage_Sales_Model_Order::getCreatedAt方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order::getCreatedAt方法的具体用法?PHP Mage_Sales_Model_Order::getCreatedAt怎么用?PHP Mage_Sales_Model_Order::getCreatedAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order::getCreatedAt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: _prepareOrderData
/**
* @return array
*/
protected function _prepareOrderData()
{
// magento 1.5 compat
$shipping_method_c = $this->_order->getShippingMethod(true);
$shipping_method = $this->_order->getData('shipping_method');
$shipping_method_code = $shipping_method_c ? $shipping_method_c->getData('carrier_code') : $shipping_method;
$data = array_filter(array('currency_code' => $this->_order->getOrderCurrencyCode(), 'shipping_method_code' => $shipping_method_code, 'shipping_method_title' => $this->_order->getShippingDescription(), 'created_on' => $this->_order->getCreatedAt(), 'updated_on' => $this->_order->getUpdatedAt(), 'state' => $this->_order->getState(), 'status' => $this->_order->getStatus(), 'is_gift' => $this->_order->getGiftMessageId() != null, 'ref_quote_id' => $this->_order->getQuoteId(), 'order_subtotal_with_tax' => $this->_order->getSubtotalInclTax(), 'order_subtotal' => $this->_order->getSubtotal(), 'order_tax' => $this->_order->getTaxAmount(), 'order_hidden_tax' => $this->_order->getHiddenTaxAmount(), 'order_shipping_with_tax' => $this->_order->getShippingInclTax(), 'order_shipping' => $this->_order->getShippingAmount(), 'order_discount' => $this->_order->getDiscountAmount(), 'order_shipping_discount' => $this->_order->getShippingDiscountAmount(), 'order_total' => $this->_order->getGrandTotal(), 'order_total_items' => $this->_order->getTotalItemCount()));
return $data;
}
示例3: _buildNewPayload
/**
* Fill in the values the order create request requires.
*
* @return self
*/
protected function _buildNewPayload()
{
$this->_payload->setBillingAddress($this->_getRomBillingAddress($this->_order->getBillingAddress()))->setCurrency($this->_order->getOrderCurrencyCode())->setLevelOfService($this->_config->levelOfService)->setLocale($this->_getLocale())->setOrderHistoryUrl($this->_helper->getOrderHistoryUrl($this->_order))->setOrderId($this->_order->getIncrementId())->setOrderTotal($this->_order->getBaseGrandTotal())->setOrderType($this->_config->orderType)->setRequestId($this->_coreHelper->generateRequestId('OCR-'));
$createdAt = $this->_getAsDateTime($this->_order->getCreatedAt());
if ($createdAt) {
$this->_payload->setCreateTime($createdAt);
}
return $this->_setCustomerData($this->_order, $this->_payload)->_setOrderContext($this->_order, $this->_payload)->_setShipGroups($this->_order, $this->_payload)->_setPaymentData($this->_order, $this->_payload);
}
示例4: registerCancel
/**
* Save cancellation date of order
*
* @param Mage_Sales_Model_Order $order
* @return Soon_StockReleaser_Model_Cancel
*/
public function registerCancel($order)
{
$paymentMethod = $order->getPayment()->getMethod();
$leadtimeValue = Mage::getStoreConfig('stockreleaser/leadtime/' . $paymentMethod);
if ($leadtimeValue != '') {
//Only continue if leadtime value is set.
$leadtime = $leadtimeValue * $this->_getLeadtimeMultiplier(Mage::getStoreConfig('stockreleaser/leadtime/' . $paymentMethod . '-unit'));
$autoCancelDate = date("Y-m-d H:i:s", strtotime($order->getCreatedAt()) + $leadtime);
$data = array('order_id' => $order->getId(), 'autocancel_date' => $autoCancelDate);
$this->setData($data);
$this->save();
}
return $this;
}
示例5: autoExportJobs
/** Send order to MailChimp Automatically by Order Status
*
*
*/
public function autoExportJobs()
{
$allow_sent = false;
$orders = Mage::getResourceModel('sales/order_collection');
$orders->getSelect()->joinLeft(array('ecommerce' => Mage::getSingleton('core/resource')->getTableName('monkey/ecommerce')), 'main_table.entity_id = ecommerce.order_id', 'main_table.*')->where('ecommerce.order_id is null');
//Get status options selected in the Configuration
$states = explode(',', Mage::helper('monkey')->config('order_status'));
foreach ($orders as $order) {
foreach ($states as $state) {
if ($order->getStatus() == $state || $state == 'all_status') {
$allow_sent = true;
}
}
if ($allow_sent == true) {
$this->_order = $order;
$api = Mage::getSingleton('monkey/api', array('store' => $this->_order->getStoreId()));
if (!$api) {
return false;
}
$subtotal = $this->_order->getSubtotal();
$discount = (double) $this->_order->getDiscountAmount();
if ($discount != 0) {
$subtotal = $subtotal + $discount;
}
$this->_info = array('id' => $this->_order->getIncrementId(), 'total' => $subtotal, 'shipping' => $this->_order->getShippingAmount(), 'tax' => $this->_order->getTaxAmount(), 'store_id' => $this->_order->getStoreId(), 'store_name' => $this->_order->getStoreName(), 'order_date' => $this->_order->getCreatedAt(), 'plugin_id' => 1215, 'items' => array());
$email = $this->_order->getCustomerEmail();
$campaign = $this->_order->getEbizmartsMagemonkeyCampaignId();
$this->setItemstoSend();
if ($email && $campaign) {
$this->_info['email_id'] = $email;
$this->_info['campaign_id'] = $campaign;
//Send order to MailChimp
$rs = $api->campaignEcommOrderAdd($this->_info);
} else {
$this->_info['email'] = $email;
$rs = $api->ecommOrderAdd($this->_info);
}
$allow_sent = false;
if (isset($rs['complete']) && $rs['complete'] == TRUE) {
$this->_logCall();
}
}
}
}
示例6: orderToFeed
/**
* Convert an order to a LinkShare refund row.
*
* @param Mage_Sales_Model_Order $order
* @return array
*/
public function orderToFeed(Mage_Sales_Model_Order $order)
{
$orderDate = new Zend_Date($order->getCreatedAt(), Varien_Date::DATETIME_INTERNAL_FORMAT);
$orderDate = $orderDate->toString('yyyy-MM-dd');
$transDate = Mage::getModel('core/date')->date('Y-m-d');
$rows = array();
foreach ($order->getAllVisibleItems() as $item) {
/* @var $item Mage_Sales_Model_OrderItem */
if ($item->getQtyCanceled() > 0) {
$rows[] = array('order_id' => $order->getIncrementId(), 'site_id' => '', 'order_date' => $orderDate, 'transaction_date' => $transDate, 'sku' => $item->getSku(), 'quantity' => round($item->getQtyCanceled()), 'amount' => ($item->getBaseRowTotal() - $item->getBaseDiscountAmount()) * -100, 'currency' => $order->getBaseCurrencyCode(), 'blank' => '', 'blank' => '', 'blank' => '', 'product_name' => '');
}
}
return $rows;
}
示例7: prepareValues
public function prepareValues(Mage_Sales_Model_Order $order)
{
$billing_address = $order->getBillingAddress();
$additional_data = unserialize($order->getPayment()->getAdditionalData());
$code_banco = $additional_data['code_banco'];
$data_vencimento = $additional_data['data_vencimento'];
$numero_boleto = str_replace('-', '', $order->getIncrementId());
$strtotime = strtotime($order->getCreatedAt());
$data = array('logoempresa' => $this->getConfig('logoempresa'), 'nosso_numero' => $numero_boleto, 'numero_documento' => $numero_boleto, 'data_vencimento' => $data_vencimento, 'data_documento' => date('d/m/Y', $strtotime), 'data_processamento' => date('d/m/Y', $strtotime), 'valor_boleto' => number_format($order->getGrandTotal() + $this->getLayoutConfig($code_banco, 'valor_adicional'), 2, ',', ''), 'valor_unitario' => number_format($order->getGrandTotal() + $this->getLayoutConfig($code_banco, 'valor_adicional'), 2, ',', ''), 'sacado' => $billing_address->getFirstname() . ' ' . $billing_address->getLastname(), 'sacadocpf' => $order->getCustomerTaxvat(), 'endereco1' => implode(' ', $billing_address->getStreet()), 'endereco2' => $billing_address->getCity() . ' - ' . $billing_address->getRegion() . ' - CEP: ' . $billing_address->getPostcode(), 'identificacao' => $this->getLayoutConfig($code_banco, 'identificacao'), 'cpf_cnpj' => $this->getLayoutConfig($code_banco, 'cpf_cnpj'), 'endereco' => $this->getLayoutConfig($code_banco, 'endereco'), 'cidade_uf' => $this->getLayoutConfig($code_banco, 'cidade_uf'), 'cedente' => $this->getLayoutConfig($code_banco, 'cedente'), 'agencia' => $this->getLayoutConfig($code_banco, 'agencia'), 'agencia_dv' => $this->getLayoutConfig($code_banco, 'agencia_dv'), 'conta' => $this->getLayoutConfig($code_banco, 'conta'), 'conta_dv' => $this->getLayoutConfig($code_banco, 'conta_dv'), 'carteira' => $this->getLayoutConfig($code_banco, 'carteira'), 'especie' => $this->getLayoutConfig($code_banco, 'especie'), 'especie_doc' => $this->getLayoutConfig($code_banco, 'especie_doc'), 'aceite' => $this->getLayoutConfig($code_banco, 'aceite'), 'quantidade' => $this->getLayoutConfig($code_banco, 'quantidade'));
if ($code_banco == 'santander_banespa') {
$data['ponto_venda'] = $this->getLayoutConfig($code_banco, 'ponto_venda');
$data['carteira_descricao'] = $this->getLayoutConfig($code_banco, 'carteira_descricao');
$data['codigo_cliente'] = $this->getLayoutConfig($code_banco, 'codigo_cliente');
}
if ($code_banco == 'bradesco') {
$data['conta_cedente'] = $this->getLayoutConfig($code_banco, 'conta_cedente');
$data['conta_cedente_dv'] = $this->getLayoutConfig($code_banco, 'conta_cedente_dv');
}
if ($code_banco == 'cef' || $code_banco == 'cef_sinco' || $code_banco == 'cef_sigcb') {
$data['conta_cedente_caixa'] = $this->getLayoutConfig($code_banco, 'conta_cedente_caixa');
$data['conta_cedente_dv_caixa'] = $this->getLayoutConfig($code_banco, 'conta_cedente_dv_caixa');
$data['inicio_nosso_numero'] = $this->getLayoutConfig($code_banco, 'inicio_nosso_numero');
}
if ($code_banco == 'bb') {
$data['convenio'] = $this->getLayoutConfig($code_banco, 'convenio');
$data['contrato'] = $this->getLayoutConfig($code_banco, 'contrato');
$data['variacao_carteira'] = $this->getLayoutConfig($code_banco, 'variacao_carteira');
$data['formatacao_convenio'] = $this->getLayoutConfig($code_banco, 'formatacao_convenio');
$data['formatacao_nosso_numero'] = $this->getLayoutConfig($code_banco, 'formatacao_nosso_numero');
}
if ($code_banco == 'hsbc') {
$data['codigo_cedente'] = $this->getLayoutConfig($code_banco, 'codigo_cedente');
}
if ($code_banco == 'cef_sinco') {
$data['campo_fixo_obrigatorio'] = $this->getLayoutConfig($code_banco, 'campo_fixo_obrigatorio');
}
if ($code_banco == 'cef_sigcb') {
$data['nosso_numero1'] = $this->getLayoutConfig($code_banco, 'nosso_numero1');
$data['nosso_numero_const1'] = $this->getLayoutConfig($code_banco, 'nosso_numero_const1');
$data['nosso_numero2'] = $this->getLayoutConfig($code_banco, 'nosso_numero2');
$data['nosso_numero_const2'] = $this->getLayoutConfig($code_banco, 'nosso_numero_const2');
$data['nosso_numero3'] = $numero_boleto;
}
if ($code_banco == 'sicoob') {
$data['convenio'] = $this->getLayoutConfig($code_banco, 'codigo_cedente');
$data["numero_parcela"] = '001';
}
$instrucoes = explode("\n", $this->getLayoutConfig($code_banco, 'instrucoes_boleto'));
for ($i = 0; $i < 4; $i++) {
$instrucao = isset($instrucoes[$i]) ? $instrucoes[$i] : '';
$data['instrucoes' . ($i + 1)] = $instrucao;
}
$info = sprintf($this->getLayoutConfig($code_banco, 'informacoes'), $order->getIncrementId());
$informacoes = explode("\n", $info);
for ($i = 0; $i < 3; $i++) {
$informacao = isset($informacoes[$i]) ? $informacoes[$i] : '';
$data['demonstrativo' . ($i + 1)] = $informacao;
}
return $data;
}
示例8: createFromOrder
/**
* @param Mage_Sales_Model_Order $order
*
* @return array
*/
public static function createFromOrder(Mage_Sales_Model_Order $order)
{
$serialized = array('id' => $order->getIncrementId(), 'amount' => Aplazame_Sdk_Serializer_Decimal::fromFloat($order->getGrandTotal()), 'due' => Aplazame_Sdk_Serializer_Decimal::fromFloat($order->getTotalDue()), 'status' => $order->getStatus(), 'type' => $order->getPayment()->getMethodInstance()->getCode(), 'order_date' => date(DATE_ISO8601, strtotime($order->getCreatedAt())), 'currency' => $order->getOrderCurrencyCode(), 'billing' => Aplazame_Aplazame_BusinessModel_Address::createFromAddress($order->getBillingAddress()), 'shipping' => Aplazame_Aplazame_BusinessModel_ShippingInfo::createFromOrder($order));
return $serialized;
}
示例9: loadData
/**
* Loads the order info from a Magento order model.
*
* @param Mage_Sales_Model_Order $order the order model.
*/
public function loadData(Mage_Sales_Model_Order $order)
{
$this->_orderNumber = $order->getId();
$this->_externalOrderRef = $order->getRealOrderId();
$this->_createdDate = $order->getCreatedAt();
$this->_paymentProvider = $order->getPayment()->getMethod();
$this->_orderStatus = Mage::getModel('nosto_tagging/meta_order_status', array('code' => $order->getStatus(), 'label' => $order->getStatusLabel()));
foreach ($order->getAllStatusHistory() as $item) {
/** @var Mage_Sales_Model_Order_Status_History $item */
$this->_orderStatuses[] = Mage::getModel('nosto_tagging/meta_order_status', array('code' => $item->getStatus(), 'label' => $item->getStatusLabel(), 'createdAt' => $item->getCreatedAt()));
}
$this->_buyer = Mage::getModel('nosto_tagging/meta_order_buyer', array('firstName' => $order->getCustomerFirstname(), 'lastName' => $order->getCustomerLastname(), 'email' => $order->getCustomerEmail()));
foreach ($order->getAllVisibleItems() as $item) {
/** @var $item Mage_Sales_Model_Order_Item */
$this->_items[] = $this->buildItem($item, $order);
}
if ($this->includeSpecialItems) {
if (($discount = $order->getDiscountAmount()) > 0) {
/** @var Nosto_Tagging_Model_Meta_Order_Item $orderItem */
$this->_items[] = Mage::getModel('nosto_tagging/meta_order_item', array('productId' => -1, 'quantity' => 1, 'name' => 'Discount', 'unitPrice' => $discount, 'currencyCode' => $order->getOrderCurrencyCode()));
}
if (($shippingInclTax = $order->getShippingInclTax()) > 0) {
/** @var Nosto_Tagging_Model_Meta_Order_Item $orderItem */
$this->_items[] = Mage::getModel('nosto_tagging/meta_order_item', array('productId' => -1, 'quantity' => 1, 'name' => 'Shipping and handling', 'unitPrice' => $shippingInclTax, 'currencyCode' => $order->getOrderCurrencyCode()));
}
}
}
示例10: __construct
/**
* set the order information
* @param Mage_Sales_Model_Order $orderData
*/
public function __construct(Mage_Sales_Model_Order $orderData)
{
$customerModel = Mage::getModel('customer/customer');
$customerModel->load($orderData->getCustomerId());
$this->id = $orderData->getIncrementId();
$this->quote_id = $orderData->getQuoteId();
$this->email = $orderData->getCustomerEmail();
$this->store_name = $orderData->getStoreName();
$created_at = new Zend_Date($orderData->getCreatedAt(), Zend_Date::ISO_8601);
$this->purchase_date = $created_at->toString(Zend_Date::ISO_8601);
$this->delivery_method = $orderData->getShippingDescription();
$this->delivery_total = $orderData->getShippingAmount();
$this->currency = $orderData->getStoreCurrencyCode();
if ($payment = $orderData->getPayment()) {
$this->payment = $payment->getMethodInstance()->getTitle();
}
$this->couponCode = $orderData->getCouponCode();
/**
* custom order attributes
*/
$helper = Mage::helper('ddg');
$website = Mage::app()->getStore($orderData->getStore())->getWebsite();
$customAttributes = $helper->getConfigSelectedCustomOrderAttributes($website);
if ($customAttributes) {
$fields = Mage::getResourceModel('ddg_automation/order')->getOrderTableDescription();
foreach ($customAttributes as $customAttribute) {
if (isset($fields[$customAttribute])) {
$field = $fields[$customAttribute];
$value = $this->_getCustomAttributeValue($field, $orderData);
if ($value) {
$this->_assignCustom($field, $value);
}
}
}
}
/**
* Billing address.
*/
if ($orderData->getBillingAddress()) {
$billingData = $orderData->getBillingAddress()->getData();
$this->billing_address = array('billing_address_1' => $this->_getStreet($billingData['street'], 1), 'billing_address_2' => $this->_getStreet($billingData['street'], 2), 'billing_city' => $billingData['city'], 'billing_region' => $billingData['region'], 'billing_country' => $billingData['country_id'], 'billing_postcode' => $billingData['postcode']);
}
/**
* Shipping address.
*/
if ($orderData->getShippingAddress()) {
$shippingData = $orderData->getShippingAddress()->getData();
$this->delivery_address = array('delivery_address_1' => $this->_getStreet($shippingData['street'], 1), 'delivery_address_2' => $this->_getStreet($shippingData['street'], 2), 'delivery_city' => $shippingData['city'], 'delivery_region' => $shippingData['region'], 'delivery_country' => $shippingData['country_id'], 'delivery_postcode' => $shippingData['postcode']);
}
$syncCustomOption = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_SYNC_ORDER_PRODUCT_CUSTOM_OPTIONS, $website);
/**
* Order items.
* @var Mage_Sales_Model_Order_Item $productItem
*/
foreach ($orderData->getAllItems() as $productItem) {
//product custom options
$customOptions = array();
if ($syncCustomOption) {
$customOptions = $this->_getOrderItemOptions($productItem);
}
$product = $productItem->getProduct();
if ($product) {
// category names
$categoryCollection = $product->getCategoryCollection()->addAttributeToSelect('name');
$productCat = array();
foreach ($categoryCollection as $cat) {
$categories = array();
$categories[] = $cat->getName();
$productCat[]['Name'] = substr(implode(', ', $categories), 0, 244);
}
$attributes = array();
//selected attributes from config
$configAttributes = Mage::helper('ddg')->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_SYNC_ORDER_PRODUCT_ATTRIBUTES, $orderData->getStore()->getWebsite());
if ($configAttributes) {
$configAttributes = explode(',', $configAttributes);
//attributes from attribute set
$attributesFromAttributeSet = $this->_getAttributesArray($product->getAttributeSetId());
foreach ($configAttributes as $attribute_code) {
//if config attribute is in attribute set
if (in_array($attribute_code, $attributesFromAttributeSet)) {
//attribute input type
$inputType = $product->getResource()->getAttribute($attribute_code)->getFrontend()->getInputType();
//fetch attribute value from product depending on input type
switch ($inputType) {
case 'multiselect':
case 'select':
case 'dropdown':
$value = $product->getAttributeText($attribute_code);
break;
default:
$value = $product->getData($attribute_code);
break;
}
if ($value) {
// check limit on text and assign value to array
$attributes[][$attribute_code] = $this->_limitLength($value);
//.........这里部分代码省略.........
示例11: build
/**
* @param PagSeguroTransaction $payment
* @param Mage_Sales_Model_Order $order
* @return multitype:string date Ambigous <number, mixed> NULL
*/
public function build($payment, $order)
{
$config = $order->getEntityId() . '/' . $payment->getRecoveryCode();
// Checkbox of selection for send e-mail
$checkbox = "<label class='chk_email'>";
$checkbox .= "<input type='checkbox' name='send_emails[]' class='checkbox' data-config='" . $config . "' />";
$checkbox .= "</label>";
//$dateOrder = Mage::app()->getLocale()->date($order->getCreatedAt(), null, null, true);
// Receives the full html link to edit an order
$editOrder = "<a class='edit' target='_blank' href='" . $this->getEditOrderUrl($order->getEntityId()) . "'>";
$editOrder .= $this->__('Ver detalhes') . "</a>";
$sent = $this->getSentEmailsById($order->getEntityId());
$sent = current($sent);
if (empty($sent)) {
$sent = 0;
}
return array('checkbox' => $checkbox, 'date' => $this->getOrderMagetoDateConvert($order->getCreatedAt()), 'id_magento' => "#" . $order->getIncrementId(), 'validity_link' => $this->convertAbandonedDayIntervalToDate($order->getCreatedAt()), 'email' => $sent, 'visualize' => $editOrder);
}
示例12: build
/**
* @param PagSeguroSummaryItem $PagSeguroSummaryItem
* @param Mage_Sales_Model_Order $order
* @return multitype:date string NULL Ambigous <boolean, string, string, multitype:>
*/
public function build($payment, $order)
{
$config = $order->getId() . '/' . $payment->getCode() . '/' . $this->getPaymentStatusFromKey($payment->getStatus()->getValue(), true);
$checkbox = "<label class='chk_email'>";
$checkbox .= "<input type='checkbox' name='conciliation_orders[]' class='checkbox' data-config='" . $config . "' />";
$checkbox .= "</label>";
// Receives the full html link to edit an order
$editOrder = "<a class='edit' target='_blank' href='" . $this->getEditOrderUrl($order->getEntityId()) . "'>";
$editOrder .= $this->__('Ver detalhes') . "</a>";
return array('checkbox' => $checkbox, 'date' => $this->getOrderMagetoDateConvert($order->getCreatedAt()), 'id_magento' => "#" . $order->getIncrementId(), 'id_pagseguro' => $payment->getCode(), 'status_magento' => $this->getPaymentStatusToString($this->getPaymentStatusFromValue($order->getStatus())), 'status_pagseguro' => $this->getPaymentStatusToString($payment->getStatus()->getValue()), 'edit' => $editOrder);
}
示例13: getCommonOrderValues
/**
* Returns the values which are identical for each row of the given order. These are
* all the values which are not item specific: order data, shipping address, billing
* address and order totals.
*
* @param Mage_Sales_Model_Order $order The order to get values from
* @return Array The array containing the non item specific values
*/
protected function getCommonOrderValues($order)
{
$shippingAddress = !$order->getIsVirtual() ? $order->getShippingAddress() : null;
$billingAddress = $order->getBillingAddress();
return array($order->getRealOrderId(), Mage::helper('core')->formatDate($order->getCreatedAt(), 'medium', true), $order->getStatus(), $this->getStoreName($order), $this->getPaymentMethod($order), $this->getShippingMethod($order), $this->formatPrice($order->getData('subtotal'), $order), $this->formatPrice($order->getData('tax_amount'), $order), $this->formatPrice($order->getData('shipping_amount'), $order), $this->formatPrice($order->getData('discount_amount'), $order), $this->formatPrice($order->getData('grand_total'), $order), $this->formatPrice($order->getData('base_grand_total'), $order), $this->formatPrice($order->getData('total_paid'), $order), $this->formatPrice($order->getData('total_refunded'), $order), $this->formatPrice($order->getData('total_due'), $order), $this->getTotalQtyItemsOrdered($order), $order->getCustomerName(), $order->getCustomerEmail(), $shippingAddress ? $shippingAddress->getName() : '', $shippingAddress ? $shippingAddress->getData("company") : '', $shippingAddress ? $shippingAddress->getData("street") : '', $shippingAddress ? $shippingAddress->getData("postcode") : '', $shippingAddress ? $shippingAddress->getData("city") : '', $shippingAddress ? $shippingAddress->getRegionCode() : '', $shippingAddress ? $shippingAddress->getRegion() : '', $shippingAddress ? $shippingAddress->getCountry() : '', $shippingAddress ? $shippingAddress->getCountryModel()->getName() : '', $shippingAddress ? $shippingAddress->getData("telephone") : '', $billingAddress->getName(), $billingAddress->getData("company"), $billingAddress->getData("street"), $billingAddress->getData("postcode"), $billingAddress->getData("city"), $billingAddress->getRegionCode(), $billingAddress->getRegion(), $billingAddress->getCountry(), $billingAddress->getCountryModel()->getName(), $billingAddress->getData("telephone"));
}
示例14: getOrderData
/**
* Return the order data in an array for easy processing
*
* @param Mage_Sales_Model_Order $order
* @return array
*/
protected function getOrderData($order)
{
$data = array();
$shippingAddress = !$order->getIsVirtual() ? $order->getShippingAddress() : null;
$billingAddress = $order->getBillingAddress();
$data['OrderNumber'] = $order->getRealOrderId();
//$data['OrderCreated'] = Mage::helper('core')->formatDate($order->getCreatedAt(), 'medium', true);
//$data['OrderUpdated'] = Mage::helper('core')->formatDate($order->getUpdatedAt(), 'medium', true);
//$data['OrderCreated'] = $order->getCreatedAt();
//$data['OrderUpdated'] = $order->getUpdatedAt();
$dateCreated = Mage::app()->getLocale()->date(strtotime($order->getCreatedAt()), null, null);
$dateCreated = $dateCreated->toString('yyyy-MM-dd HH:mm:ss');
$dateUpdated = Mage::app()->getLocale()->date(strtotime($order->getUpdatedAt()), null, null);
$dateUpdated = $dateUpdated->toString('yyyy-MM-dd HH:mm:ss');
$data['OrderCreated'] = $dateCreated;
$data['OrderUpdated'] = $dateUpdated;
$data['Status'] = $order->getStatus();
$data['PurchasedFrom'] = $this->getStoreName($order);
if (strtolower($this->getPaymentMethod($order)) == 'paytm_cc') {
$data['PaymentMethod'] = 'Paytm-wallet';
} else {
if (strtolower($this->getPaymentMethod($order)) == 'payumoney_shared') {
$data['PaymentMethod'] = 'Payumoney-wallet';
} else {
$data['PaymentMethod'] = $this->getPaymentMethod($order) == "free" ? 'prepaid' : $this->getPaymentMethod($order);
}
}
$data['ShippingMethod'] = $this->getShippingMethod($order);
//Shipping Provider
$data['ShippingProvider'] = $order->getData('blinkecarrier_id');
//$data['ExpectedDeliveryDate'] = $order->getData('shipping_arrival_date');
$expectedDelivery = $order->getData('shipping_arrival_date');
if (is_null($expectedDelivery)) {
$dateDelivery = "";
} else {
$dateDelivery = Mage::app()->getLocale()->date(strtotime($order->getData('shipping_arrival_date')), null, null);
$dateDelivery = $dateDelivery->toString('yyyy-MM-dd 00:00:00');
}
$data['ExpectedDeliveryDate'] = $dateDelivery;
$timeSlot = $order->getData('shipping_time_slot');
if (is_null($timeSlot)) {
$timeSlot = "";
}
$data['ExpectedTimeSlot'] = $timeSlot;
$data['Currency'] = $order->getOrderCurrencyCode();
$data['ExchangeRate'] = $order->getBaseToOrderRate();
$data['Subtotal'] = $order->getData('subtotal');
$data['Tax'] = $order->getData('tax_amount');
//VAT is for Delhi and CST for other states
if ($shippingAddress->getRegionCode() == 'IN-DL') {
$data['TaxCategory'] = 'VAT';
} else {
$data['TaxCategory'] = 'CST';
}
$data['ShippingAmount'] = $order->getData('shipping_amount');
$data['Discount'] = $order->getData('discount_amount');
$data['ShippingDiscountAmount'] = $order->getData('shipping_discount_amount');
$data['RewardsDiscountAmount'] = $order->getData('rewards_discount_amount');
$data['GrandTotal'] = $order->getData('grand_total');
$data['TotalPaid'] = $order->getData('total_paid');
$data['TotalRefunded'] = $order->getData('total_refunded');
$data['TotalDue'] = $order->getData('total_due');
$data['TotalInvoiced'] = $this->getTotalQtyItemsOrdered($order);
$data['TotalQtyItemsOrdered'] = $this->getTotalQtyItemsOrdered($order);
$data['Weight'] = $order->getWeight();
$data['CustomerName'] = $order->getCustomerName();
$data['CustomerFirstName'] = $order->getCustomerFirstname();
$data['CustomerLastName'] = $order->getCustomerLastname();
$data['CustomerMiddleName'] = $order->getCustomerMiddlename();
$data['CustomerEmail'] = $order->getCustomerEmail();
//Billing Address
$data['BillToTitle'] = $billingAddress->getPrefix();
$data['BillToName'] = $billingAddress->getName();
$data['BillToFirstName'] = $billingAddress->getFirstname();
$data['BillToLastName'] = $billingAddress->getLastname();
$data['BillToMiddleName'] = $billingAddress->getMiddlename();
$data['BillToAddressStreet'] = $billingAddress->getData("street");
$data['BillToCity'] = $billingAddress->getData("city");
$data['BillToRegionCode'] = $billingAddress->getRegionCode();
$data['BillToRegion'] = $billingAddress->getRegion();
$data['BillToCountry'] = $billingAddress->getCountry();
$data['BillToCountryName'] = $billingAddress->getCountryModel()->getName();
$data['BillToPostalCode'] = $billingAddress->getData("postcode");
$billPhoneNumber = $billingAddress->getData("telephone");
$data['BillToCustomerPhoneNum'] = $billPhoneNumber;
$data['BillToEmail'] = $billingAddress->getData("email");
//Shipping Address
$data['ShipToTitle'] = $shippingAddress ? $shippingAddress->getPrefix() : '';
$data['ShipToName'] = $shippingAddress ? $shippingAddress->getName() : '';
$data['ShipToFirstName'] = $shippingAddress ? $shippingAddress->getFirstname() : '';
$data['ShipToLastName'] = $shippingAddress ? $shippingAddress->getLastname() : '';
$data['ShipToMiddleName'] = $shippingAddress ? $shippingAddress->getMiddlename() : '';
$data['ShipToAddressStreet'] = $shippingAddress ? $shippingAddress->getData("street") : '';
$data['ShipToCity'] = $shippingAddress ? $shippingAddress->getData("city") : '';
//.........这里部分代码省略.........
示例15: setOrderData
/**
* set the order information
*
* @param Mage_Sales_Model_Order $orderData
*/
public function setOrderData(Mage_Sales_Model_Order $orderData)
{
$this->id = (string) $orderData->getIncrementId();
$this->quote_id = (string) $orderData->getQuoteId();
$this->email = (string) $orderData->getCustomerEmail();
$this->store_name = (string) $orderData->getStoreName();
$created_at = new Zend_Date($orderData->getCreatedAt(), Zend_Date::ISO_8601);
$this->purchase_date = $created_at->toString(Zend_Date::ISO_8601);
$this->delivery_method = $orderData->getShippingDescription();
$this->delivery_total = (double) number_format($orderData->getShippingAmount(), 2, '.', '');
$this->currency = $orderData->getStoreCurrencyCode();
if ($payment = $orderData->getPayment()) {
$this->payment = $payment->getMethodInstance()->getTitle();
}
$this->couponCode = (string) $orderData->getCouponCode();
//set order custom attributes
$this->_setOrderCustomAttributes($orderData);
//billing
$this->_setBillingData($orderData);
//shipping
$this->_setShippingData($orderData);
//order items
$this->_setOrderItems($orderData);
//sales data
$this->order_subtotal = (double) number_format($orderData->getData('subtotal'), 2, '.', '');
$this->discount_ammount = (double) number_format($orderData->getData('discount_amount'), 2, '.', '');
$orderTotal = abs($orderData->getData('grand_total') - $orderData->getTotalRefunded());
$this->order_total = (double) number_format($orderTotal, 2, '.', '');
$this->order_status = (string) $orderData->getStatus();
}