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


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怎么用?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;
 }
开发者ID:technomagegithub,项目名称:colb2b,代码行数:18,代码来源:Discount.php

示例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;
 }
开发者ID:GabrielCC,项目名称:zitec-dpd-master,代码行数:46,代码来源:Cashondeliverysurchage.php

示例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;
 }
开发者ID:cabrerabywaters,项目名称:magentoSunshine,代码行数:38,代码来源:Discount.php

示例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);
 }
开发者ID:aoepeople,项目名称:aoe_salesrule,代码行数:16,代码来源:Discount.php

示例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);
 }
开发者ID:sereban,项目名称:magento-marketo-integration,代码行数:8,代码来源:BillingAddress.php

示例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();
 }
开发者ID:buro71a,项目名称:Anonymizer,代码行数:19,代码来源:Anonymizer.php


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