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


PHP Mage_Core_Model_Store::convertPrice方法代码示例

本文整理汇总了PHP中Mage_Core_Model_Store::convertPrice方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Store::convertPrice方法的具体用法?PHP Mage_Core_Model_Store::convertPrice怎么用?PHP Mage_Core_Model_Store::convertPrice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Core_Model_Store的用法示例。


在下文中一共展示了Mage_Core_Model_Store::convertPrice方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _process

 /**
  * Calculate item fixed tax and prepare information for discount and recular taxation
  *
  * @param   Mage_Sales_Model_Quote_Address $address
  * @param   Mage_Sales_Model_Quote_Item_Abstract $item
  * @return  Mage_Weee_Model_Total_Quote_Weee
  */
 protected function _process(Mage_Sales_Model_Quote_Address $address, $item)
 {
     if (!$this->_helper->isEnabled($this->_store)) {
         return $this;
     }
     $attributes = $this->_helper->getProductWeeeAttributes($item->getProduct(), $address, $address->getQuote()->getBillingAddress(), $this->_store->getWebsiteId());
     $applied = array();
     $productTaxes = array();
     $totalValue = 0;
     $baseTotalValue = 0;
     $totalRowValue = 0;
     $baseTotalRowValue = 0;
     foreach ($attributes as $k => $attribute) {
         $baseValue = $attribute->getAmount();
         $value = $this->_store->convertPrice($baseValue);
         $rowValue = $value * $item->getTotalQty();
         $baseRowValue = $baseValue * $item->getTotalQty();
         $title = $attribute->getName();
         $totalValue += $value;
         $baseTotalValue += $baseValue;
         $totalRowValue += $rowValue;
         $baseTotalRowValue += $baseRowValue;
         $productTaxes[] = array('title' => $title, 'base_amount' => $baseValue, 'amount' => $value, 'row_amount' => $rowValue, 'base_row_amount' => $baseRowValue, 'base_amount_incl_tax' => $baseValue, 'amount_incl_tax' => $value, 'row_amount_incl_tax' => $rowValue, 'base_row_amount_incl_tax' => $baseRowValue);
         $applied[] = array('id' => $attribute->getCode(), 'percent' => null, 'hidden' => $this->_helper->includeInSubtotal($this->_store), 'rates' => array(array('base_real_amount' => $baseRowValue, 'base_amount' => $baseRowValue, 'amount' => $rowValue, 'code' => $attribute->getCode(), 'title' => $title, 'percent' => null, 'position' => 1, 'priority' => -1000 + $k)));
     }
     $item->setWeeeTaxAppliedAmount($totalValue)->setBaseWeeeTaxAppliedAmount($baseTotalValue)->setWeeeTaxAppliedRowAmount($totalRowValue)->setBaseWeeeTaxAppliedRowAmount($baseTotalRowValue);
     $this->_processTaxSettings($item, $totalValue, $baseTotalValue, $totalRowValue, $baseTotalRowValue)->_processTotalAmount($address, $totalRowValue, $baseTotalRowValue);
     $this->_helper->setApplied($item, array_merge($this->_helper->getApplied($item), $productTaxes));
     if ($applied) {
         $this->_saveAppliedTaxes($address, $applied, $item->getWeeeTaxAppliedAmount(), $item->getBaseWeeeTaxAppliedAmount(), null);
     }
 }
开发者ID:blazeriaz,项目名称:youguess,代码行数:39,代码来源:Weee.php

