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


PHP Mage_Sales_Model_Quote::getCustomer方法代码示例

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


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

示例1: validateCustomerData

 /**
  * Validate customer data and set some its data for further usage in quote
  * Will return either true or array with error messages
  *
  * @param Mage_Sales_Model_Quote $quote
  * @param array $data
  * @return true|array
  */
 public function validateCustomerData($quote, array $data, $registerMethod)
 {
     /** @var $customerForm Mage_Customer_Model_Form */
     $customerForm = Mage::getModel('customer/form');
     $customerForm->setFormCode('customer_account_create');
     if ($quote->getCustomerId()) {
         $customer = $quote->getCustomer();
         $customerForm->setEntity($customer);
         $customerData = $quote->getCustomer()->getData();
     } else {
         /* @var $customer Mage_Customer_Model_Customer */
         $customer = Mage::getModel('customer/customer');
         $customerForm->setEntity($customer);
         $customerRequest = $customerForm->prepareRequest($data);
         $customerData = $customerForm->extractData($customerRequest);
     }
     $customerErrors = $customerForm->validateData($customerData);
     if ($customerErrors !== true) {
         return $customerErrors;
     }
     if ($quote->getCustomerId()) {
         return true;
     }
     $customerForm->compactData($customerData);
     if ($registerMethod == 'register') {
         // set customer password
         $customer->setPassword($customerRequest->getParam('customer_password'));
         $customer->setConfirmation($customerRequest->getParam('confirm_password'));
         $customer->setPasswordConfirmation($customerRequest->getParam('confirm_password'));
     } else {
         // spoof customer password for guest
         $password = $customer->generatePassword();
         $customer->setPassword($password);
         $customer->setConfirmation($password);
         $customer->setPasswordConfirmation($password);
         // set NOT LOGGED IN group id explicitly,
         // otherwise copyFieldset('customer_account', 'to_quote') will fill it with default group id value
         $customer->setGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
     }
     $result = $customer->validate();
     if (true !== $result && is_array($result)) {
         return implode(', ', $result);
     }
     if ($registerMethod == 'register') {
         // save customer encrypted password in quote
         $quote->setPasswordHash($customer->encryptPassword($customer->getPassword()));
     }
     // copy customer/guest email to address
     $quote->getBillingAddress()->setEmail($customer->getEmail());
     // copy customer data to quote
     Mage::helper('core')->copyFieldset('customer_account', 'to_quote', $customer, $quote);
     return true;
 }
开发者ID:jronatay,项目名称:ultimo-magento-jron,代码行数:61,代码来源:ExternalCheckout.php

示例2: updateCustomer

 /**
  * update customer when edit shipping address to paypal
  *
  * @param $accessCode
  */
 public function updateCustomer($accessCode)
 {
     $response = $this->_doRapidAPI('Transaction/' . $accessCode, 'GET');
     if ($response->isSuccess()) {
         $customer = $this->_quote->getCustomer();
         $billingAddress = $this->_quote->getBillingAddress();
         $shippingAddress = $this->_quote->getShippingAddress();
         $trans = $response->getTransactions();
         if (isset($trans[0]['Customer'])) {
             $billing = $trans[0]['Customer'];
             $billingAddress->setFirstname($billing['FirstName'])->setLastName($billing['LastName'])->setCompany($billing['CompanyName'])->setJobDescription($billing['JobDescription'])->setStreet($billing['Street1'])->setStreet2($billing['Street2'])->setCity($billing['City'])->setState($billing['State'])->setPostcode($billing['PostalCode'])->setCountryId(strtoupper($billing['Country']))->setEmail($billing['Email'])->setTelephone($billing['Phone'])->setMobile($billing['Mobile'])->setComments($billing['Comments'])->setFax($billing['Fax'])->setUrl($billing['Url']);
         }
         if (isset($trans[0]['ShippingAddress'])) {
             $shipping = $trans[0]['ShippingAddress'];
             $shippingAddress->setFirstname($shipping['FirstName'])->setLastname($shipping['LastName'])->setStreet($shipping['Street1'])->setStreet2($shipping['Street2'])->setCity($shipping['City'])->setPostcode($shipping['PostalCode'])->setCountryId(strtoupper($shipping['Country']))->setEmail($shipping['Email'])->setFax($shipping['Fax']);
             if ($shipping['State'] && $shipping['Country'] && ($region = Mage::getModel('directory/region')->loadByCode($shipping['State'], $shipping['Country']))) {
                 $shippingAddress->setRegion($region->getName())->setRegionId($region->getId());
             }
             if ($shipping['Phone']) {
                 $shippingAddress->setTelephone($shipping['Phone']);
             }
         }
         $this->_quote->assignCustomerWithAddressChange($customer, $billingAddress, $shippingAddress)->save();
     }
 }
