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


PHP Mage_Sales_Model_Order::getBillingAddress方法代码示例

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


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

示例1: 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;
 }
开发者ID:edvanmacedo,项目名称:vindi-magento,代码行数:39,代码来源:PaymentMethod.php

示例2: _createCustomer

 protected function _createCustomer(Mage_Sales_Model_Order $order)
 {
     $addresses = array();
     $primaryPhone = null;
     $company = null;
     if ($order->getBillingAddress()) {
         $addresses[] = Mage::helper('xcom_chronicle')->createAddress($order->getBillingAddress(), array(Xcom_Chronicle_Helper_Data::ADDRESS_TAG_BILLING));
         $company = $order->getBillingAddress()->getCompany();
         $primaryPhone = $order->getBillingAddress()->getTelephone();
     }
     if ($order->getShippingAddress()) {
         $addresses[] = Mage::helper('xcom_chronicle')->createAddress($order->getShippingAddress(), array(Xcom_Chronicle_Helper_Data::ADDRESS_TAG_SHIPPING));
     }
     $data = array('id' => Mage::helper('xcom_chronicle')->createEntityId('guest' . $order->getRealOrderId()), 'fullName' => $this->_createCustomerName($order), 'addresses' => $addresses, 'primaryPhone' => array('number' => $primaryPhone, 'type' => 'UNKNOWN'), 'email' => array('emailAddress' => $order->getCustomerEmail(), 'extension' => null), 'gender' => null, 'dateOfBirth' => null, 'company' => $company, 'dateCreated' => date('c', strtotime($order->getCreatedAt())), 'lastModified' => date('c', strtotime($order->getUpdatedAt())), 'sourceIds' => null, 'emailOptOut' => null, 'doNotCall' => null);
     return $data;
 }
开发者ID:ridhoq,项目名称:mxpi-twitter,代码行数:16,代码来源:Guest.php

示例3: _prepareCustomerData

 /**
  * @return array
  */
 protected function _prepareCustomerData()
 {
     $customer_id = null;
     $customer = null;
     $customer_log = null;
     $billing_address = $this->_order->getBillingAddress();
     $customer_verified = false;
     $customer_orders_count = 0;
     $gender = $this->_order->getCustomerGender();
     if (!$this->_order->getCustomerIsGuest()) {
         $customer_id = $this->_order->getCustomerId();
         if ($customer_id) {
             /** @var Mage_Customer_Model_Customer $customer */
             $customer = Mage::getModel("customer/customer");
             $customer->load($customer_id);
             /** @var Mage_Log_Model_Customer $customer_log */
             $customer_log = Mage::getModel('log/customer')->load($customer_id);
         }
         $customer_verified = $this->getCustomerIsConfirmedStatus($customer);
         $orders = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('customer_id', $customer_id);
         /** @noinspection PhpUndefinedMethodInspection */
         $customer_orders_count = $orders->count();
     }
     $data = array_filter(array('customer_id' => $customer_id, 'customer_is_guest' => $this->_order->getCustomerIsGuest(), 'verified' => $customer_verified, 'language_code' => $this->_language_code, 'last_login_on' => $customer_log ? $customer_log->getLoginAt() : null, 'created_on' => $customer ? $customer->getData('created_at') : null, 'updated_on' => $customer ? $customer->getData('updated_at') : null, 'birthdate' => $this->_order->getCustomerDob(), 'email' => $this->_order->getCustomerEmail(), 'title' => '', 'prefix' => $this->_order->getCustomerPrefix(), 'suffix' => $this->_order->getCustomerSuffix(), 'first_name' => $this->_order->getCustomerFirstname(), 'middle_name' => $this->_order->getCustomerMiddlename(), 'last_name' => $this->_order->getCustomerLastname(), 'company_name' => $billing_address ? $billing_address->getCompany() : null, 'gender' => $gender == 1 ? 'male' : ($gender == 2 ? 'female' : null), 'telephone1' => $billing_address ? $billing_address->getTelephone() : null, 'telephone2' => '', 'telephone3' => '', 'fax' => $billing_address ? $billing_address->getFax() : null, 'vat_number' => $this->_order->getCustomerTaxvat(), 'reg_ip_address' => '', 'customer_orders_count' => $customer_orders_count));
     return $data;
 }