示例2: _process

 /**
  * Calculate item fixed tax and prepare information for discount and recular taxation
  *
  * @param   Mage_Sales_Model_Quote_Address $address
  * @param   Mage_Sales_Model_Quote_Item_Abstract $item
  * @return  Mage_Weee_Model_Total_Quote_Weee
  */
 protected function _process(Mage_Sales_Model_Quote_Address $address, $item)
 {
     if (!$this->_helper->isEnabled($this->_store)) {
         return $this;
     }
     $attributes = $this->_helper->getProductWeeeAttributes($item->getProduct(), $address, $address->getQuote()->getBillingAddress(), $this->_store->getWebsiteId());
     $applied = array();
     $productTaxes = array();
     $totalValue = 0;
     $baseTotalValue = 0;
     $totalRowValue = 0;
     $baseTotalRowValue = 0;
     $totalExclTaxValue = 0;
     $baseTotalExclTaxValue = 0;
     $totalExclTaxRowValue = 0;
     $baseTotalExclTaxRowValue = 0;
     $customerRatePercentage = $this->_customerRatePercent($address, $item);
     foreach ($attributes as $k => $attribute) {
         $baseValue = $attribute->getAmount();
         $baseValueExclTax = $baseValue;
         if ($customerRatePercentage && $this->_helper->isTaxIncluded($this->_store)) {
             //Remove the customer tax. This in general applies to EU scenario
             $baseValueExclTax = $this->_getCalculator()->round($baseValue * 100 / (100 + $customerRatePercentage));
         }
         $value = $this->_store->convertPrice($baseValue);
         $rowValue = $value * $item->getTotalQty();
         $baseRowValue = $baseValue * $item->getTotalQty();
         //Get the values excluding tax
         $valueExclTax = $this->_store->convertPrice($baseValueExclTax);
         $rowValueExclTax = $valueExclTax * $item->getTotalQty();
         $baseRowValueExclTax = $baseValueExclTax * $item->getTotalQty();
         $title = $attribute->getName();
         //Calculate the Wee value
         $totalValue += $value;
         $baseTotalValue += $baseValue;
         $totalRowValue += $rowValue;
         $baseTotalRowValue += $baseRowValue;
         //Calculate the Wee without tax
         $totalExclTaxValue += $valueExclTax;
         $baseTotalExclTaxValue += $baseValueExclTax;
         $totalExclTaxRowValue += $rowValueExclTax;
         $baseTotalExclTaxRowValue += $baseRowValueExclTax;
         /*
          * Note: including Tax does not necessarily mean it includes all the tax
          * *_incl_tax only holds the tax associated with Tax included products
          */
         $productTaxes[] = array('title' => $title, 'base_amount' => $baseValueExclTax, 'amount' => $valueExclTax, 'row_amount' => $rowValueExclTax, 'base_row_amount' => $baseRowValueExclTax, 'base_amount_incl_tax' => $baseValue, 'amount_incl_tax' => $value, 'row_amount_incl_tax' => $rowValue, 'base_row_amount_incl_tax' => $baseRowValue);
         $applied[] = array('id' => $attribute->getCode(), 'percent' => null, 'hidden' => $this->_helper->includeInSubtotal($this->_store), 'rates' => array(array('base_real_amount' => $baseRowValue, 'base_amount' => $baseRowValue, 'amount' => $rowValue, 'code' => $attribute->getCode(), 'title' => $title, 'percent' => null, 'position' => 1, 'priority' => -1000 + $k)));
     }
     //We set the TAX exclusive value
     $item->setWeeeTaxAppliedAmount($totalExclTaxValue);
     $item->setBaseWeeeTaxAppliedAmount($baseTotalExclTaxValue);
     $item->setWeeeTaxAppliedRowAmount($totalExclTaxRowValue);
     $item->setBaseWeeeTaxAppliedRowAmount($baseTotalExclTaxRowValue);
     $this->_processTaxSettings($item, $totalExclTaxValue, $baseTotalExclTaxValue, $totalExclTaxRowValue, $baseTotalExclTaxRowValue)->_processTotalAmount($address, $totalExclTaxRowValue, $baseTotalExclTaxRowValue);
     $this->_helper->setApplied($item, array_merge($this->_helper->getApplied($item), $productTaxes));
     if ($applied) {
         $this->_saveAppliedTaxes($address, $applied, $item->getWeeeTaxAppliedAmount(), $item->getBaseWeeeTaxAppliedAmount(), null);
     }
 }
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:67,代码来源:Weee.php

示例3: _collectPrintedCard

 /**
  * Collect printed card total for quote
  *
  * @param   Mage_Sales_Model_Quote_Address $address
  * @return  Enterprise_GiftWrapping_Model_Total_Quote_Giftwrapping
  */
 protected function _collectPrintedCard($address)
 {
     $printedCardBasePrice = false;
     $printedCardPrice = false;
     if ($this->_quoteEntity->getGwAddCard()) {
         $printedCardBasePrice = Mage::helper('enterprise_giftwrapping')->getPrintedCardPrice($this->_store);
         $printedCardPrice = $this->_store->convertPrice($printedCardBasePrice);
     }
     $address->setGwCardBasePrice($printedCardBasePrice);
     $address->setGwCardPrice($printedCardPrice);
     return $this;
 }