开发者ID:programmerrahul,项目名称:vastecom,代码行数:30,代码来源:Sharedpage.php

示例3: toOrder

 /**
  * Convert quote model to order model
  *
  * @param   Mage_Sales_Model_Quote $quote
  * @return  Mage_Sales_Model_Order
  */
 public function toOrder(Mage_Sales_Model_Quote $quote, $order = null)
 {
     if (!$order instanceof Mage_Sales_Model_Order) {
         $order = Mage::getModel('sales/order');
     }
     /* @var $order Mage_Sales_Model_Order */
     $order->setIncrementId($quote->getReservedOrderId())->setStoreId($quote->getStoreId())->setQuoteId($quote->getId())->setCustomer($quote->getCustomer());
     Mage::helper('core')->copyFieldset('sales_convert_quote', 'to_order', $quote, $order);
     Mage::dispatchEvent('sales_convert_quote_to_order', array('order' => $order, 'quote' => $quote));
     return $order;
 }
开发者ID:codercv,项目名称:urbansurprisedev,代码行数:17,代码来源:Quote.php

示例4: _involveNewCustomer

 /**
  * Involve new customer to system
  *
  * @return self
  */
 protected function _involveNewCustomer()
 {
     $customer = $this->_quote->getCustomer();
     if ($customer->isConfirmationRequired()) {
         $customer->sendNewAccountEmail('confirmation');
         $url = Mage::helper('customer')->getEmailConfirmationUrl($customer->getEmail());
         $this->_getCustomerSession()->addSuccess(Mage::helper('customer')->__('Account confirmation is required. Please, check your e-mail for confirmation link. To resend confirmation email please <a href="%s">click here</a>.', $url));
     } else {
         $customer->sendNewAccountEmail();
         $this->_getCustomerSession()->loginById($customer->getId());
     }
     return $this;
 }
开发者ID:adderall,项目名称:magento-retail-order-management,代码行数:18,代码来源:Checkout.php