开发者ID:payin7-payments,项目名称:payin7-magento,代码行数:29,代码来源:Submit.php

示例4: 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;
 }
开发者ID:xiaoguizhidao,项目名称:emporiodopara,代码行数:60,代码来源:Standard.php

示例5: getCustomerEmail

 /**
  * Returns the current customers email adress.
  * @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order $object
  * @return string the customers email adress
  */
 public function getCustomerEmail($object)
 {
     $email = $object->getCustomerEmail();
     if (empty($email)) {
         $email = $object->getBillingAddress()->getEmail();
     }
     return $email;
 }
开发者ID:SiWe0401,项目名称:paymill-magento,代码行数:13,代码来源:CustomerHelper.php

示例6: redirectAction

 public function redirectAction()
 {
     // Retrieve order
     $order = new Mage_Sales_Model_Order();
     $ccavenue['order_id'] = Mage::getSingleton('checkout/session')->getLastRealOrderId();
     $order->loadByIncrementId($ccavenue['order_id']);
     // Get CCAvenue Parameters
     $ccavenue['action'] = Mage::getStoreConfig('payment/ccavenue/submit_url');
     $ccavenue['merchant_id'] = Mage::getStoreConfig('payment/ccavenue/merchant_id');
     $ccavenue['amount'] = round($order->base_grand_total, 2);
     $ccavenue['redirect_url'] = Mage::getBaseUrl() . 'ccavenue/payment/response';
     $ccavenue['working_key'] = Mage::getStoreConfig('payment/ccavenue/working_key');
     $ccavenue['checksum'] = $this->getCheckSum($ccavenue['merchant_id'], $ccavenue['amount'], $ccavenue['order_id'], $ccavenue['redirect_url'], $ccavenue['working_key']);
     // Retrieve order details
     $billingAddress = $order->getBillingAddress();
     $billingData = $billingAddress->getData();
     $shippingAddress = $order->getShippingAddress();
     if ($shippingAddress) {
         $shippingData = $shippingAddress->getData();
     }
     $ccavenue['billing_cust_name'] = $billingData['firstname'] . ' ' . $billingData['lastname'];
     $ccavenue['billing_cust_address'] = $billingAddress->street;
     $ccavenue['billing_cust_state'] = $billingAddress->region;
     $ccavenue['billing_cust_country'] = Mage::getModel('directory/country')->load($billingAddress->country_id)->getName();
     $ccavenue['billing_cust_tel'] = $billingAddress->telephone;
     $ccavenue['billing_cust_email'] = $order->customer_email;
     if ($shippingAddress) {
         $ccavenue['delivery_cust_name'] = $shippingData['firstname'] . ' ' . $shippingData['lastname'];
         $ccavenue['delivery_cust_address'] = $shippingAddress->street;
         $ccavenue['delivery_cust_state'] = $shippingAddress->region;
         $ccavenue['delivery_cust_country'] = Mage::getModel('directory/country')->load($shippingAddress->country_id)->getName();
         $ccavenue['delivery_cust_tel'] = $shippingAddress->telephone;
         $ccavenue['delivery_city'] = $shippingAddress->city;
         $ccavenue['delivery_zip'] = $shippingAddress->postcode;
     } else {
         $ccavenue['delivery_cust_name'] = '';
         $ccavenue['delivery_cust_address'] = '';
         $ccavenue['delivery_cust_state'] = '';
         $ccavenue['delivery_cust_country'] = '';
         $ccavenue['delivery_cust_tel'] = '';
         $ccavenue['delivery_city'] = '';
         $ccavenue['delivery_zip'] = '';
     }
     $ccavenue['merchant_param'] = '';
     $ccavenue['billing_city'] = $billingAddress->city;
     $ccavenue['billing_zip'] = $billingAddress->postcode;
     $ccavenue['billing_cust_notes'] = '';
     // Insert into CCAvenue Response Log Table
     $now = Mage::getModel('core/date')->timestamp(time());
     Mage::getModel('ccavenue/ccavenueredirect')->setMerchantId($ccavenue['merchant_id'])->setAmount($ccavenue['amount'])->setOrderId($ccavenue['order_id'])->setRedirectUrl($ccavenue['redirect_url'])->setChecksum($ccavenue['checksum'])->setBillingCustName(addslashes($ccavenue['billing_cust_name']))->setBillingCustAddress(addslashes($ccavenue['billing_cust_address']))->setBillingCustCountry(addslashes($ccavenue['billing_cust_country']))->setBillingCustState(addslashes($ccavenue['billing_cust_state']))->setBillingZip($ccavenue['billing_zip'])->setBillingCustTel($ccavenue['billing_cust_tel'])->setBillingCustEmail($ccavenue['billing_cust_email'])->setDeliveryCustName(addslashes($ccavenue['delivery_cust_name']))->setDeliveryCustAddress(addslashes($ccavenue['delivery_cust_address']))->setDeliveryCustCountry(addslashes($ccavenue['delivery_cust_country']))->setDeliveryCustState(addslashes($ccavenue['delivery_cust_state']))->setDeliveryCustTel($ccavenue['delivery_cust_tel'])->setBillingCustNotes($ccavenue['billing_cust_notes'])->setMerchantParam($ccavenue['merchant_param'])->setBillingCustCity(addslashes($ccavenue['billing_city']))->setBillingZipCode($ccavenue['billing_zip'])->setDeliveryCustCity(addslashes($ccavenue['delivery_city']))->setDeliveryZipCode($ccavenue['delivery_zip'])->setCcavenueRedirectIp($this->get_uer_ip())->setCcavenueRedirectDtime(date('Y-m-d H:i:s', $now))->save();
     // Add data to registry so it's accessible in the view file
     Mage::register('ccavenue', $ccavenue);
     // Render layout
     $this->loadLayout();
     $block = $this->getLayout()->createBlock('Mage_Core_Block_Template', 'ccavenue', array('template' => 'ccavenue/redirect.phtml'));
     $this->getLayout()->getBlock('content')->append($block);
     $this->renderLayout();
 }