开发者ID:hyhoocchan,项目名称:mage-local,代码行数:18,代码来源:Giftwrapping.php

示例4: _applyItemTax

 /**
  * Apply item tax
  *
  * @param Mage_Sales_Model_Quote_Address         $address
  * @param Mage_Core_Model_Store|int              $store
  * @param OnePica_AvaTax_Model_Action_Calculator $calculator
  * @return $this
  */
 protected function _applyItemTax(Mage_Sales_Model_Quote_Address $address, $calculator, $store)
 {
     /** @var Mage_Sales_Model_Quote_Item $item */
     foreach ($address->getAllItems() as $item) {
         $item->setAddress($address);
         $baseAmount = $calculator->getItemTax($item);
         $giftBaseTaxTotalAmount = $calculator->getItemGiftTax($item);
         $this->_itemTaxGroups[$item->getId()] = $calculator->getItemTaxGroup($item);
         $giftTaxTotalAmount = $store->convertPrice($giftBaseTaxTotalAmount);
         $giftBaseTaxAmount = $this->_getDataHelper()->roundUp($giftBaseTaxTotalAmount / $item->getTotalQty(), 4);
         $giftTaxAmount = $store->convertPrice($giftBaseTaxAmount);
         $amount = $store->convertPrice($baseAmount);
         $percent = $calculator->getItemRate($item);
         $item->setTaxAmount($amount);
         $item->setBaseTaxAmount($baseAmount);
         $item->setTaxPercent($percent);
         $item->setGwBaseTaxAmount($giftBaseTaxAmount);
         $item->setGwTaxAmount($giftTaxAmount);
         $address->setGwItemsTaxAmount($address->getGwItemsTaxAmount() + $giftTaxTotalAmount);
         $address->setGwItemsBaseTaxAmount($address->getGwItemsBaseTaxAmount() + $giftBaseTaxTotalAmount);
         if ($this->_getTaxDataHelper()->priceIncludesTax($store)) {
             $basePriceIncTax = $item->getBasePrice();
             $priceIncTax = $item->getCalculationPrice();
             $baseRowTotalIncTax = $item->getBaseRowTotal();
             $rowTotalIncTax = $item->getRowTotal();
             $item->setPrice($item->getPrice() - $baseAmount / $item->getTotalQty());
             $item->setBasePrice($item->getBasePrice() - $baseAmount / $item->getTotalQty());
             $item->setBaseRowTax($baseAmount);
             $item->setRowTax($amount);
             $this->_calcItemRowTotal($item);
             $address->setGwItemsBasePrice($address->getGwItemsBasePrice() - $giftBaseTaxTotalAmount);
             $address->setGwItemsPrice($address->getGwItemsPrice() - $giftTaxTotalAmount);
             $item->setGwBasePrice($item->getGwBasePrice() - $giftBaseTaxAmount);
             $item->setGwPrice($item->getGwPrice() - $giftTaxAmount);
             $address->setBaseGrandTotal($address->getBaseGrandTotal() - $giftBaseTaxTotalAmount);
             $address->setGrandTotal($address->getGrandTotal() - $giftTaxTotalAmount);
             $item->setBasePriceInclTax($basePriceIncTax);
             $item->setPriceInclTax($priceIncTax);
             $item->setBaseRowTotalInclTax($baseRowTotalIncTax);
             $item->setRowTotalInclTax($rowTotalIncTax);
         } else {
             $item->setBasePriceInclTax($item->getBasePrice() + $baseAmount / $item->getTotalQty());
             $item->setPriceInclTax($item->getCalculationPrice() + $amount / $item->getTotalQty());
             $item->setBaseRowTotalInclTax($item->getBaseRowTotal() + $baseAmount);
             $item->setRowTotalInclTax($item->getRowTotal() + $amount);
         }
         if (!$calculator->isProductCalculated($item)) {
             $this->_addAmount($amount);
             $this->_addBaseAmount($baseAmount);
         }
         $this->_addAmount($giftTaxTotalAmount);
         $this->_addBaseAmount($giftBaseTaxTotalAmount);
         if (!$item->getParentItem()) {
             $this->_addSubtotalAmount($address, $item);
         }
     }
     return $this;
 }
开发者ID:onepica,项目名称:avatax,代码行数:66,代码来源:Tax.php


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