本文整理汇总了PHP中Mage_Sales_Model_Quote_Address::setData方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote_Address::setData方法的具体用法?PHP Mage_Sales_Model_Quote_Address::setData怎么用?PHP Mage_Sales_Model_Quote_Address::setData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Quote_Address
的用法示例。
在下文中一共展示了Mage_Sales_Model_Quote_Address::setData方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: collect
public function collect(Mage_Sales_Model_Quote_Address $address)
{
$session = Mage::getSingleton('checkout/session');
$discount = $session->getData('onestepcheckout_admin_discount');
if (!$discount) {
return $this;
}
$items = $address->getAllItems();
if (!count($items)) {
return $this;
}
$session->setData('onestepcheckout_admin_discount', $discount);
$address->setOnestepcheckoutDiscountAmount($discount);
$address->setData('onestepcheckout_discount_amount', $discount);
$address->setGrandTotal($address->getGrandTotal() - $address->getOnestepcheckoutDiscountAmount());
$address->setBaseGrandTotal($address->getBaseGrandTotal() - $address->getOnestepcheckoutDiscountAmount());
return $this;
}
示例2: collect
public function collect(Mage_Sales_Model_Quote_Address $address)
{
$address->setData('zitec_dpd_cashondelivery_surcharge', 0);
$address->setData('base_zitec_dpd_cashondelivery_surcharge', 0);
$address->setData('zitec_dpd_cashondelivery_surcharge_tax', 0);
$address->setData('base_zitec_dpd_cashondelivery_surcharge_tax', 0);
$paymentMethod = $address->getQuote()->getPayment()->getMethod();
if ($paymentMethod == Mage::helper('zitec_dpd')->getDpdPaymentCode() && $address->getAddressType() == 'shipping') {
$quote = $address->getQuote();
/* @var $quote Mage_Sales_Model_Quote */
$shippingAddress = $quote->getShippingAddress();
$request = new Varien_Object();
$request->setWebsiteId(Mage::helper('zitec_dpd/payment')->getWebsiteId());
$request->setDestCountryId($shippingAddress->getCountryId());
$request->setDestRegionId($shippingAddress->getRegionId());
$request->setDestPostcode($shippingAddress->getPostcode());
$request->setPackageWeight($shippingAddress->getWeight());
if ($this->_getTaxHelper()->shippingPriceIncludesTax($address->getQuote()->getStoreId())) {
$request->setData('zitec_table_price', $shippingAddress->getBaseSubtotalInclTax());
} else {
$request->setData('zitec_table_price', $shippingAddress->getBaseSubtotal());
}
$request->setMethod(str_replace(Mage::helper('zitec_dpd')->getDPDCarrierCode() . '_', '', $shippingAddress->getShippingMethod()));
$tablerateSurcharge = Mage::getResourceModel('zitec_dpd/carrier_tablerate')->getCashOnDeliverySurcharge($request);
if (is_null($tablerateSurcharge)) {
return $this;
} elseif (!empty($tablerateSurcharge)) {
$baseCashondeliverySurcharge = $this->_getHelper()->calculateQuoteBaseCashOnDeliverySurcharge($quote, $tablerateSurcharge);
} else {
$baseCashondeliverySurcharge = $this->_getHelper()->returnDefaultBaseCashOnDeliverySurcharge($quote);
}
if (!isset($baseCashondeliverySurcharge)) {
return $this;
}
$baseCurrencyCode = $quote->getStore()->getBaseCurrencyCode();
$currentCurrencyCode = $quote->getStore()->getCurrentCurrencyCode();
$cashondeliverySurcharge = Mage::helper('directory')->currencyConvert($baseCashondeliverySurcharge, $baseCurrencyCode, $currentCurrencyCode);
$address->setData('zitec_dpd_cashondelivery_surcharge', $cashondeliverySurcharge);
$address->setData('base_zitec_dpd_cashondelivery_surcharge', $baseCashondeliverySurcharge);
$this->_calculateSurchargeSalesTax($address);
$quote->save();
}
$address->setGrandTotal($address->getGrandTotal() + $address->getData('zitec_dpd_cashondelivery_surcharge'));
$address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getData('base_zitec_dpd_cashondelivery_surcharge'));
return $this;
}
示例3: collect
public function collect(Mage_Sales_Model_Quote_Address $address)
{
$store = $address->getQuote()->getStore();
$session = Mage::getSingleton('checkout/session');
$discount = $session->getData('webpos_admin_discount');
if (!$discount) {
return $this;
}
$items = $address->getAllItems();
if (!count($items)) {
return $this;
}
$session->setData('webpos_admin_discount', $discount);
$address->setWebposDiscountAmount($discount);
$address->setData('webpos_discount_amount', $discount);
/* Daniel - tax for discount */
$afterDiscount = Mage::getStoreConfig('tax/calculation/apply_after_discount');
if ($afterDiscount) {
$country = Mage::getModel('checkout/session')->getQuote()->getShippingAddress()->getCountry();
$oldTax = $address->getTaxAmount();
$oldBaseTax = $address->getBaseTaxAmount();
if ($country) {
$rateTax = Mage::getModel('tax/calculation_rate')->getCollection()->addFieldToFilter('tax_country_id', $country)->setOrder('rate', 'DESC')->getFirstItem();
$address->setTaxAmount(($address->getBaseSubtotal() - $discount + $address->getShippingAmount() + $address->getDiscountAmount()) * $rateTax->getRate() / 100)->setBaseTaxAmount(($address->getBaseSubtotal() - $discount + $address->getShippingAmount() + $address->getDiscountAmount()) * $rateTax->getRate() / 100);
$taxCalculationModel = Mage::getSingleton('tax/calculation');
$request = Mage::getSingleton('tax/calculation')->getRateRequest($address, $address->getQuote()->getBillingAddress(), $address->getQuote()->getCustomerTaxClassId(), $store);
$rate = Mage::getSingleton('tax/calculation')->getRate($request);
$this->_saveAppliedTaxes($address, $taxCalculationModel->getAppliedRates($request), $address->getTaxAmount(), $address->getBaseTaxAmount(), $rate);
}
$address->setGrandTotal($address->getGrandTotal() - $address->getWebposDiscountAmount());
$address->setBaseGrandTotal($address->getBaseGrandTotal() - $address->getWebposDiscountAmount());
} else {
$address->setGrandTotal($address->getGrandTotal() - $address->getWebposDiscountAmount());
$address->setBaseGrandTotal($address->getBaseGrandTotal() - $address->getWebposDiscountAmount());
}
/* end */
return $this;
}
示例4: 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);
}
示例5: _country
/**
* @param Mage_Sales_Model_Quote_Address $address
*/
protected function _country(&$address)
{
$_country = Mage::app()->getLocale()->getCountryTranslation($address->getData("country_id"));
$address->setData("country", $_country);
}
示例6: _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();
}