开发者ID:vinayshuklasourcefuse,项目名称:sareez,代码行数:58,代码来源:PaymentController.php

示例7: sendEmailNotification

 /**
  * Sends notification mail for selected shipping rate
  *
  * The code for this functionality is based on Mage_Sales_Model_Order::sendNewOrderEmail()
  *
  * @param Mage_Sales_Model_Order $order
  * @return boolean
  * @throws Exception
  * @see Mage_Sales_Model_Order
  */
 public function sendEmailNotification($order)
 {
     if (strncmp($order->getShippingMethod(), 'shippingrates_', 14) != 0) {
         return false;
     }
     $notificationMail = $order->getShippingCarrier()->getNotificationMail($order->getShippingMethod());
     if (!strlen(trim($notificationMail))) {
         return false;
     }
     $storeId = $order->getStore()->getId();
     // Start store emulation process
     $appEmulation = Mage::getSingleton('core/app_emulation');
     $initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
     try {
         // Retrieve specified view block from appropriate design package (depends on emulated store)
         $paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment())->setIsSecureMode(true);
         $paymentBlock->getMethod()->setStore($storeId);
         $paymentBlockHtml = $paymentBlock->toHtml();
     } catch (Exception $exception) {
         // Stop store emulation process
         $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
         throw $exception;
     }
     // Stop store emulation process
     $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
     // Retrieve corresponding email template id and customer name
     if ($order->getCustomerIsGuest()) {
         $templateId = Mage::getStoreConfig(Mage_Sales_Model_Order::XML_PATH_EMAIL_GUEST_TEMPLATE, $storeId);
         $customerName = $order->getBillingAddress()->getName();
     } else {
         $templateId = Mage::getStoreConfig(Mage_Sales_Model_Order::XML_PATH_EMAIL_TEMPLATE, $storeId);
         $customerName = $order->getCustomerName();
     }
     $mailer = Mage::getModel('core/email_template_mailer');
     $emailInfo = Mage::getModel('core/email_info');
     $emailInfo->addTo($notificationMail);
     $mailer->addEmailInfo($emailInfo);
     // Set all required params and send emails
     $mailer->setSender(Mage::getStoreConfig(Mage_Sales_Model_Order::XML_PATH_EMAIL_IDENTITY, $storeId));
     $mailer->setStoreId($storeId);
     $mailer->setTemplateId($templateId);
     $mailer->setTemplateParams(array('order' => $order, 'billing' => $order->getBillingAddress(), 'payment_html' => $paymentBlockHtml));
     $mailer->send();
     return true;
 }
