本文整理汇总了PHP中Mage_Sales_Model_Quote_Address::getAllItems方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote_Address::getAllItems方法的具体用法?PHP Mage_Sales_Model_Quote_Address::getAllItems怎么用?PHP Mage_Sales_Model_Quote_Address::getAllItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Quote_Address
的用法示例。
在下文中一共展示了Mage_Sales_Model_Quote_Address::getAllItems方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: collect
public function collect(Mage_Sales_Model_Quote_Address $address)
{
$address->setPaymentCharge(0);
$address->setBasePaymentCharge(0);
$items = $address->getAllItems();
if (!count($items)) {
return $this;
}
$paymentMethod = $address->getQuote()->getPayment()->getMethod();
if (Mage::getStoreConfig('tax/calculation/price_includes_tax') != 1) {
$tax = $address->getTaxAmount();
}
if ($paymentMethod) {
$amount1 = Mage::helper('paymentcharge')->getPaymentCharge($paymentMethod, $address->getQuote());
$amount = Mage::helper('directory')->currencyConvert($amount1, Mage::app()->getWebsite()->getConfig('currency/options/default'), Mage::app()->getStore()->getCurrentCurrencyCode());
// if(Mage::getStoreConfig('payment/paypal_payment_solutions/charge_type')!="percentage"){
$address->setPaymentCharge($amount);
$address->setBasePaymentCharge($amount1);
/* } else {
$address->setPaymentCharge($amount);
$subTotal = $address->getBaseSubtotal();
$amount12 = ($subTotal+ $tax) * floatval(Mage::getStoreConfig('payment/paypal_payment_solutions/charge_value')) / 100;
$address->setBasePaymentCharge($amount12);
}*/
}
$address->setGrandTotal($address->getGrandTotal() + $tax + $address->getPaymentCharge());
$address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getBasePaymentCharge());
return $this;
}
示例2: collect
public function collect(Mage_Sales_Model_Quote_Address $address)
{
$_helper = Mage::helper('webpos');
$active = $_helper->enableGiftWrap();
if (!$active) {
return;
}
$session = Mage::getSingleton('checkout/session');
$giftwrap = $session->getData('webpos_giftwrap');
if (!$giftwrap) {
return $this;
}
$items = $address->getAllItems();
if (!count($items)) {
return $this;
}
$giftwrapType = $_helper->getGiftwrapType();
$giftwrapAmount = $_helper->getGiftwrapAmount();
$wrapTotal = 0;
if ($giftwrapType == 1) {
foreach ($items as $item) {
if ($item->getProduct()->isVirtual() || $item->getParentItem()) {
continue;
}
$wrapTotal += $giftwrapAmount * $item->getQty();
}
} else {
$wrapTotal = $giftwrapAmount;
}
$session->setData('webpos_giftwrap_amount', $wrapTotal);
$address->setWebposGiftwrapAmount($wrapTotal);
$address->setGrandTotal($address->getGrandTotal() + $address->getWebposGiftwrapAmount());
$address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getWebposGiftwrapAmount());
return $this;
}
示例3: collect
public function collect(Mage_Sales_Model_Quote_Address $address)
{
$totalWeeeTax = 0;
$baseTotalWeeeTax = 0;
$items = $address->getAllItems();
if (!count($items)) {
return $this;
}
foreach ($items as $item) {
if ($item->getParentItemId()) {
continue;
}
$this->_resetItemData($item);
if ($item->getHasChildren() && $item->isChildrenCalculated()) {
foreach ($item->getChildren() as $child) {
$this->_resetItemData($child);
$this->_processItem($address, $child, true);
$totalWeeeTax += $child->getWeeeTaxAppliedRowAmount();
$baseTotalWeeeTax += $child->getBaseWeeeTaxAppliedRowAmount();
}
} else {
$this->_processItem($address, $item);
$totalWeeeTax += $item->getWeeeTaxAppliedRowAmount();
$baseTotalWeeeTax += $item->getBaseWeeeTaxAppliedRowAmount();
}
}
$address->setGrandTotal($address->getGrandTotal() + $totalWeeeTax);
$address->setBaseGrandTotal($address->getBaseGrandTotal() + $baseTotalWeeeTax);
return $this;
}
示例4: _validateAddressIsShipGroup
/**
* Determine if the addres is a valid ship group.
*
* @return bool
*/
protected function _validateAddressIsShipGroup()
{
// This assume that the address is in a valid state to be
// included and does not check for individual data constraints
// to be met.
return (bool) count($this->_address->getAllItems());
}
示例5: 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;
}
示例6: collect
public function collect(Mage_Sales_Model_Quote_Address $address)
{
foreach ($address->getAllItems() as $item) {
Mage::getSingleton('rewards/redeem')->refactorRedemptions($item, false);
}
return parent::collect($address);
}
示例7: 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)
{
/**
* Reset subtotal information
*/
$address->setSubtotal(0);
$address->setBaseSubtotal(0);
$address->setTotalQty(0);
$address->setBaseTotalPriceIncTax(0);
/**
* Process address items
*/
$items = $address->getAllItems();
foreach ($items as $item) {
if (!$this->_initItem($address, $item) || $item->getQty() <= 0) {
$this->_removeItem($address, $item);
}
}
/**
* Initialize grand totals
*/
$address->setGrandTotal($address->getSubtotal());
$address->setBaseGrandTotal($address->getBaseSubtotal());
AO::helper('sales')->checkQuoteAmount($address->getQuote(), $address->getSubtotal());
AO::helper('sales')->checkQuoteAmount($address->getQuote(), $address->getBaseSubtotal());
return $this;
}
示例8: _getItemForItemPayload
/**
* Get the address item the item payload represents.
*
* @param ITaxedOrderItem
* @return Mage_Sales_Model_Quote_Address_Item|null
*/
protected function _getItemForItemPayload(ITaxedOrderItem $itemPayload)
{
foreach ($this->_address->getAllItems() as $item) {
if ($item->getId() === $itemPayload->getLineNumber()) {
return $item;
}
}
return null;
}
示例9: 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;
}
示例10: _totalBaseCalculation
/**
* Calculate address total tax based on address subtotal
*
* @param Mage_Sales_Model_Quote_Address $address
* @param Varien_Object $taxRateRequest
* @return Mage_Tax_Model_Sales_Total_Quote
*/
protected function _totalBaseCalculation(Mage_Sales_Model_Quote_Address $address, $taxRateRequest)
{
$items = $address->getAllItems();
$store = $address->getQuote()->getStore();
$taxGroups = array();
$inclTax = false;
foreach ($items as $item) {
if ($item->getParentItemId()) {
continue;
}
if ($item->getHasChildren() && $item->isChildrenCalculated()) {
foreach ($item->getChildren() as $child) {
$taxRateRequest->setProductClassId($child->getProduct()->getTaxClassId());
$rate = $this->_calculator->getRate($taxRateRequest);
$taxGroups[(string) $rate]['applied_rates'] = $this->_calculator->getAppliedRates($taxRateRequest);
$this->_aggregateTaxPerRate($child, $rate, $taxGroups);
$this->_getAddress()->addTotalAmount('hidden_tax', $child->getHiddenTaxAmount());
$this->_getAddress()->addBaseTotalAmount('hidden_tax', $child->getBaseHiddenTaxAmount());
$inclTax = $child->getIsPriceInclTax();
}
$this->_recalculateParent($item);
} else {
$taxRateRequest->setProductClassId($item->getProduct()->getTaxClassId());
$rate = $this->_calculator->getRate($taxRateRequest);
$taxGroups[(string) $rate]['applied_rates'] = $this->_calculator->getAppliedRates($taxRateRequest);
$this->_aggregateTaxPerRate($item, $rate, $taxGroups);
$this->_getAddress()->addTotalAmount('hidden_tax', $item->getHiddenTaxAmount());
$this->_getAddress()->addBaseTotalAmount('hidden_tax', $item->getBaseHiddenTaxAmount());
$inclTax = $item->getIsPriceInclTax();
}
}
foreach ($taxGroups as $rateKey => $data) {
$rate = (double) $rateKey;
$totalTax = $this->_calculator->calcTaxAmount(array_sum($data['totals']), $rate, $inclTax);
$baseTotalTax = $this->_calculator->calcTaxAmount(array_sum($data['base_totals']), $rate, $inclTax);
$totalRewardPointDiscount = $baseTotalRewardPointDiscount = Mage::getSingleton('checkout/session')->getCredit();
$totalRewardPointDiscount = $this->_calculator->calcTaxAmount($totalRewardPointDiscount, $rate, $inclTax);
$baseTotalRewardPointDiscount = $this->_calculator->calcTaxAmount($baseTotalRewardPointDiscount, $rate, $inclTax);
if ($totalRewardPointDiscount > $totalTax) {
$totalRewardPointDiscount = $totalTax;
}
if ($baseTotalRewardPointDiscount > $baseTotalTax) {
$baseTotalRewardPointDiscount = $baseTotalTax;
}
$this->_addAmount($totalTax - $totalRewardPointDiscount);
$this->_addBaseAmount($baseTotalTax - $baseTotalRewardPointDiscount);
$this->_saveAppliedTaxes($address, $data['applied_rates'], $totalTax, $baseTotalTax, $rate);
}
return $this;
}
示例11: collect
public function collect(Mage_Sales_Model_Quote_Address $address)
{
$address->setPaymentCharge(0);
$address->setBasePaymentCharge(0);
$storeId = Mage::app()->getStore()->getId();
$items = $address->getAllItems();
if (!count($items)) {
return $this;
}
$paymentMethod = $address->getQuote()->getPayment()->getMethod();
$quote = $address->getQuote();
if ($paymentMethod && substr($paymentMethod, 0, 11) == 'pay_payment') {
$baseAmount = Mage::helper('pay_payment')->getPaymentCharge($paymentMethod, $address->getQuote());
$amount = Mage::helper('directory')->currencyConvert($baseAmount, Mage::app()->getWebsite()->getConfig('currency/options/default'), Mage::app()->getStore()->getCurrentCurrencyCode());
$address->setPaymentCharge($amount);
$address->setBasePaymentCharge($baseAmount);
$taxClass = Mage::helper('pay_payment')->getPaymentChargeTaxClass($paymentMethod);
$taxCalculationModel = Mage::getSingleton('tax/calculation');
$request = $taxCalculationModel->getRateRequest($quote->getShippingAddress(), $quote->getBillingAddress(), null, $storeId);
$request->setStore(Mage::app()->getStore());
$rate = $taxCalculationModel->getRate($request->setProductClassId($taxClass));
//$rate = 21;
if ($rate > 0) {
// $includesTax = Mage::getStoreConfig('tax/calculation/price_includes_tax');
$baseChargeTax = round($address->getBasePaymentCharge() / (1 + $rate / 100) * ($rate / 100), 2);
$chargeTax = round($address->getPaymentCharge() / (1 + $rate / 100) * ($rate / 100), 2);
} else {
$baseChargeTax = 0;
$chargeTax = 0;
}
$rates = array();
$applied = false;
foreach ($address->getAppliedTaxes() as $arrRate) {
// maximaal 1 keer de btw voor de extra kosten toevoegen
if ($arrRate['percent'] == $rate && !$applied) {
$applied = true;
$arrRate['amount'] = $arrRate['amount'] + $chargeTax;
$arrRate['base_amount'] = $arrRate['base_amount'] + $baseChargeTax;
}
$rates[] = $arrRate;
}
$address->setAppliedTaxes($rates);
$address->setBaseTaxAmount($address->getBaseTaxAmount() + $baseChargeTax);
$address->setTaxAmount($address->getTaxAmount() + $chargeTax);
$address->setGrandTotal($address->getGrandTotal() + $address->getPaymentCharge());
$address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getBasePaymentCharge());
}
return $this;
}
示例12: collect
public function collect(Mage_Sales_Model_Quote_Address $address)
{
$_helper = Mage::helper('onestepcheckout');
$active = $_helper->enableGiftWrap();
if (!$active) {
return;
}
$session = Mage::getSingleton('checkout/session');
$giftwrap = $session->getData('onestepcheckout_giftwrap');
if (!$giftwrap) {
return $this;
}
$items = $address->getAllItems();
if (!count($items)) {
return $this;
}
$giftwrapType = $_helper->getGiftwrapType();
$giftwrapAmount = $_helper->getGiftwrapAmount();
$wrapTotal = 0;
if ($giftwrapType == 1) {
foreach ($items as $item) {
if ($item->getProduct()->isVirtual() || $item->getParentItem()) {
continue;
}
// if ($item->getHasChildren() && $item->isShipSeparately()) {
// foreach ($item->getChildren() as $child) {
// if ($child->getFreeShipping() && !$child->getProduct()->isVirtual()) {
// $freeBoxes += $item->getQty() * $child->getQty();
// }
// elseif ($item->getFreeShipping()) {
// $freeBoxes += $item->getQty();
// }
// }
// }
$wrapTotal += $giftwrapAmount * $item->getQty();
}
} else {
$wrapTotal = $giftwrapAmount;
}
// var_dump($wrapTotal);
// $giftwrapAmount = Mage::helper('giftwrap')->giftwrapAmount(null,$address_id);
$session->setData('onestepcheckout_giftwrap_amount', $wrapTotal);
$address->setOnestepcheckoutGiftwrapAmount($wrapTotal);
$address->setGrandTotal($address->getGrandTotal() + $address->getOnestepcheckoutGiftwrapAmount());
$address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getOnestepcheckoutGiftwrapAmount());
return $this;
}
示例13: collect
public function collect(Mage_Sales_Model_Quote_Address $address)
{
$paymentMethod = Mage::app()->getFrontController()->getRequest()->getParam('payment');
$paymentMethod = Mage::app()->getStore()->isAdmin() && isset($paymentMethod['method']) ? $paymentMethod['method'] : null;
if ($paymentMethod != 'cashondelivery' && (!count($address->getQuote()->getPaymentsCollection()) || !$address->getQuote()->getPayment()->hasMethodInstance())) {
return $this;
}
$paymentMethod = $address->getQuote()->getPayment()->getMethodInstance();
if ($paymentMethod->getCode() != 'cashondelivery') {
return $this;
}
$store = $address->getQuote()->getStore();
$items = $address->getAllItems();
if (!count($items)) {
return $this;
}
$custTaxClassId = $address->getQuote()->getCustomerTaxClassId();
$taxCalculationModel = Mage::getSingleton('tax/calculation');
/* @var $taxCalculationModel Mage_Tax_Model_Calculation */
$request = $taxCalculationModel->getRateRequest($address, $address->getQuote()->getBillingAddress(), $custTaxClassId, $store);
$codTaxClass = Mage::helper('cashondelivery')->getCodTaxClass($store);
$codTax = 0;
$codBaseTax = 0;
if ($codTaxClass) {
if ($rate = $taxCalculationModel->getRate($request->setProductClassId($codTaxClass))) {
if (!Mage::helper('cashondelivery')->codPriceIncludesTax()) {
$codTax = $address->getCodFee() * $rate / 100;
$codBaseTax = $address->getBaseCodFee() * $rate / 100;
} else {
$codTax = $address->getCodTaxAmount();
$codBaseTax = $address->getBaseCodTaxAmount();
}
$codTax = $store->roundPrice($codTax);
$codBaseTax = $store->roundPrice($codBaseTax);
$address->setTaxAmount($address->getTaxAmount() + $codTax);
$address->setBaseTaxAmount($address->getBaseTaxAmount() + $codBaseTax);
$this->_saveAppliedTaxes($address, $taxCalculationModel->getAppliedRates($request), $codTax, $codBaseTax, $rate);
}
}
if (!Mage::helper('cashondelivery')->codPriceIncludesTax()) {
$address->setCodTaxAmount($codTax);
$address->setBaseCodTaxAmount($codBaseTax);
}
$address->setGrandTotal($address->getGrandTotal() + $address->getCodTaxAmount());
$address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getBaseCodTaxAmount());
return $this;
}
示例14: collect
public function collect(Mage_Sales_Model_Quote_Address $address)
{
//parent::collect($address);
$collection = $address->getQuote()->getPaymentsCollection();
if ($collection->count() <= 0 || $address->getQuote()->getPayment()->getMethod() == null) {
return $this;
}
$paymentMethod = $address->getQuote()->getPayment()->getMethodInstance();
if ($paymentMethod->getCode() != 'billmateinvoice') {
return $this;
}
$store = $address->getQuote()->getStore();
$items = $address->getAllItems();
if (!count($items)) {
return $this;
}
$custTaxClassId = $address->getQuote()->getCustomerTaxClassId();
$taxCalculationModel = Mage::getSingleton('tax/calculation');
/* @var $taxCalculationModel Mage_Tax_Model_Calculation */
$request = $taxCalculationModel->getRateRequest($address, $address->getQuote()->getBillingAddress(), $custTaxClassId, $store);
$InvoiceTaxClass = Mage::helper('billmateinvoice')->getInvoiceTaxClass($store);
$InvoiceTax = 0;
$InvoiceBaseTax = 0;
if ($InvoiceTaxClass) {
if ($rate = $taxCalculationModel->getRate($request->setProductClassId($InvoiceTaxClass))) {
if (!Mage::helper('billmateinvoice')->InvoicePriceIncludesTax()) {
$InvoiceTax = $address->getFeeAmount() * $rate / 100;
$InvoiceBaseTax = $address->getBaseFeeAmount() * $rate / 100;
} else {
$InvoiceTax = $address->getPaymentTaxAmount();
$InvoiceBaseTax = $address->getBasePaymentTaxAmount();
}
$InvoiceTax = $store->roundPrice($InvoiceTax);
$InvoiceBaseTax = $store->roundPrice($InvoiceBaseTax);
$address->setTaxAmount($address->getTaxAmount() + $InvoiceTax);
$address->setBaseTaxAmount($address->getBaseTaxAmount() + $InvoiceBaseTax);
$this->_saveAppliedTaxes($address, $taxCalculationModel->getAppliedRates($request), $InvoiceTax, $InvoiceBaseTax, $rate);
}
}
if (!Mage::helper('billmateinvoice')->InvoicePriceIncludesTax()) {
$address->setInvoiceTaxAmount($InvoiceTax);
$address->setBaseInvoiceTaxAmount($InvoiceBaseTax);
}
$address->setGrandTotal($address->getGrandTotal() + $address->getPaymentTaxAmount());
$address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getBasePaymentTaxAmount());
return $this;
}
示例15: 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)
{
$address->setSubtotal(0);
$address->setBaseSubtotal(0);
$address->setTotalQty(0);
$items = $address->getAllItems();
if (count($items)) {
foreach ($items as $item) {
if (!$this->_initItem($address, $item) || $item->getQty() <= 0) {
$this->_removeItem($address, $item);
}
}
}
$address->setGrandTotal($address->getSubtotal());
$address->setBaseGrandTotal($address->getBaseSubtotal());
return $this;
}