本文整理汇总了PHP中Mage_Sales_Model_Quote_Address::getData方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote_Address::getData方法的具体用法?PHP Mage_Sales_Model_Quote_Address::getData怎么用?PHP Mage_Sales_Model_Quote_Address::getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Quote_Address
的用法示例。
在下文中一共展示了Mage_Sales_Model_Quote_Address::getData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: collect
public function collect(Mage_Sales_Model_Quote_Address $address)
{
if ($address->getQuote()->isVirtual()) {
if ($address->getData('address_type') == 'shipping') {
return $this;
}
} else {
if ($address->getData('address_type') == 'billing') {
return $this;
}
}
$this->_setAddress($address);
parent::collect($address);
$quote = $address->getQuote();
$amount = $quote->getMundipaggInterest();
if ($amount > 0) {
$this->_setBaseAmount(0.0);
$this->_setAmount(0.0);
$quote->getPayment()->setPaymentInterest($amount);
$address->setMundipaggInterest($amount);
$this->_setBaseAmount($amount);
$this->_setAmount($amount);
} else {
$this->_setBaseAmount(0.0);
$this->_setAmount(0.0);
$quote->getPayment()->setPaymentInterest(0.0);
$address->setMundipaggInterest(0.0);
}
return $this;
}
示例2: initAddress
/**
* Set correct values on subscription address based on given subscription and order address
*
* @param Adyen_Subscription_Model_Subscription $subscription
* @param Mage_Sales_Model_Order_Address|Mage_Sales_Model_Quote_Address $address
* @return $this
*/
public function initAddress(Adyen_Subscription_Model_Subscription $subscription, $address)
{
$this->setSubscriptionId($subscription->getId());
// Reset (possible) original values
$this->setOrderAddressId(null)->setCustomerAddressId(null)->setQuoteAddressId(null);
if ($address->getAddressType() == Mage_Sales_Model_Order_Address::TYPE_BILLING) {
$this->setType(self::ADDRESS_TYPE_BILLING);
} else {
$this->setType(self::ADDRESS_TYPE_SHIPPING);
}
// Note: Only use customer address if 'save_in_address_book' or 'same_as_billing'
// is also checked at the address, because it's not enough to rely solely on the
// customer address ID, because an address can be changed when creating an order
// in the backend, but this ID still remains when a quote is converted to an order
if ($address->getCustomerAddressId() && $address->getData('save_in_address_book')) {
// Create customer address
$this->setSource(self::ADDRESS_SOURCE_CUSTOMER)->setCustomerAddressId($address->getCustomerAddressId());
} elseif ($address instanceof Mage_Sales_Model_Quote_Address) {
// Create quote address
$this->setSource(self::ADDRESS_SOURCE_QUOTE)->setQuoteAddressId($address->getId());
} else {
// Create order address
$this->setSource(self::ADDRESS_SOURCE_ORDER)->setOrderAddressId($address->getId());
}
return $this;
}
示例3: collect
public function collect(Mage_Sales_Model_Quote_Address $address)
{
$quote = $address->getQuote();
$session = Mage::getSingleton('checkout/session');
if (is_null($session->getQuoteId())) {
$session = Mage::getSingleton('adminhtml/session_quote');
}
$isCustomerLoggedIn = (bool) $quote->getCustomer()->getId();
if ($session->getData('use_points') && $address->getBaseGrandTotal() && $isCustomerLoggedIn) {
$customer = Mage::getModel('customer/customer')->load($quote->getCustomer()->getId());
$pointsAmountUsed = abs($session->getData('points_amount'));
$pointsAmountAllowed = Mage::getModel('points/summary')->loadByCustomer($customer)->getPoints();
$storeId = $session->getQuote()->getStoreId();
$website = Mage::app()->getWebsite(Mage::app()->getStore($storeId)->getWebsiteId());
$baseSubtotalWithDiscount = $address->getData('base_subtotal') + $address->getData('base_discount_amount');
$subtotalWithDiscount = $address->getData('subtotal') + $address->getData('discount_amount');
$pointsSpendingCalculation = Mage::helper('points/config')->getPointsSpendingCalculation();
if ($pointsSpendingCalculation !== AW_Points_Helper_Config::BEFORE_TAX) {
$baseSubtotalWithDiscount += $address->getData('base_tax_amount');
$subtotalWithDiscount += $address->getData('tax_amount');
}
$limitedPoints = Mage::helper('points')->getLimitedPoints($baseSubtotalWithDiscount, $customer, $storeId);
$pointsAmountUsed = min($pointsAmountUsed, $pointsAmountAllowed, $limitedPoints);
$session->setData('points_amount', $pointsAmountUsed);
$rate = Mage::getModel('points/rate')->setCurrentCustomer($customer)->setCurrentWebsite($website)->loadByDirection(AW_Points_Model_Rate::POINTS_TO_CURRENCY);
if (!$rate->getId()) {
return $this;
}
$moneyBaseCurrencyForPoints = $rate->exchange($pointsAmountUsed);
$moneyCurrentCurrencyForPoints = Mage::app()->getStore()->convertPrice($moneyBaseCurrencyForPoints);
/**
* If points amount is more then needed to pay for subtotal with discount for order,
* we need to set new points amount
*/
if ($moneyBaseCurrencyForPoints > $baseSubtotalWithDiscount) {
$neededAmount = ceil($baseSubtotalWithDiscount * $rate->getPoints() / $rate->getMoney());
$neededAmountBaseCurrency = $rate->exchange($neededAmount);
$neededAmountCurrentCurrency = Mage::app()->getStore()->convertPrice($neededAmountBaseCurrency);
$session->setData('points_amount', $neededAmount);
$address->setGrandTotal($address->getData('grand_total') - $subtotalWithDiscount);
$address->setBaseGrandTotal($address->getData('base_grand_total') - $baseSubtotalWithDiscount);
$address->setMoneyForPoints($neededAmountCurrentCurrency);
$address->setBaseMoneyForPoints($neededAmountBaseCurrency);
$quote->setMoneyForPoints($neededAmountCurrentCurrency);
$quote->setBaseMoneyForPoints($neededAmountBaseCurrency);
} else {
$address->setGrandTotal($address->getGrandTotal() - $moneyCurrentCurrencyForPoints);
$address->setBaseGrandTotal($address->getBaseGrandTotal() - $moneyBaseCurrencyForPoints);
$address->setMoneyForPoints($moneyCurrentCurrencyForPoints);
$address->setBaseMoneyForPoints($moneyBaseCurrencyForPoints);
$quote->setMoneyForPoints($moneyCurrentCurrencyForPoints);
$quote->setBaseMoneyForPoints($moneyBaseCurrencyForPoints);
}
}
return $this;
}
示例4: fetch
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
if ($address->getData('address_type') == 'billing') {
return $this;
}
$amount = (double) $address->getStoreCreditDiscount();
if ($amount > 0) {
$address->addTotal(array('code' => $this->getCode(), 'title' => 'Store Credit Discount (' . $amount . ' credit used)', 'value' => '-' . $amount));
}
return $address;
}
示例5: fetch
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
if ($address->getData('address_type') == 'billing') {
return $this;
}
$discount = $address->getGiftcardDiscount();
$gcCode = Mage::getSingleton('core/session')->getGiftcardCode();
if ($discount > 0) {
$address->addTotal(array('code' => $this->getCode(), 'title' => Mage::helper('sales')->__('Gift Card (' . $gcCode . ')'), 'value' => -$discount));
}
}
示例6: collect
public function collect(Mage_Sales_Model_Quote_Address $address)
{
$quote = $address->getQuote();
$session = Mage::getSingleton('checkout/session');
$customer = Mage::getSingleton('customer/session')->getCustomer();
$params = Mage::app()->getRequest()->getParam('payment');
if ($params['use_point'] != null || $params['point_amount'] != null) {
$session->setData('use_point', $params['use_point'])->setData('point_amount', $params['point_amount']);
}
if ($session->getData('use_point') && $address->getBaseGrandTotal() && $customer->getId()) {
$pointAmount = $session->getData('point_amount');
$rate = Mage::getModel('customerreward/rate')->getPointToMoneyRate($customer->getWebsiteId(), $customer->getGroupId());
$moneyBase = $pointAmount * $rate;
$currentMoney = Mage::app()->getStore()->convertPrice($moneyBase);
$baseSubtotalWithDiscount = $address->getData('base_subtotal') + $address->getData('base_discount_amount');
$subtotalWithDiscount = $address->getData('subtotal') + $address->getData('discount_amount');
if ($moneyBase < $baseSubtotalWithDiscount) {
$address->setBaseGrandTotal($address->getBaseGrandTotal() - $moneyBase);
$address->setGrandTotal($address->getGrandTotal() - $currentMoney);
$address->setMoneyBase($moneyBase);
$address->setCurrentMoney($currentMoney);
$quote->setMoneyBase($moneyBase);
$quote->setCurrentMoney($currentMoney);
} else {
$pointUsed = ceil($baseSubtotalWithDiscount / $rate);
$moneyBaseUsed = $pointUsed * $rate;
$currentMoneyUsed = Mage::app()->getStore()->convertPrice($moneyBaseUsed);
$session->setData('point_amount', $pointUsed);
$address->setBaseGrandTotal($address->getBaseGrandTotal() - $baseSubtotalWithDiscount);
$address->setGrandTotal($address->getGrandTotal() - $subtotalWithDiscount);
$address->setMoneyBase($moneyBaseUsed);
$address->setCurrentMoney($currentMoneyUsed);
$quote->setMoneyBase($moneyBaseUsed);
$quote->setCurrentMoney($currentMoneyUsed);
}
}
return $this;
}
示例7: _processValidateCustomer
/**
* 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_Address $address
* @return true|array
*/
protected function _processValidateCustomer(Mage_Sales_Model_Quote_Address $address)
{
// set customer date of birth for further usage
$dob = '';
if ($address->getDob()) {
$dob = Mage::app()->getLocale()->date($address->getDob(), null, null, false)->toString('yyyy-MM-dd');
$this->getQuote()->setCustomerDob($dob);
}
// set customer tax/vat number for further usage
if ($address->getTaxvat()) {
$this->getQuote()->setCustomerTaxvat($address->getTaxvat());
}
/* ADD RG E TIPO */
if ($address->getTipo()) {
$this->getQuote()->setCustomerTipo($address->getTipo());
}
if ($address->getRg()) {
$this->getQuote()->setCustomerRg($address->getRg());
}
/* ADD RG E TIPO */
// set customer gender for further usage
if ($address->getGender()) {
$this->getQuote()->setCustomerGender($address->getGender());
}
// invoke customer model, if it is registering
if (self::METHOD_REGISTER == $this->getQuote()->getCheckoutMethod()) {
// set customer password hash for further usage
$customer = Mage::getModel('customer/customer');
$this->getQuote()->setPasswordHash($customer->encryptPassword($address->getCustomerPassword()));
// validate customer
foreach (array('firstname' => 'firstname', 'lastname' => 'lastname', 'email' => 'email', 'password' => 'customer_password', 'confirmation' => 'confirm_password', 'taxvat' => 'taxvat', 'gender' => 'gender', 'rg' => 'rg', 'tipo' => 'tipo') as $key => $dataKey) {
$customer->setData($key, $address->getData($dataKey));
}
if ($dob) {
$customer->setDob($dob);
}
$validationResult = $customer->validate();
if (true !== $validationResult && is_array($validationResult)) {
return array('error' => -1, 'message' => implode(', ', $validationResult));
}
} elseif (self::METHOD_GUEST == $this->getQuote()->getCheckoutMethod()) {
$email = $address->getData('email');
if (!Zend_Validate::is($email, 'EmailAddress')) {
return array('error' => -1, 'message' => $this->_helper->__('Invalid email address "%s"', $email));
}
}
return true;
}
示例8: resetAddress
protected function resetAddress(Mage_Sales_Model_Quote_Address $address)
{
$address->setDiscountAmount(0.0);
$address->setBaseDiscountAmount(0.0);
$address->setSubtotalWithDiscount($address->getSubtotal());
$address->setBaseSubtotalWithDiscount($address->getBaseSubtotal());
$address->setDiscountDescription('');
$address->setDiscountDescriptionArray([]);
if (!$address->getData('__applied_rules_reset__')) {
$address->setAppliedRuleIds('');
$address->setData('__applied_rules_reset__', true);
}
$address->setShippingDiscountAmount(0);
$address->setBaseShippingDiscountAmount(0);
$address->setFreeShipping(false);
}
示例9: collect
/**
* Used each time when collectTotals is invoked
*
* @param Mage_Sales_Model_Quote_Address $address
* @return Your_Module_Model_Total_Custom
*/
public function collect(Mage_Sales_Model_Quote_Address $address)
{
if ($address->getData('address_type') == 'billing') {
return $this;
}
$this->_setAddress($address);
if ($ammount = $address->getQuote()->getInterest()) {
$this->_setBaseAmount($ammount);
$this->_setAmount($address->getQuote()->getStore()->convertPrice($ammount, false));
$address->setInterest($ammount);
} else {
$this->_setBaseAmount(0.0);
$this->_setAmount(0.0);
}
return $this;
}
示例10: fetch
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
$quote = $address->getQuote();
if (!Mage::getStoreConfig('tax/calculation/apply_after_discount', $quote->getStoreId())) {
return $this;
}
if (!$quote->isVirtual() && $address->getData('address_type') == 'billing') {
return $this;
}
$session = Mage::getSingleton('checkout/session');
$customer_credit_discount = $address->getCustomercreditDiscount();
if ($session->getBaseCustomerCreditAmount()) {
$customer_credit_discount = $session->getBaseCustomerCreditAmount();
}
// zend_debug::Dump($session->getBaseCustomerCreditAmount());die();
if (!$session->getHasCustomerCreditItem()) {
if ($customer_credit_discount > 0) {
$address->addTotal(array('code' => $this->getCode(), 'title' => Mage::helper('customercredit')->__('Customer Credit'), 'value' => -$customer_credit_discount));
}
}
return $this;
}
示例11: setShippingAddress
/**
* Enter description here...
*
* @param Mage_Sales_Model_Quote_Address $address
* @return Mage_Sales_Model_Quote
*/
public function setShippingAddress(Mage_Sales_Model_Quote_Address $address)
{
if ($this->getIsMultiShipping()) {
$this->addAddress($address->setAddressType(Mage_Sales_Model_Quote_Address::TYPE_SHIPPING));
} else {
$old = $this->getShippingAddress();
if (!empty($old)) {
$old->addData($address->getData());
} else {
$this->addAddress($address->setAddressType(Mage_Sales_Model_Quote_Address::TYPE_SHIPPING));
}
}
return $this;
}
示例12: _processValidateCustomer
protected function _processValidateCustomer(Mage_Sales_Model_Quote_Address $address)
{
if ($address->getTaxvat()) {
$this->getQuote()->setCustomerTaxvat($address->getTaxvat());
}
if ($this->getQuote()->getCheckoutMethod() == self::REGISTER) {
$customer = Mage::getModel('customer/customer');
$this->getQuote()->setPasswordHash($customer->encryptPassword($address->getCustomerPassword()));
$cust_data = array('email' => 'email', 'password' => 'customer_password', 'confirmation' => 'confirm_password', 'firstname' => 'firstname', 'lastname' => 'lastname', 'taxvat' => 'taxvat');
foreach ($cust_data as $key => $value) {
$customer->setData($key, $address->getData($value));
}
$val_result = $customer->validate();
if ($val_result !== true && is_array($val_result)) {
return array('message' => implode(', ', $val_result), 'error' => -1);
}
} elseif ($this->getQuote()->getCheckoutMethod() == self::GUEST) {
$email = $address->getData('email');
if (!Zend_Validate::is($email, 'EmailAddress')) {
return array('message' => $this->_help_obj->__('Invalid email address "%s"', $email), 'error' => -1);
}
}
return true;
}
示例13: fetch
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
$quote = $address->getQuote();
if (Mage::getStoreConfig('customercredit/spend/tax', $quote->getStoreId()) == 1) {
return $this;
}
if (!$quote->isVirtual() && $address->getData('address_type') == 'billing') {
return $this;
}
$session = Mage::getSingleton('checkout/session');
$customer_credit_discount = $address->getCustomercreditDiscount();
if ($session->getBaseCustomerCreditAmount()) {
$customer_credit_discount = $session->getBaseCustomerCreditAmount();
}
if ($customer_credit_discount > 0) {
$address->addTotal(array('code' => $this->getCode(), 'title' => Mage::helper('customercredit')->__('Customer Credit'), 'value' => -$customer_credit_discount));
}
return $this;
}
示例14: _copyAddress
/**
* Copy real address to the quote
*
* @param Mage_Sales_Model_Quote $quote
* @param Mage_Sales_Model_Quote_Address $realAddress
* @return Mage_Sales_Model_Quote_Address
*/
protected function _copyAddress($quote, $realAddress)
{
$address = Mage::getModel('sales/quote_address');
$address->setData($realAddress->getData());
$address->setId(null)->unsEntityId()->unsetData('cached_items_nominal')->unsetData('cached_items_nonnominal')->unsetData('cached_items_all')->setQuote($quote);
return $address;
}
示例15: _anonymizeQuoteAddress
/**
* @param Mage_Sales_Model_Quote_Address $quoteAddress
* @param array $randomData
*/
protected function _anonymizeQuoteAddress($quoteAddress, $randomData)
{
foreach ($this->_getAddressMapping() as $addressKey => $randomDataKey) {
if (!$quoteAddress->getData($addressKey)) {
continue;
}
if (strlen($randomDataKey)) {
$quoteAddress->setData($addressKey, $randomData[$randomDataKey]);
} else {
$quoteAddress->setData($addressKey, '');
}
}
$quoteAddress->getResource()->save($quoteAddress);
$this->_anonymizedQuoteAddressIds[] = $quoteAddress->getId();
}