开发者ID:commercekitchen,项目名称:dualeyewear-magento,代码行数:55,代码来源:Email.php

示例8: handleTestOrder

 /**
  * Detect an order as a test order when the second street line
  * address of the order billing address matches the constant
  * IOrderCreateRequest::TEST_TYPE_AUTOCANCEL. Flag the OCR
  * payload as a test order.
  *
  * @return self
  */
 protected function handleTestOrder()
 {
     /** @var Mage_Customer_Model_Address_Abstract */
     $billingAddress = $this->_order->getBillingAddress();
     if ($this->isTestOrder($billingAddress)) {
         $this->_payload->setTestType(IOrderCreateRequest::TEST_TYPE_AUTOCANCEL);
     }
     return $this;
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:17,代码来源:Create.php

示例9: _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);
 }
开发者ID:adderall,项目名称:magento-retail-order-management,代码行数:14,代码来源:Create.php

示例10: preset

 /**
  * Saves billing section to order
  * @param Mage_Sales_Model_Order $Order
  * @return
  */
 public function preset(Mage_Sales_Model_Order $order, $data)
 {
     $ba = $order->getBillingAddress();
     foreach ($data as $k => $v) {
         $ba->setData($k, $v);
     }
     $ba->implodeStreetAddress();
     $ba->save();
     return $order;
 }
开发者ID:par-orillonsoft,项目名称:magento_work,代码行数:15,代码来源:Billing.php

