本文整理汇总了PHP中Mage_Sales_Model_Quote_Address::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote_Address::getId方法的具体用法?PHP Mage_Sales_Model_Quote_Address::getId怎么用?PHP Mage_Sales_Model_Quote_Address::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Quote_Address
的用法示例。
在下文中一共展示了Mage_Sales_Model_Quote_Address::getId方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: collect
public function collect(Mage_Sales_Model_Quote_Address $address)
{
$active = Mage::helper('giftwrap')->enableGiftwrap();
if (!$active) {
return;
}
if (Mage::app()->getStore()->isAdmin()) {
return $this;
}
$items = $address->getAllItems();
if (!count($items)) {
return $this;
}
$address_id = $address->getId();
/*
* update of version 0.2.2
*/
$giftwrapAmount = Mage::helper('giftwrap')->giftwrapAmount(null, $address_id);
$address->setGiftwrapAmount($giftwrapAmount);
$address->setBaseGiftwrapAmount(0);
//var_dump($address->getData());die();
// if($giftwrapAmount>0){
// $taxAmount = 10;
// $address->setTaxAmount($address->getTaxAmount() + $taxAmount);
// $address->setBaseTaxAmount($address->getBaseTaxAmount() + $taxAmount);
// }
Mage::getModel('core/session')->setData('giftwrap_amount', $giftwrapAmount);
$address->setGrandTotal($address->getGrandTotal() + $address->getGiftwrapAmount());
$address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getGiftwrapAmount());
//var_dump($address->getData());die();
return $this;
}
示例3: 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);
}
if ($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;
}
示例4: _getAddressId
/**
* Return id for address
*
* @param Mage_Sales_Model_Quote_Address $address
* @return string
*/
private function _getAddressId($address)
{
if ($address instanceof Mage_Sales_Model_Quote_Address) {
return $address->getId();
}
return $address;
}
示例5: addAddress
public function addAddress(Mage_Sales_Model_Quote_Address $address)
{
$address->setQuote($this);
if (!$address->getId()) {
$this->getAddressesCollection()->addItem($address);
}
return $this;
}
示例6: _checkUseForShipping
/**
* Checks the shipping address is equal with billing address
*
* ATTENTION!!!
* It should be removed when mobile app will send just the 'use_for_shipping' flag
* instead of send shipping address same as a billing address
*
* @todo Remove when mobile app will send just the 'use_for_shipping' flag
* @param array $data
* @param Mage_Sales_Model_Quote_Address $billingAddress
* @param integer $shippingAddressId
* @return bool
*/
protected function _checkUseForShipping(array $data, $billingAddress, $shippingAddressId)
{
$useForShipping = !$shippingAddressId || $billingAddress->getId() == $shippingAddressId;
if ($useForShipping) {
foreach ($data as $key => $value) {
if ($key == 'save_in_address_book') {
continue;
}
$billingData = $billingAddress->getDataUsingMethod($key);
if (is_array($value) && is_array($billingData)) {
foreach ($value as $k => $v) {
if (!isset($billingData[$k]) || $billingData[$k] != trim($v)) {
$useForShipping = false;
break;
}
}
} else {
if (is_string($value) && $billingData != trim($value)) {
$useForShipping = false;
break;
} else {
$useForShipping = false;
break;
}
}
}
}
return $useForShipping;
}
示例7: collect
/**
* @param Mage_Sales_Model_Quote_Address $address
* @return $this|Mage_Sales_Model_Quote_Address_Total_Abstract
*/
public function collect(Mage_Sales_Model_Quote_Address $address)
{
$helper = Mage::helper('mageworx_multifees');
if ($address->getSubtotal() == 0 && floatval($address->getCustomerCreditAmount()) == 0) {
return $this;
}
if ($this->_collected) {
return $this;
}
////////////////////////////////////////////////////////////////////
$subtotalRowTOTAL = 0;
$CompanyTotal = 0;
$PersonTotal = 0;
$quote = Mage::getSingleton('checkout/cart')->getQuote();
$cartItems = $quote->getAllVisibleItems();
$userGroupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
foreach ($cartItems as $item) {
$subtotalRow = 0;
$_product = Mage::getModel('catalog/product')->load($item->getProductId());
$ids = $_product->getCategoryIds();
$productId = $item->getProductId();
$qty = $item->getQty();
$price = $item->getProduct()->getPrice();
$subtotalRow = $subtotalRow + $price * $qty;
//If the product has perception tax for persons
if (array_search("372", $ids) != false && $subtotalRow >= 100) {
$PersonTotal = $PersonTotal + $subtotalRow;
}
//If the product has perception tax for persons
if (array_search("373", $ids) != false) {
$CompanyTotal = $CompanyTotal + $subtotalRow;
}
}
//If the user is Not log in
if ($userGroupId == 0 || $userGroupId == 8) {
$subtotalRowTOTAL = $PersonTotal;
$subtotalRowTOTAL = $subtotalRowTOTAL / 1.18;
} elseif ($userGroupId == 8) {
$subtotalRowTOTAL = $CompanyTotal;
$subtotalRowTOTAL = $subtotalRowTOTAL / 1.18;
} else {
$subtotalRowTOTAL = 0;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
$baseSubtotalRow = floatval($subtotalRowTOTAL);
$baseSubtotal = floatval($address->getBaseSubtotalWithDiscount());
$baseShipping = floatval($address->getBaseShippingAmount());
// - $address->getBaseShippingTaxAmount()
$baseTax = floatval($address->getBaseTaxAmount());
//amount
$address->setMultifeesAmount(0);
$address->setBaseMultifeesAmount(0);
$address->setDetailsMultifees(null);
$quote = $address->getQuote();
$feeMessages = new Varien_Data_Collection();
// add payment fee (front and admin)
if (Mage::app()->getRequest()->getPost('is_payment_fee', false)) {
$feesPost = Mage::app()->getRequest()->getPost('fee', array());
foreach ($feesPost as $feeId => $data) {
if (isset($data['message'])) {
$obj = new Varien_Object();
$obj->setFeeId($feeId);
$obj->setMessage($data['message']);
$feeMessages->addItem($obj);
}
}
$helper->addFeesToCart($feesPost, $quote->getStoreId(), false, 2, 0);
}
// add shipping fee (front and admin)
if (Mage::app()->getRequest()->getPost('is_shipping_fee', false)) {
$feesPost = Mage::app()->getRequest()->getPost('fee', array());
foreach ($feesPost as $feeId => $data) {
if (isset($data['message'])) {
$obj = new Varien_Object();
$obj->setFeeId($feeId);
$obj->setMessage($data['message']);
$feeMessages->addItem($obj);
}
}
$helper->addFeesToCart($feesPost, $quote->getStoreId(), false, 3, 0);
}
$feesData = $helper->getQuoteDetailsMultifees($address->getId());
// autoadd default cart fees, no hidden
if (is_null($feesData) && $helper->isEnableCartFees()) {
$this->autoAddFeesByParams(1, 0, 2, 1, '', $quote, $address, $helper, null);
}
// autoadd hidden cart fees
if ($helper->isEnableCartFees()) {
$this->autoAddFeesByParams(1, 0, 1, 1, '', $quote, $address, $helper, null);
}
// autoadd hidden shipping fees
if ($helper->isEnableShippingFees() && $address->getShippingMethod()) {
$this->autoAddFeesByParams(3, 0, 1, 1, strval($address->getShippingMethod()), $quote, $address, $helper, $feeMessages);
}
// autoadd hidden fees
if ($helper->isEnablePaymentFees() && $quote->getPayment()->getMethod()) {
//.........这里部分代码省略.........
示例8: fetch
/**
* Add tax totals information to address object
*
* @param Mage_Sales_Model_Quote_Address $address
* @return Mage_Tax_Model_Sales_Total_Quote
*/
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
$config = Mage::getSingleton('tax/config');
$quote = $address->getQuote();
$store = $quote->getStore();
$amount = $address->getTaxAmount();
$fullInfo = array();
$summary = Mage::getModel('avatax/avatax_estimate')->getSummary($address->getId());
foreach ($summary as $key => $row) {
$id = 'avatax-' . $key;
$fullInfo[$id] = array('rates' => array(array('code' => $row['name'], 'title' => $row['name'], 'percent' => $row['rate'], 'position' => $key, 'priority' => $key, 'rule_id' => 0)), 'percent' => $row['rate'], 'id' => $id, 'process' => 0, 'amount' => $row['amt'], 'base_amount' => $row['amt']);
}
if ($amount != 0 || Mage::helper('tax')->displayZeroTax($store)) {
$address->addTotal(array('code' => $this->getCode(), 'title' => Mage::helper('tax')->__('Tax'), 'full_info' => $fullInfo, 'value' => $amount, 'area' => null));
}
/**
* Modify subtotal
*/
if (method_exists($config, "displayCartSubtotalBoth") && method_exists($config, "displayCartSubtotalInclTax") && ($config->displayCartSubtotalBoth($store) || $config->displayCartSubtotalInclTax($store))) {
$subtotalInclTax = $address->getSubtotal() + $address->getTaxAmount() - $address->getShippingTaxAmount();
$address->setSubtotalInclTax($subtotalInclTax);
$address->addTotal(array('code' => 'subtotal', 'title' => Mage::helper('sales')->__('Subtotal'), 'value' => $subtotalInclTax, 'value_incl_tax' => $subtotalInclTax, 'value_excl_tax' => $address->getSubtotal()));
}
return $this;
}
示例9: __construct
/**
* @param array $args Must contain key/value for:
* - ship_group => eBayEnterprise\RetailOrderManagement\Payload\TaxDutyFee\ITaxedShipGroup
* - address => Mage_Sales_Model_Quote_Address
* May contain key/value for:
* - tax_factory => EbayEnterprise_Tax_Helper_Factory
* - logger => EbayEnterprise_MageLog_Helper_Data
* - log_context => EbayEnterprise_MageLog_Helper_Context
*/
public function __construct(array $args)
{
list($this->_shipGroup, $this->_address, $this->_taxFactory, $this->_logger, $this->_logContext) = $this->_checkTypes($args['ship_group'], $args['address'], $this->_nullCoalesce($args, 'tax_factory', Mage::helper('ebayenterprise_tax/factory')), $this->_nullCoalesce($args, 'logger', Mage::helper('ebayenterprise_magelog')), $this->_nullCoalesce($args, 'log_context', Mage::helper('ebayenterprise_magelog/context')));
$this->_addressId = $this->_address->getId();
$this->_quoteId = $this->_address->getQuoteId();
}
示例10: getRates
/**
* Get rates from Avalara
*
* @param Mage_Sales_Model_Quote_Address $address
*
* @return array
*/
public function getRates(Mage_Sales_Model_Quote_Address $address)
{
if (self::$_hasError) {
return array('failure' => true);
}
/** @var OnePica_AvaTax_Model_Sales_Quote_Address $address */
$this->_lines = array();
$this->setCanSendRequest(true);
//reset flag
//set up request
$quote = $address->getQuote();
$this->_request = new GetTaxRequest();
$this->_request->setDocType(DocumentType::$SalesOrder);
$this->_request->setDocCode('quote-' . $address->getId());
$this->_addGeneralInfo($address);
$this->_setOriginAddress($quote->getStoreId());
$this->_setDestinationAddress($address);
$this->_request->setDetailLevel(DetailLevel::$Line);
$this->_addItemsInCart($address);
$this->_addShipping($address);
//Added code for calculating tax for giftwrap items
$this->_addGwOrderAmount($address);
$this->_addGwPrintedCardAmount($address);
//check to see if we can/need to make the request to Avalara
$requestKey = $this->_genRequestKey();
$makeRequest = empty($this->_rates[$requestKey]['items']);
//@startSkipCommitHooks
$makeRequest &= count($this->_lineToLineId) ? true : false;
$makeRequest &= $this->_request->getDestinationAddress() == '' ? false : true;
$makeRequest &= $address->getId() ? true : false;
$makeRequest &= !isset($this->_rates[$requestKey]['failure']);
$makeRequest &= $this->isCanSendRequest();
//@finishSkipCommitHooks
//make request if needed and save results in cache
if ($makeRequest) {
$result = $this->_send($quote->getStoreId());
$this->_rates[$requestKey] = array('timestamp' => $this->_getDateModel()->timestamp(), 'address_id' => $address->getId(), 'summary' => array(), 'items' => array(), 'gw_items' => array());
//success
/** @var GetTaxResult $result */
if ($result->getResultCode() == SeverityLevel::$Success) {
foreach ($result->getTaxLines() as $ctl) {
/** @var TaxLine $ctl */
$id = $this->_getItemIdByLine($ctl);
$code = $this->_getTaxArrayCodeByLine($ctl);
$this->_rates[$requestKey][$code][$id] = array('rate' => ($ctl->getTax() ? $ctl->getRate() : 0) * 100, 'amt' => $ctl->getTax(), 'taxable' => $ctl->getTaxable(), 'tax_included' => $ctl->getTaxIncluded());
}
$this->_rates[$requestKey]['summary'] = $this->_getSummaryFromResponse($result);
//failure
} else {
$this->_rates[$requestKey]['failure'] = true;
$this->_rates[$requestKey]['failure_details'] = $this->_getFailureDetails($result);
}
Mage::getSingleton('avatax/session')->setRates($this->_rates);
}
$rates = isset($this->_rates[$requestKey]) ? $this->_rates[$requestKey] : array();
return $rates;
}
示例11: copyAddressToOrder
/**
* Copies a given address to the order.
*
* @param Mage_Sales_Model_Order $order
* @param Mage_Sales_Model_Quote_Address $address
*
* @return $this
*
* @throws Exception
*/
public function copyAddressToOrder(Mage_Sales_Model_Order $order, Mage_Sales_Model_Quote_Address $address)
{
/**
* Convert the quote address to an order address and add it to the order.
*/
$address->load($address->getId());
$orderAddress = Mage::getModel('sales/convert_quote')->addressToOrderAddress($address);
$order->addAddress($orderAddress)->save();
/**
* This is a fix for the order address missing a parent ID.
*/
if (!$orderAddress->getParentId()) {
$orderAddress->setParentId($order->getId());
}
/**
* This is required for some PSP extensions which will not save the PakjeGemak address otherwise.
*/
$orderAddress->save();
return $this;
}