本文整理汇总了PHP中Mage_Sales_Model_Quote_Address::getAddressType方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote_Address::getAddressType方法的具体用法?PHP Mage_Sales_Model_Quote_Address::getAddressType怎么用?PHP Mage_Sales_Model_Quote_Address::getAddressType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Quote_Address
的用法示例。
在下文中一共展示了Mage_Sales_Model_Quote_Address::getAddressType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: collect
/**
* @param Mage_Sales_Model_Quote_Address $address
* @return Mage_Sales_Model_Quote_Address_Total_Abstract
*/
public function collect(Mage_Sales_Model_Quote_Address $address)
{
$quote = $address->getQuote();
$payment = $quote->getPayment();
if ($address->getAddressType() === 'billing') {
return $this;
}
$configId = $payment->getPayoneConfigPaymentMethodId();
if (empty($configId)) {
return $this;
}
$config = $this->helperConfig()->getConfigPaymentMethodById($configId, $quote->getStoreId());
if (empty($config)) {
return $this;
}
$feeConfig = $config->getFeeConfigForQuote($quote);
if (!is_array($feeConfig) or !array_key_exists('fee_config', $feeConfig)) {
return $this;
}
$paymentFee = $feeConfig['fee_config'];
$oldShippingAmount = $address->getBaseShippingAmount();
$newShippingAmount = $oldShippingAmount + $paymentFee;
$address->setBaseShippingAmount($newShippingAmount);
$address->setShippingAmount($quote->getStore()->convertPrice($newShippingAmount, false));
return parent::collect($address);
}
示例2: collect
/**
* Prepare Data to Storage for Order
*
* @param Mage_Sales_Model_Quote_Address $address
* @return Magestore_Webpos_Model_Total_Quote_Cash
*/
public function collect(Mage_Sales_Model_Quote_Address $address)
{
$quote = $address->getQuote();
$cashin = Mage::getSingleton('webpos/session')->getWebposCash();
if ($cashin && $cashin <= 0) {
return $this;
}
$baseCashin = $cashin / $quote->getStore()->convertPrice(1);
$quote->setWebposCash($cashin);
$quote->setWebposBaseCash($baseCashin);
if (!$quote->isVirtual() && $address->getAddressType() == 'billing') {
return $this;
}
$address->setWebposCash($quote->getWebposCash())->setWebposBaseCash($quote->getWebposBaseCash());
/*
$address->setTotalPaid($quote->getWebposCash())
->setBaseTotalPaid($quote->getWebposBaseCash());
*/
if ($quote->getWebposCash() >= $address->getGrandTotal()) {
/*
$address->setTotalRefunded($quote->getWebposCash() - $address->getGrandTotal())
->setBaseTotalRefunded($quote->getWebposBaseCash() - $address->getBaseGrandTotal());
if ($payment = $quote->getPayment()) {
if ($method = $payment->getMethodInstance()) {
$address->setTotalPaid($address->getTotalRefunded())
->setBaseTotalPaid($address->getBaseTotalRefunded());
}
}
*/
} else {
//$address->setGrandTotal($address->getGrandTotal() - $quote->getWebposCash() );
//$address->setBaseGrandTotal($address->getBaseGrandTotal() - $quote->getWebposBaseCash());
}
return $this;
}
示例3: collect
/**
* Collect the order total
*
* @param object $address The address instance to collect from
*
* @return Sisow_Model_Quote_TaxTotal
*/
public function collect(Mage_Sales_Model_Quote_Address $address)
{
$quote = $address->getQuote();
if ($quote->getId() == null || $address->getAddressType() != "shipping") {
return $this;
}
$payment = $quote->getPayment();
if (substr($payment->getMethod(), 0, 6) != 'sisow_' && (!count($quote->getPaymentsCollection()) || !$payment->hasMethodInstance())) {
return $this;
}
$methodInstance = $payment->getMethodInstance();
if (substr($methodInstance->getCode(), 0, 6) != 'sisow_') {
return $this;
}
$helper = Mage::helper('sisow/paymentfee');
$fee = $helper->getPaymentFeeArray($methodInstance->getCode(), $quote);
if (!is_array($fee)) {
return $this;
}
$address->setTaxAmount($address->getTaxAmount() + $fee['taxamount']);
$address->setBaseTaxAmount($address->getBaseTaxAmount() + $fee['base_taxamount']);
$address->setInvoiceTaxAmount($fee['taxamount']);
$address->setBaseInvoiceTaxAmount($fee['base_taxamount']);
return $this;
}
示例4: 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;
}
示例5: collect
/**
* Prepare Data to Storage for Order
*
* @param Mage_Sales_Model_Quote_Address $address
* @return Magestore_Webpos_Model_Total_Quote_Cash
*/
public function collect(Mage_Sales_Model_Quote_Address $address)
{
$quote = $address->getQuote();
//Mage::getSingleton('webpos/session')->setWebposCash(null);
$cashin = Mage::getSingleton('webpos/session')->getWebposCash();
$baseCashin = $cashin / $quote->getStore()->convertPrice(1);
$quote->setWebposCash($cashin);
$quote->setWebposBaseCash($baseCashin);
if (!$quote->isVirtual() && $address->getAddressType() == 'billing') {
return $this;
}
if ($quote->getWebposCash() < 0.0001) {
return $this;
}
// Order Cash
$address->setWebposCash($quote->getWebposCash())->setWebposBaseCash($quote->getWebposBaseCash());
// Update total Paid and Refund
$address->setTotalPaid($quote->getWebposCash())->setBaseTotalPaid($quote->getWebposBaseCash());
if ($quote->getWebposCash() >= $address->getGrandTotal()) {
$address->setTotalRefunded($quote->getWebposCash() - $address->getGrandTotal())->setBaseTotalRefunded($quote->getWebposBaseCash() - $address->getBaseGrandTotal());
if ($payment = $quote->getPayment()) {
if ($method = $payment->getMethodInstance()) {
if ($method->getCode() == 'cashforpos') {
// prepair for cashin invoice
$address->setTotalPaid($address->getTotalRefunded())->setBaseTotalPaid($address->getBaseTotalRefunded());
}
}
}
}
return $this;
}
示例6: addressToOrderAddress
/**
* Convert quote address to order address
*
* @param Mage_Sales_Model_Quote_Address $address
* @return Mage_Sales_Model_Order_Address
*/
public function addressToOrderAddress(Mage_Sales_Model_Quote_Address $address)
{
$orderAddress = Mage::getModel('Mage_Sales_Model_Order_Address')->setStoreId($address->getStoreId())->setAddressType($address->getAddressType())->setCustomerId($address->getCustomerId())->setCustomerAddressId($address->getCustomerAddressId());
Mage::helper('Mage_Core_Helper_Data')->copyFieldset('sales_convert_quote_address', 'to_order_address', $address, $orderAddress);
Mage::dispatchEvent('sales_convert_quote_address_to_order_address', array('address' => $address, 'order_address' => $orderAddress));
return $orderAddress;
}
示例7: fetch
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
if ($address->getAddressType() == Mage_Sales_Model_Quote_Address::TYPE_SHIPPING) {
return $this;
}
$address->addTotal(array('code' => $this->getCode(), 'title' => Mage::helper('sales')->__('Points Earned')));
return $this;
}
示例8: fetch
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
// Only display for the shipping address quote
if ($address->getAddressType() == Mage_Sales_Model_Quote_Address::TYPE_BILLING) {
return true;
}
$address->addTotal(array('code' => $this->getCode(), 'title' => Mage::helper('sales')->__('Points Earned')));
return $this;
}
示例9: fetch
/**
* Triggers AFTER collection methods, only when Magento is trying to show the total amount.
* @see Mage_Sales_Model_Quote_Address_Total_Abstract::fetch()
*/
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
if ($address->getAddressType() == Mage_Sales_Model_Quote_Address::TYPE_SHIPPING) {
return $this;
}
if ($this->discount_amt != 0) {
$address->addTotal(array('code' => $this->getCode(), 'title' => Mage::helper('sales')->__('Item Discounts'), 'value' => $this->discount_amt));
}
return $this;
}
示例10: fetch
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
if ($address->getAddressType() == 'billing') {
return $this;
}
if (Mage::helper('customfee')->canApply()) {
$amount = $this->getFeeAmount($address->getSubtotal());
$address->addTotal(array('code' => $this->getCode(), 'title' => $this->getLabel(), 'value' => $amount));
}
return $this;
}
示例11: collect
/**
* Collect address subtotal
*
* @param Mage_Sales_Model_Quote_Address $address
* @return Mage_Sales_Model_Quote_Address_Total_Subtotal
*/
public function collect(Mage_Sales_Model_Quote_Address $address)
{
if ($address->getAddressType() == 'billing') {
return $this;
}
$juros = Mage::getSingleton('checkout/session')->getJuros();
$address->setBaseJurosAmount($juros);
$address->setJurosAmount($juros);
$address->setBaseTotalAmount($this->getCode(), $juros);
$address->setTotalAmount($this->getCode(), $juros);
return $this;
}
示例12: collect
/**
* Collect the Buckaroo fee for the given address.
*
* @param Mage_Sales_Model_Quote_Address $address
*
* @return $this
*/
public function collect(Mage_Sales_Model_Quote_Address $address)
{
/**
* We can only add the fee to the shipping address.
*/
if ($address->getAddressType() != 'shipping') {
return $this;
}
$quote = $address->getQuote();
$store = $quote->getStore();
if (!$quote->getId()) {
return $this;
}
$items = $address->getAllItems();
if (!count($items)) {
return $this;
}
/**
* First, reset the fee amounts to 0 for this address and the quote.
*/
$address->setBuckarooFee(0)->setBaseBuckarooFee(0);
$quote->setBuckarooFee(0)->setBaseBuckarooFee(0);
/**
* Check if the order was placed using Buckaroo
*/
$paymentMethod = $quote->getPayment()->getMethod();
if (strpos($paymentMethod, 'buckaroo') === false) {
return $this;
}
/**
* Get the fee amount.
*/
$baseFee = $this->_getPaymentFee($quote, $paymentMethod);
if ($baseFee <= 0) {
return $this;
}
/**
* Convert the fee to the base fee amount.
*/
$fee = $store->convertPrice($baseFee);
/**
* Set the fee for the address and quote.
*/
$address->setBuckarooFee($fee)->setBaseBuckarooFee($baseFee);
$quote->setBuckarooFee($fee)->setBaseBuckarooFee($baseFee);
/**
* Update the address' grand total amounts.
*/
$address->setBaseGrandTotal($address->getBaseGrandTotal() + $baseFee);
$address->setGrandTotal($address->getGrandTotal() + $fee);
return $this;
}
示例13: fetch
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
if ($address->getAddressType() != "shipping") {
return $this;
}
$incl = $address->getInvoiceFee();
$data = Mage::helper("billmateinvoice");
if ($incl == 0) {
return $this;
}
$address->addTotal(array('code' => $this->getCode(), 'title' => Mage::helper('payment')->__('Billmate Invoice Fee'), 'value' => $incl));
return $this;
}
示例14: fetch
/**
* Add giftcard totals information to address object
*
* @param Mage_Sales_Model_Quote_Address $address
*/
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
if ($address->getAddressType() == 'billing') {
//$amount = $address->getReferralrewardAmount();
$helper = Mage::helper('referralreward');
$points = (int) Mage::getSingleton('core/session')->getPointsDiscount();
$amount = -1 * $helper->convertPoints($points);
if ($amount != 0) {
$address->addTotal(array('code' => $this->getCode(), 'title' => $this->getLabel(), 'value' => $amount));
}
}
return $this;
}
示例15: fetch
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
//file_put_contents('test1.log', file_get_contents('test1.log') . '->'.$address->getAmount());
$amount = $address->getAmount();
if ($address->getAddressType() == Mage_Sales_Model_Quote_Address::TYPE_BILLING) {
return;
}
if ($amount > 0) {
$title = Mage::helper('vc_giftwrap')->__('Gift Wrap');
$address->addTotal(array('code' => $this->getCode(), 'title' => $title, 'value' => $amount));
}
return $this;
}