示例11: _render

 /**
  * (re)Render all items and totals
  */
 protected function _render()
 {
     if (!$this->_shouldRender) {
         return;
     }
     // regular items from the sales entity
     $this->_items = array();
     foreach ($this->_salesEntity->getAllItems() as $item) {
         if (!$item->getParentItem()) {
             $this->_addRegularItem($item);
         }
     }
     end($this->_items);
     $lastRegularItemKey = key($this->_items);
     // regular totals
     $shippingDescription = '';
     if ($this->_salesEntity instanceof Mage_Sales_Model_Order) {
         $shippingDescription = $this->_salesEntity->getShippingDescription();
         $this->_totals = array(self::TOTAL_SUBTOTAL => $this->_salesEntity->getBaseSubtotal(), self::TOTAL_TAX => $this->_salesEntity->getBaseTaxAmount(), self::TOTAL_SHIPPING => $this->_salesEntity->getBaseShippingAmount(), self::TOTAL_DISCOUNT => abs($this->_salesEntity->getBaseDiscountAmount()));
         $this->_applyHiddenTaxWorkaround($this->_salesEntity);
     } else {
         $address = $this->_salesEntity->getIsVirtual() ? $this->_salesEntity->getBillingAddress() : $this->_salesEntity->getShippingAddress();
         $shippingDescription = $address->getShippingDescription();
         $this->_totals = array(self::TOTAL_SUBTOTAL => $this->_salesEntity->getBaseSubtotal(), self::TOTAL_TAX => $address->getBaseTaxAmount(), self::TOTAL_SHIPPING => $address->getBaseShippingAmount(), self::TOTAL_DISCOUNT => abs($address->getBaseDiscountAmount()));
         $this->_applyHiddenTaxWorkaround($address);
     }
     $originalDiscount = $this->_totals[self::TOTAL_DISCOUNT];
     // arbitrary items, total modifications
     Mage::dispatchEvent('paypal_prepare_line_items', array('paypal_cart' => $this));
     // distinguish original discount among the others
     if ($originalDiscount > 0.0001 && isset($this->_totalLineItemDescriptions[self::TOTAL_DISCOUNT])) {
         $this->_totalLineItemDescriptions[self::TOTAL_DISCOUNT][] = Mage::helper('sales')->__('Discount (%s)', Mage::app()->getStore()->convertPrice($originalDiscount, true, false));
     }
     // discount, shipping as items
     if ($this->_isDiscountAsItem && $this->_totals[self::TOTAL_DISCOUNT]) {
         $this->addItem(Mage::helper('paypal')->__('Discount'), 1, -1.0 * $this->_totals[self::TOTAL_DISCOUNT], $this->_renderTotalLineItemDescriptions(self::TOTAL_DISCOUNT));
     }
     $shippingItemId = $this->_renderTotalLineItemDescriptions(self::TOTAL_SHIPPING, $shippingDescription);
     if ($this->_isShippingAsItem && (double) $this->_totals[self::TOTAL_SHIPPING]) {
         $this->addItem(Mage::helper('paypal')->__('Shipping'), 1, (double) $this->_totals[self::TOTAL_SHIPPING], $shippingItemId);
     }
     // compound non-regular items into subtotal
     foreach ($this->_items as $key => $item) {
         if ($key > $lastRegularItemKey && $item->getAmount() != 0) {
             $this->_totals[self::TOTAL_SUBTOTAL] += $item->getAmount();
         }
     }
     $this->_validate();
     // if cart items are invalid, prepare cart for transfer without line items
     if (!$this->_areItemsValid) {
         $this->removeItem($shippingItemId);
     }
     $this->_shouldRender = false;
 }
开发者ID:hyhoocchan,项目名称:mage-local,代码行数:57,代码来源:Cart.php

示例12: redirectAction

 public function redirectAction()
 {
     // Retrieve order
     $order = new Mage_Sales_Model_Order();
     $customcard['order_id'] = Mage::getSingleton('checkout/session')->getLastRealOrderId();
     $order->loadByIncrementId($customcard['order_id']);
     // Get Custom card method Parameters
     $customcard['action'] = Mage::getStoreConfig('payment/paymentmodulepackbankin_checkout/submit_url');
     $customcard['merchant_id'] = Mage::getStoreConfig('payment/paymentmodulepackbankin_checkout/merchant_id');
     $customcard['amount'] = round($order->base_grand_total, 2);
     $customcard['redirect_url'] = Mage::getBaseUrl() . 'paymentmodulepackbankin_checkout/payment/response';
     // Retrieve order details
     $billingAddress = $order->getBillingAddress();
     $billingData = $billingAddress->getData();
     $shippingAddress = $order->getShippingAddress();
     if ($shippingAddress) {
         $shippingData = $shippingAddress->getData();
     }
     $customcard['billing_cust_name'] = $billingData['firstname'] . ' ' . $billingData['lastname'];
     $customcard['billing_cust_address'] = $billingAddress->street;
     $customcard['billing_cust_state'] = $billingAddress->region;
     $customcard['billing_cust_country'] = Mage::getModel('directory/country')->load($billingAddress->country_id)->getName();
     $customcard['billing_cust_tel'] = $billingAddress->telephone;
     $customcard['billing_cust_email'] = $order->customer_email;
     if ($shippingAddress) {
         $customcard['delivery_cust_name'] = $shippingData['firstname'] . ' ' . $shippingData['lastname'];
         $customcard['delivery_cust_address'] = $shippingAddress->street;
         $customcard['delivery_cust_state'] = $shippingAddress->region;
         $customcard['delivery_cust_country'] = Mage::getModel('directory/country')->load($shippingAddress->country_id)->getName();
         $customcard['delivery_cust_tel'] = $shippingAddress->telephone;
         $customcard['delivery_city'] = $shippingAddress->city;
         $customcard['delivery_zip'] = $shippingAddress->postcode;
     } else {
         $customcard['delivery_cust_name'] = '';
         $customcard['delivery_cust_address'] = '';
         $customcard['delivery_cust_state'] = '';
         $customcard['delivery_cust_country'] = '';
         $customcard['delivery_cust_tel'] = '';
         $customcard['delivery_city'] = '';
         $customcard['delivery_zip'] = '';
     }
     $customcard['merchant_param'] = '';
     $customcard['billing_city'] = $billingAddress->city;
     $customcard['billing_zip'] = $billingAddress->postcode;
     $customcard['billing_cust_notes'] = '';
     // Add data to registry so it's accessible in the view file
     Mage::register('customcard', $customcard);
     // Render layout
     $this->loadLayout();
     $block = $this->getLayout()->createBlock('Mage_Core_Block_Template', 'customcard', array('template' => 'paymentmodulepackbankin/redirect.phtml'));
     $this->getLayout()->getBlock('content')->append($block);
     $this->renderLayout();
 }