示例5: getCustomerBalanceModelFromSalesEntity

 /**
  * Get customer balance model using sales entity
  *
  * @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order $salesEntity
  *
  * @return Enterprise_CustomerBalance_Model_Balance|bool
  */
 public function getCustomerBalanceModelFromSalesEntity($salesEntity)
 {
     if ($salesEntity instanceof Mage_Sales_Model_Order) {
         $customerId = $salesEntity->getCustomerId();
         $quote = $salesEntity->getQuote();
     } elseif ($salesEntity instanceof Mage_Sales_Model_Quote) {
         $customerId = $salesEntity->getCustomer()->getId();
         $quote = $salesEntity;
     } else {
         return false;
     }
     if (!$customerId) {
         return false;
     }
     $customerBalanceModel = Mage::getModel('enterprise_customerbalance/balance')->setCustomerId($customerId)->setWebsiteId(Mage::app()->getStore($salesEntity->getStoreId())->getWebsiteId())->loadByCustomer();
     if ($quote->getBaseCustomerBalanceVirtualAmount() > 0) {
         $customerBalanceModel->setAmount($customerBalanceModel->getAmount() + $quote->getBaseCustomerBalanceVirtualAmount());
     }
     return $customerBalanceModel;
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:27,代码来源:Data.php

示例6: setAliasActive

 /**
  * set the last pending alias to active and remove other aliases for customer based on address
  * 
  * @param Mage_Sales_Model_Quote $quote
  */
 public function setAliasActive(Mage_Sales_Model_Quote $quote, Mage_Sales_Model_Order $order = null, $saveSalesObjects = false)
 {
     if (is_null($quote->getPayment()->getAdditionalInformation('userIsRegistering')) || false === $quote->getPayment()->getAdditionalInformation('userIsRegistering')) {
         $aliasesToDelete = Mage::helper('ops/alias')->getAliasesForAddresses($quote->getCustomer()->getId(), $quote->getBillingAddress(), $quote->getShippingAddress())->addFieldToFilter('state', Netresearch_OPS_Model_Alias_State::ACTIVE);
         $lastPendingAlias = Mage::helper('ops/alias')->getAliasesForAddresses($quote->getCustomer()->getId(), $quote->getBillingAddress(), $quote->getShippingAddress(), $quote->getStoreId())->addFieldToFilter('alias', $quote->getPayment()->getAdditionalInformation('alias'))->addFieldToFilter('state', Netresearch_OPS_Model_Alias_State::PENDING)->setOrder('created_at', Varien_Data_Collection::SORT_ORDER_DESC)->getFirstItem();
         if (0 < $lastPendingAlias->getId()) {
             foreach ($aliasesToDelete as $alias) {
                 $alias->delete();
             }
             $lastPendingAlias->setState(Netresearch_OPS_Model_Alias_State::ACTIVE);
             $lastPendingAlias->save();
         }
     } else {
         $this->setAliasToActiveAfterUserRegisters($order, $quote);
     }
     $this->cleanUpAdditionalInformation($order->getPayment(), false, $saveSalesObjects);
     $this->cleanUpAdditionalInformation($quote->getPayment(), false, $saveSalesObjects);
 }
开发者ID:roshu1980,项目名称:add-computers,代码行数:23,代码来源:Alias.php

示例7: involveNewCustomer

 /**
  * Involve new customer to system
  *
  * @param Mage_Sales_Model_Quote $quote
  * @return Mage_Checkout_Model_Api_Resource_Customer
  */
 public function involveNewCustomer(Mage_Sales_Model_Quote $quote)
 {
     $customer = $quote->getCustomer();
     if ($customer->isConfirmationRequired()) {
         $customer->sendNewAccountEmail('confirmation');
     } else {
         $customer->sendNewAccountEmail();
     }
     return $this;
 }
开发者ID:cnglobal-sl,项目名称:caterez,代码行数:16,代码来源:Customer.php

示例8: _abortCheckoutRegistration

 /**
  * Abort registration during checkout if default activation status is false.
  *
  * Should work with: onepage checkout, multishipping checkout and custom
  * checkout types, as long as they use the standard converter model
  * Mage_Sales_Model_Convert_Quote.
  *
  * Expected state after checkout:
  * - Customer saved
  * - No order placed
  * - Guest quote still contains items
  * - Customer quote contains no items
  * - Customer redirected to login page
  * - Customer sees message
  *
  * @param Mage_Sales_Model_Quote $quote
  */
 protected function _abortCheckoutRegistration(Mage_Sales_Model_Quote $quote)
 {
     $helper = Mage::helper('customeractivation');
     if (!$helper->isModuleActive($quote->getStoreId())) {
         return;
     }
     if ($this->_isApiRequest()) {
         return;
     }
     if (!Mage::getSingleton('customer/session')->isLoggedIn() && !$quote->getCustomerIsGuest()) {
         // Order is being created by non-activated customer
         $customer = $quote->getCustomer()->save();
         if (!$customer->getCustomerActivated()) {
             // Abort order placement
             // Exception handling can not be assumed to be useful
             // Todo: merge guest quote to customer quote and save customer quote, but don't log customer in
             // Add message
             $message = $helper->__('Please wait for your account to be activated, then log in and continue with the checkout');
             Mage::getSingleton('core/session')->addSuccess($message);
             // Handle redirect to login page
             $targetUrl = Mage::getUrl('customer/account/login');
             $response = Mage::app()->getResponse();
             if (Mage::app()->getRequest()->isAjax()) {
                 // Assume one page checkout
                 $result = array('redirect' => $targetUrl);
                 $response->setBody(Mage::helper('core')->jsonEncode($result));
             } else {
                 if ($response->canSendHeaders(true)) {
                     // Assume multishipping checkout
                     $response->clearHeader('location')->setRedirect($targetUrl);
                 }
             }
             $response->sendResponse();
             /* ugly, but we need to stop the further order processing */
             exit;
         }
     }
 }
开发者ID:bherrero,项目名称:customer-activation,代码行数:55,代码来源:Observer.php

示例9: updateCustomer

 /**
  * Update customer info
  * @param $transId
  * @return mixed
  */
 public function updateCustomer($accessCode, Mage_Sales_Model_Quote $quote)
 {
     try {
         $results = $this->_doRapidAPI("Transaction/{$accessCode}", 'GET');
         if (!$results->isSuccess()) {
             Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while connecting to payment gateway. Please try again later. (Error message: %s)', $results->getMessage()));
         }
         $customer = $quote->getCustomer();
         $billingAddress = $quote->getBillingAddress();
         $shippingAddress = $quote->getShippingAddress();
         if ($results->isSuccess()) {
             $trans = $results->getTransactions();
             if (isset($trans[0]['Customer'])) {
                 $billing = $trans[0]['Customer'];
                 $billingAddress->setFirstname($billing['FirstName'])->setLastName($billing['LastName'])->setCompany($billing['CompanyName'])->setJobDescription($billing['JobDescription'])->setStreet($billing['Street1'])->setStreet2($billing['Street2'])->setCity($billing['City'])->setState($billing['State'])->setPostcode($billing['PostalCode'])->setCountryId(strtoupper($billing['Country']))->setEmail($billing['Email'])->setTelephone($billing['Phone'])->setMobile($billing['Mobile'])->setComments($billing['Comments'])->setFax($billing['Fax'])->setUrl($billing['Url']);
             }
             if (isset($trans[0]['ShippingAddress'])) {
                 $shipping = $trans[0]['ShippingAddress'];
                 $shippingAddress->setFirstname($shipping['FirstName'])->setLastname($shipping['LastName'])->setStreet($shipping['Street1'])->setStreet2($shipping['Street2'])->setCity($shipping['City'])->setPostcode($shipping['PostalCode'])->setCountryId(strtoupper($shipping['Country']))->setEmail($shipping['Email'])->setFax($shipping['Fax']);
                 if ($shipping['State'] && $shipping['Country'] && ($region = Mage::getModel('directory/region')->loadByCode($shipping['State'], $shipping['Country']))) {
                     $shippingAddress->setRegion($region->getName())->setRegionId($region->getId());
                 }
                 if ($shipping['Phone']) {
                     $shippingAddress->setTelephone($shipping['Phone']);
                 }
             }
             return $quote->assignCustomerWithAddressChange($customer, $billingAddress, $shippingAddress)->save();
         }
         return false;
     } catch (Exception $e) {
         Mage::throwException($e->getMessage());
         return false;
     }
 }
开发者ID:programmerrahul,项目名称:vastecom,代码行数:39,代码来源:Transparent.php

示例10: setTaxvat

 /**
  * Sets the vat id into the customer if not guest and always into the Quote/Order
  *
  * @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order $quote
  * @param string $taxvat
  */
 public function setTaxvat($quote, $taxvat)
 {
     if ($quote->getCustomerId()) {
         $quote->getCustomer()->setTaxvat($taxvat)->save();
     }
     $quote->setCustomerTaxvat($taxvat)->save();
 }
开发者ID:ratepay,项目名称:magento-module,代码行数:13,代码来源:Data.php

示例11: getAlternateAddress

 /**
  * get an alternate address to use if the address an item is attached to
  * does not have enough data for the payload
  *
  * @param Mage_Sales_Model_Quote
  * @return Mage_Customer_Model_Address_Abstract|null
  */
 protected function getAlternateAddress(Mage_Sales_Model_Quote $quote)
 {
     $address = $quote->getCustomer()->getDefaultShippingAddress();
     return $address ?: null;
 }
开发者ID:rgabruel,项目名称:magento-retail-order-management,代码行数:12,代码来源:Details.php

示例12: createNewOrder

 /**
  * @param Mage_Sales_Model_Quote $quote
  *
  * @return Mage_Sales_Model_Order
  */
 public function createNewOrder($quote)
 {
     $shopgateOrder = $this->getShopgateOrder();
     $convert = Mage::getModel('sales/convert_quote');
     $transaction = Mage::getModel('core/resource_transaction');
     $SgPaymentInfos = $shopgateOrder->getPaymentInfos();
     if ($quote->getCustomerId()) {
         $transaction->addObject($quote->getCustomer());
     }
     $quote->setTotalsCollectedFlag(true);
     $transaction->addObject($quote);
     if ($quote->isVirtual()) {
         $order = $convert->addressToOrder($quote->getBillingAddress());
     } else {
         $order = $convert->addressToOrder($quote->getShippingAddress());
     }
     $order->setBillingAddress($convert->addressToOrderAddress($quote->getBillingAddress()));
     if ($quote->getBillingAddress()->getCustomerAddress()) {
         $order->getBillingAddress()->setCustomerAddress($quote->getBillingAddress()->getCustomerAddress());
     }
     if (!$quote->isVirtual()) {
         $order->setShippingAddress($convert->addressToOrderAddress($quote->getShippingAddress()));
         if ($quote->getShippingAddress()->getCustomerAddress()) {
             $order->getShippingAddress()->setCustomerAddress($quote->getShippingAddress()->getCustomerAddress());
         }
     }
     $order->setPayment($convert->paymentToOrderPayment($quote->getPayment()));
     $order->getPayment()->setTransactionId($quote->getPayment()->getLastTransId());
     $order->getPayment()->setLastTransId($quote->getPayment()->getLastTransId());
     $order->setPayoneTransactionStatus($SgPaymentInfos['status']);
     foreach ($quote->getAllItems() as $item) {
         /** @var Mage_Sales_Model_Order_Item $item */
         $orderItem = $convert->itemToOrderItem($item);
         if ($item->getParentItem()) {
             $orderItem->setParentItem($order->getItemByQuoteItemId($item->getParentItem()->getId()));
         }
         $order->addItem($orderItem);
     }
     $order->setQuote($quote);
     $order->setExtOrderId($quote->getPayment()->getTransactionId());
     $order->setCanSendNewEmailFlag(false);
     $order->getPayment()->setData('payone_config_payment_method_id', $this->_getMethodId());
     return $this->setOrder($order);
 }
开发者ID:buttasg,项目名称:cowgirlk,代码行数:49,代码来源:Abstract.php

示例13: _paymentDataImport

 /**
  * Prepare and set to quote reward balance instance,
  * set zero subtotal checkout payment if need
  *
  * @param Mage_Sales_Model_Quote $quote
  * @param Varien_Object $payment
  * @param boolean $useRewardPoints
  * @return Enterprise_Reward_Model_Observer
  */
 protected function _paymentDataImport($quote, $payment, $useRewardPoints)
 {
     if (!$quote || !$quote->getCustomerId()) {
         return $this;
     }
     $quote->setUseRewardPoints((bool) $useRewardPoints);
     if ($quote->getUseRewardPoints()) {
         /* @var $reward Enterprise_Reward_Model_Reward */
         $reward = Mage::getModel('enterprise_reward/reward')->setCustomer($quote->getCustomer())->setWebsiteId($quote->getStore()->getWebsiteId())->loadByCustomer();
         if ($reward->getId()) {
             $quote->setRewardInstance($reward);
             if (!$payment->getMethod()) {
                 $payment->setMethod('free');
             }
         } else {
             $quote->setUseRewardPoints(false);
         }
     }
     return $this;
 }
开发者ID:jpbender,项目名称:mage_virtual,代码行数:29,代码来源:Observer.php

示例14: callGetTaxForQuote

 public function callGetTaxForQuote(Mage_Sales_Model_Quote $quote)
 {
     /** @var Aoe_AvaTax_Helper_Soap $helper */
     $helper = Mage::helper('Aoe_AvaTax/Soap');
     $address = $quote->getShippingAddress();
     if ($address->validate() !== true) {
         $resultArray = array('ResultCode' => 'Skip', 'Messages' => array(), 'TaxLines' => array());
         return $resultArray;
     }
     $store = $quote->getStore();
     $hideDiscountAmount = Mage::getStoreConfigFlag(Mage_Tax_Model_Config::CONFIG_XML_PATH_APPLY_AFTER_DISCOUNT, $store);
     $timestamp = $quote->getCreatedAt() ? Varien_Date::toTimestamp($quote->getCreatedAt()) : now();
     $date = new Zend_Date($timestamp);
     $request = new AvaTax\GetTaxRequest();
     $request->setCompanyCode($this->limit($helper->getConfig('company_code', $store), 25));
     $request->setDocType(AvaTax\DocumentType::$SalesOrder);
     $request->setCommit(false);
     $request->setDetailLevel(AvaTax\DetailLevel::$Tax);
     $request->setDocDate($date->toString('yyyy-MM-dd'));
     $request->setCustomerCode($helper->getCustomerDocCode($quote->getCustomer()) ?: $helper->getQuoteDocCode($quote));
     $request->setCurrencyCode($this->limit($quote->getBaseCurrencyCode(), 3));
     $request->setDiscount($hideDiscountAmount ? 0.0 : $store->roundPrice($address->getBaseDiscountAmount()));
     if ($quote->getCustomerTaxvat()) {
         $request->setBusinessIdentificationNo($this->limit($quote->getCustomerTaxvat(), 25));
     }
     $request->setOriginAddress($this->getOriginAddress($store));
     $request->setDestinationAddress($this->getAddress($address));
     $taxLines = array();
     $itemPriceIncludesTax = Mage::getStoreConfigFlag(Mage_Tax_Model_Config::CONFIG_XML_PATH_PRICE_INCLUDES_TAX, $store);
     foreach ($this->getHelper()->getActionableQuoteAddressItems($address) as $k => $item) {
         /** @var Mage_Sales_Model_Quote_Item|Mage_Sales_Model_Quote_Address_Item $item */
         $itemAmount = $store->roundPrice($itemPriceIncludesTax ? $item->getBaseRowTotalInclTax() : $item->getBaseRowTotal());
         //$itemAmount = $store->roundPrice($item->getBaseRowTotal());
         $itemAmount -= $store->roundPrice($item->getBaseDiscountAmount());
         $taxLine = new AvaTax\Line();
         $taxLine->setNo($this->limit($k, 50));
         $taxLine->setItemCode($this->limit($item->getSku(), 50));
         $taxLine->setQty(round($item->getQty(), 4));
         $taxLine->setAmount($itemAmount);
         $taxLine->setDescription($this->limit($item->getName(), 255));
         $taxLine->setTaxCode($this->limit($helper->getProductTaxCode($item->getProduct()), 25));
         $taxLine->setDiscounted($item->getBaseDiscountAmount() > 0.0);
         $taxLine->setTaxIncluded($itemPriceIncludesTax);
         $taxLine->setRef1($this->limit($helper->getQuoteItemRef1($item, $store), 250));
         $taxLine->setRef2($this->limit($helper->getQuoteItemRef2($item, $store), 250));
         $taxLines[] = $taxLine;
     }
     $shippingPriceIncludesTax = Mage::getStoreConfigFlag(Mage_Tax_Model_Config::CONFIG_XML_PATH_SHIPPING_INCLUDES_TAX, $store);
     $shippingAmount = $store->roundPrice($shippingPriceIncludesTax ? $address->getBaseShippingInclTax() : $address->getBaseShippingAmount());
     //$shippingAmount = $store->roundPrice($address->getBaseShippingAmount());
     $shippingAmount -= $store->roundPrice($address->getBaseShippingDiscountAmount());
     $taxLine = new AvaTax\Line();
     $taxLine->setNo('SHIPPING');
     $taxLine->setItemCode('SHIPPING');
     $taxLine->setQty(1);
     $taxLine->setAmount($shippingAmount);
     $taxLine->setDescription($this->limit("Shipping: " . $address->getShippingMethod(), 255));
     $taxLine->setTaxCode($this->limit($helper->getShippingTaxCode($store), 25));
     $taxLine->setDiscounted($address->getBaseShippingDiscountAmount() > 0.0);
     $taxLine->setTaxIncluded($shippingPriceIncludesTax);
     $taxLine->setRef1($this->limit($address->getShippingMethod(), 25));
     $taxLines[] = $taxLine;
     $request->setLines($taxLines);
     Mage::dispatchEvent('aoe_avatax_soapapi_get_tax_for_quote_before', array('request' => $request, 'quote' => $quote));
     // TODO: Handle giftwrapping
     return $this->callGetTax($store, $request);
 }
开发者ID:aoepeople,项目名称:aoe_avatax,代码行数:67,代码来源:SoapApi.php

示例15: getCustomerXml

 /**
  * Return customer data in xml format.
  *
  * @param Mage_Sales_Model_Quote $quote
  * @return string Xml data
  */
 public function getCustomerXml($quote)
 {
     $_xml = null;
     $checkoutMethod = Mage::getSingleton('checkout/type_onepage')->getCheckoutMethod();
     if ($checkoutMethod) {
         $customer = new Varien_Object();
         switch ($checkoutMethod) {
             case 'register':
             case 'guest':
                 $customer->setMiddlename($quote->getBillingAddress()->getMiddlename());
                 $customer->setPreviousCustomer('0');
                 break;
             case 'customer':
                 //Load customer by Id
                 $customer = $quote->getCustomer();
                 $customer->setPreviousCustomer('1');
                 break;
             default:
                 $customer = $quote->getCustomer();
                 $customer->setPreviousCustomer('0');
                 break;
         }
         $customer->setWorkPhone($quote->getBillingAddress()->getFax());
         $customer->setMobilePhone($quote->getBillingAddress()->getTelephone());
         $xml = new Ebizmarts_Simplexml_Element('<customer />');
         if ($customer->getMiddlename()) {
             $xml->addChild('customerMiddleInitial', substr($customer->getMiddlename(), 0, 1));
         }
         if ($customer->getDob()) {
             $_dob = substr($customer->getDob(), 0, strpos($customer->getDob(), ' '));
             if ($_dob != "0000-00-00") {
                 $xml->addChildCData('customerBirth', $_dob);
                 //YYYY-MM-DD
             }
         }
         if ($customer->getWorkPhone()) {
             $xml->addChildCData('customerWorkPhone', substr(str_pad($customer->getWorkPhone(), 11, '0', STR_PAD_RIGHT), 0, 19));
         }
         if ($customer->getMobilePhone()) {
             $xml->addChildCData('customerMobilePhone', substr(str_pad($customer->getMobilePhone(), 11, '0', STR_PAD_RIGHT), 0, 19));
         }
         $xml->addChild('previousCust', $customer->getPreviousCustomer());
         if ($customer->getId()) {
             $xml->addChild('customerId', $customer->getId());
         }
         //$xml->addChild('timeOnFile', 10);
         $_xml = str_replace("\n", "", trim($xml->asXml()));
     }
     return $_xml;
 }
开发者ID:GaynorH,项目名称:prestigedrinks,代码行数:56,代码来源:Payment.php


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