开发者ID:mSupply,项目名称:runnable_test_repo,代码行数:53,代码来源:StandardController.php

示例13: _encodeOrder

 /**
  * Encodes a single Magento Order.
  *
  * @param Mage_Sales_Model_Order $order
  *
  * @return RTDOrder
  */
 protected function _encodeOrder(Mage_Sales_Model_Order $order)
 {
     $encodedOrder = new RTDOrder();
     $customMapping = Mage::getConfig()->getNode('rtd_mappings/order');
     foreach ($customMapping->asArray() as $magentoKey => $rtdKey) {
         $encodedOrder->setParam($rtdKey, $order->{'get' . $magentoKey}());
     }
     $this->_encodeShippingAddress($encodedOrder, $order->getShippingAddress());
     $this->_encodeBillingAddress($encodedOrder, $order->getBillingAddress());
     $this->_encodeOrderLines($encodedOrder, $order);
     $this->_encodeShipment($encodedOrder, $order);
     return $encodedOrder;
 }
开发者ID:pierre-pizzetta,项目名称:orderflow-magento-module,代码行数:20,代码来源:Orders.php

示例14: _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

示例15: _getBillingObject

 /**
  * Generate and return the Wirecard billing Object
  *
  * @param bool $specificPaymentType
  * @return WirecardCEE_Client_QPay_Request_Initiation_ConsumerData_Address
  */
 protected function _getBillingObject($specificPaymentType = false)
 {
     $billing = $this->_order->getBillingAddress();
     $billingAddressObj = new WirecardCEE_Client_QPay_Request_Initiation_ConsumerData_Address(WirecardCEE_Client_QPay_Request_Initiation_ConsumerData_Address::TYPE_BILLING);
     $billingAddressObj->setFirstname($billing->getFirstname());
     $billingAddressObj->setLastname($billing->getLastname());
     $billingAddressObj->setAddress1($billing->getStreet1());
     $billingAddressObj->setCity($billing->getCity());
     $billingAddressObj->setCountry($billing->getCountry());
     $billingAddressObj->setZipCode($billing->getPostcode());
     if ($specificPaymentType != 'invoice' && $specificPaymentType != 'installment') {
         $billingAddressObj->setAddress2($billing->getStreet2());
         $billingAddressObj->setState($billing->getRegionCode());
         $billingAddressObj->setFax($billing->getFax());
         $billingAddressObj->setPhone($billing->getTelephone());
     }
     return $billingAddressObj;
 }
开发者ID:netzkollektiv,项目名称:wirecard-checkout-magento,代码行数:24,代码来源:Observer.php


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