• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Mage_Sales_Model_Quote_Item_Abstract类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getEddMessage

 /**
  * Get an estimated delivery message for a quote item.
  *
  * @param  Mage_Sales_Model_Quote_Item_Abstract
  * @return string
  */
 public function getEddMessage(Mage_Sales_Model_Quote_Item_Abstract $item)
 {
     /** @var string $singularOrPluralItem */
     $singularOrPluralItem = (int) $item->getQty() > 1 ? 's' : '';
     /** @var EbayEnterprise_Inventory_Model_Details_Item | Varien_Object | null $eddItem */
     $eddItem = $this->detailService->getDetailsForItem($item) ?: $this->inventoryHelper->getStreetDateForBackorderableItem($item);
     return $eddItem ? $this->inventoryHelper->__($this->getEddTemplate(), $singularOrPluralItem, $eddItem->getDeliveryWindowFromDate()->format('m/d/y'), $eddItem->getDeliveryWindowToDate()->format('m/d/y')) : '';
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:14,代码来源:Edd.php


示例2: _calcUnitTaxAmount

 /**
  * Calculate tax for each product
  * 
  * @param Mage_Sales_Model_Quote_Item_Abstract $item
  * @param type $rate
  * @return Magestore_Customerreward_Model_Total_Quote_Tax
  */
 protected function _calcUnitTaxAmount(Mage_Sales_Model_Quote_Item_Abstract $item, $rate)
 {
     $discount = $item->getDiscountAmount();
     $baseDiscount = $item->getBaseDiscountAmount();
     $item->setDiscountAmount($discount + $item->getAffiliateplusAmount() + $item->getCustomerrewardAmount());
     $item->setBaseDiscountAmount($baseDiscount + $item->getBaseAffiliateplusAmount() + $item->getBaseCustomerrewardAmount());
     parent::_calcUnitTaxAmount($item, $rate);
     $item->setDiscountAmount($discount);
     $item->setBaseDiscountAmount($baseDiscount);
     return $this;
 }
开发者ID:rajarshc,项目名称:Rooja,代码行数:18,代码来源:Tax.php


示例3: _calcUnitTaxAmount

 /**
  * Calculate tax for each product
  * 
  * @param Mage_Sales_Model_Quote_Item_Abstract $item
  * @param type $rate
  * @return Magestore_Customerreward_Model_Total_Quote_Tax
  */
 protected function _calcUnitTaxAmount(Mage_Sales_Model_Quote_Item_Abstract $item, $rate, &$taxGroups = null, $taxId = null, $recalculateRowTotalInclTax = false)
 {
     $discount = $item->getDiscountAmount();
     $baseDiscount = $item->getBaseDiscountAmount();
     /* hainh add this for calculating discount base on incl or excl tax price 22-04-2014 */
     if (!$this->_discountIncludeTax()) {
         $item->setDiscountAmount($discount + $item->getAffiliateplusAmount() + $item->getCustomerrewardAmount());
         $item->setBaseDiscountAmount($baseDiscount + $item->getBaseAffiliateplusAmount() + $item->getBaseCustomerrewardAmount());
     }
     parent::_calcUnitTaxAmount($item, $rate, $taxGroups, $taxId, $recalculateRowTotalInclTax);
     $item->setDiscountAmount($discount);
     $item->setBaseDiscountAmount($baseDiscount);
     return $this;
 }
开发者ID:bigtailbear14,项目名称:rosstheme,代码行数:21,代码来源:Magestore_Affiliateplus_Model_Total_Address_Tax.php


示例4: addItemDiscountPrices

 /**
  * Add additional amounts to discount calculation prices
  *
  * @param   Mage_Sales_Model_Quote_Item_Abstract $item
  * @param   float $basePrice
  * @param   float $price
  * @return  Mage_SalesRule_Helper_Data
  */
 public function addItemDiscountPrices(Mage_Sales_Model_Quote_Item_Abstract $item, $basePrice, $price)
 {
     $discountPrice = $item->getDiscountCalculationPrice();
     $baseDiscountPrice = $item->getBaseDiscountCalculationPrice();
     if ($discountPrice || $baseDiscountPrice || $basePrice || $price) {
         $discountPrice = $discountPrice ? $discountPrice : $item->getCalculationPrice();
         $baseDiscountPrice = $baseDiscountPrice ? $baseDiscountPrice : $item->getBaseCalculationPrice();
         $this->setItemDiscountPrices($item, $baseDiscountPrice + $basePrice, $discountPrice + $price);
     }
     return $this;
 }
开发者ID:njaeger,项目名称:magento_github,代码行数:19,代码来源:Data.php


示例5: process

 public function process(Mage_Sales_Model_Quote_Item_Abstract $item)
 {
     $item->setDiscountAmount(0);
     $item->setBaseDiscountAmount(0);
     $item->setDiscountPercent(0);
     $quote = $item->getQuote();
     $address = $this->_getAddress($item);
     $qty = $item->getTotalQty();
     $itemPrice = $this->_getItemPrice($item);
     $baseItemPrice = $this->_getItemBasePrice($item);
     $itemOriginalPrice = $this->_getItemOriginalPrice($item);
     $baseItemOriginalPrice = $this->_getItemBaseOriginalPrice($item);
     if ($itemPrice < 0) {
         return $this;
     }
     if ($this->_totaldiscountpay > 0) {
         if ($this->_rulesItemTotalspay['giftcardpay']['items_count'] <= 1) {
             $quoteAmount = $quote->getStore()->convertPrice($this->_totaldiscountpay);
             $baseDiscountAmount = min($baseItemPrice * $qty, $this->_totaldiscountpay);
         } else {
             $discountRate = $baseItemPrice * $qty / $this->_rulesItemTotalspay['giftcardpay']['base_items_price'];
             $maximumItemDiscount = $this->_totaldiscountpay * $discountRate;
             $quoteAmount = $quote->getStore()->convertPrice($maximumItemDiscount);
             $baseDiscountAmount = min($baseItemPrice * $qty, $maximumItemDiscount);
             $this->_rulesItemTotalspay['giftcardpay']['items_count']--;
         }
         $discountAmount = min($itemPrice * $qty, $quoteAmount);
         $discountAmount = $quote->getStore()->roundPrice($discountAmount);
         $baseDiscountAmount = $quote->getStore()->roundPrice($baseDiscountAmount);
         //get discount for original price
         $originalDiscountAmount = min($itemOriginalPrice * $qty, $quoteAmount);
         $baseOriginalDiscountAmount = $quote->getStore()->roundPrice($baseItemOriginalPrice);
         $this->_totaldiscountpay -= $baseDiscountAmount;
     }
     $itemDiscountAmount = $item->getDiscountAmount();
     $itemBaseDiscountAmount = $item->getBaseDiscountAmount();
     $discountAmount = min($itemDiscountAmount + $discountAmount, $itemPrice * $qty);
     $baseDiscountAmount = min($itemBaseDiscountAmount + $baseDiscountAmount, $baseItemPrice * $qty);
     $item->getGiftCardEarn($discountAmount);
     $item->getGiftCardBaseEarn($discountAmount);
     $baseTaxableAmount = $item->getBaseTaxableAmount();
     $taxableAmount = $item->getTaxableAmount();
     $item->setBaseTaxableAmount(max(0, $baseTaxableAmount - $discountAmount));
     $item->setTaxableAmount(max(0, $taxableAmount - $discountAmount));
     return $this;
 }
开发者ID:shakhawat4g,项目名称:MagentoExtensions,代码行数:46,代码来源:Discount.php


示例6: _getItemQty

 /**
  * Return discount item qty
  *
  * @param Mage_Sales_Model_Quote_Item_Abstract $item
  * @param Mage_SalesRule_Model_Rule $rule
  * @return int
  */
 protected function _getItemQty($item, $rule)
 {
     $qty = $item->getTotalQty();
     return $rule->getDiscountQty() ? min($qty, $rule->getDiscountQty()) : $qty;
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:12,代码来源:Validator.php


示例7: getTotalItemDetails

 /**
  * Getter for nominal total item details
  *
  * @param Mage_Sales_Model_Quote_Item_Abstract $quoteItem
  * @return array
  */
 public function getTotalItemDetails(Mage_Sales_Model_Quote_Item_Abstract $quoteItem)
 {
     return $quoteItem->getNominalTotalDetails();
 }
开发者ID:natxetee,项目名称:magento2,代码行数:10,代码来源:Nominal.php


示例8: getAddress_new

 protected function getAddress_new(Mage_Sales_Model_Quote_Item_Abstract $item)
 {
     if ($item instanceof Mage_Sales_Model_Quote_Address_Item) {
         $address = $item->getAddress();
     } elseif ($item->getQuote()->isVirtual()) {
         $address = $item->getQuote()->getBillingAddress();
     } else {
         $address = $item->getQuote()->getShippingAddress();
     }
     return $address;
 }
开发者ID:shebin512,项目名称:Magento_Zoff,代码行数:11,代码来源:After.php


示例9: itemToOrderItem

 /**
  * Convert quote item to order item
  *
  * @param   Mage_Sales_Model_Quote_Item_Abstract $item
  * @return  Mage_Sales_Model_Order_Item
  */
 public function itemToOrderItem(Mage_Sales_Model_Quote_Item_Abstract $item)
 {
     $orderItem = Mage::getModel('Mage_Sales_Model_Order_Item')->setStoreId($item->getStoreId())->setQuoteItemId($item->getId())->setQuoteParentItemId($item->getParentItemId())->setProductId($item->getProductId())->setProductType($item->getProductType())->setQtyBackordered($item->getBackorders())->setProduct($item->getProduct())->setBaseOriginalPrice($item->getBaseOriginalPrice());
     $options = $item->getProductOrderOptions();
     if (!$options) {
         $options = $item->getProduct()->getTypeInstance()->getOrderOptions($item->getProduct());
     }
     $orderItem->setProductOptions($options);
     Mage::helper('Mage_Core_Helper_Data')->copyFieldset('sales_convert_quote_item', 'to_order_item', $item, $orderItem);
     if ($item->getParentItem()) {
         $orderItem->setQtyOrdered($orderItem->getQtyOrdered() * $item->getParentItem()->getQty());
     }
     if (!$item->getNoDiscount()) {
         Mage::helper('Mage_Core_Helper_Data')->copyFieldset('sales_convert_quote_item', 'to_order_item_discount', $item, $orderItem);
     }
     Mage::dispatchEvent('sales_convert_quote_item_to_order_item', array('order_item' => $orderItem, 'item' => $item));
     return $orderItem;
 }
开发者ID:nemphys,项目名称:magento2,代码行数:24,代码来源:Quote.php


示例10: isItemGiftWrapped

 /**
  * return true if the item is giftwrapped; false otherwise.
  *
  * @param Mage_Sales_Model_Quote_Item_Abstract
  * @return bool
  */
 protected function isItemGiftWrapped(Mage_Sales_Model_Quote_Item_Abstract $item)
 {
     return (bool) $item->getGwId() || $item->getAddress() && $item->getAddress()->getGwId();
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:10,代码来源:Item.php


示例11: requestShippingRates

 /**
  * Request shipping rates for entire address or specified address item
  * Returns true if current selected shipping method code corresponds to one of the found rates
  *
  * @param Mage_Sales_Model_Quote_Item_Abstract $item
  * @return bool
  */
 public function requestShippingRates(Mage_Sales_Model_Quote_Item_Abstract $item = null)
 {
     /** @var $request Mage_Shipping_Model_Rate_Request */
     $request = Mage::getModel('shipping/rate_request');
     $request->setAllItems($item ? array($item) : $this->getAllItems());
     $request->setDestCountryId($this->getCountryId());
     $request->setDestRegionId($this->getRegionId());
     $request->setDestRegionCode($this->getRegionCode());
     /**
      * need to call getStreet with -1
      * to get data in string instead of array
      */
     $request->setDestStreet($this->getStreet(-1));
     $request->setDestCity($this->getCity());
     $request->setDestPostcode($this->getPostcode());
     $request->setPackageValue($item ? $item->getBaseRowTotal() : $this->getBaseSubtotal());
     $packageValueWithDiscount = $item ? $item->getBaseRowTotal() - $item->getBaseDiscountAmount() : $this->getBaseSubtotalWithDiscount();
     $request->setPackageValueWithDiscount($packageValueWithDiscount);
     $request->setPackageWeight($item ? $item->getRowWeight() : $this->getWeight());
     $request->setPackageQty($item ? $item->getQty() : $this->getItemQty());
     /**
      * Need for shipping methods that use insurance based on price of physical products
      */
     $packagePhysicalValue = $item ? $item->getBaseRowTotal() : $this->getBaseSubtotal() - $this->getBaseVirtualAmount();
     $request->setPackagePhysicalValue($packagePhysicalValue);
     $request->setFreeMethodWeight($item ? 0 : $this->getFreeMethodWeight());
     /**
      * Store and website identifiers need specify from quote
      */
     /*$request->setStoreId(Mage::app()->getStore()->getId());
       $request->setWebsiteId(Mage::app()->getStore()->getWebsiteId());*/
     $request->setStoreId($this->getQuote()->getStore()->getId());
     $request->setWebsiteId($this->getQuote()->getStore()->getWebsiteId());
     $request->setFreeShipping($this->getFreeShipping());
     /**
      * Currencies need to convert in free shipping
      */
     $request->setBaseCurrency($this->getQuote()->getStore()->getBaseCurrency());
     $request->setPackageCurrency($this->getQuote()->getStore()->getCurrentCurrency());
     $request->setLimitCarrier($this->getLimitCarrier());
     $request->setBaseSubtotalInclTax($this->getBaseSubtotalInclTax());
     $result = Mage::getModel('shipping/shipping')->collectRates($request)->getResult();
     $found = false;
     if ($result) {
         $shippingRates = $result->getAllRates();
         // ============ Apply shipping on order minimum value after discount specific to coupon code only =================
         if (!Mage::app()->getStore()->isAdmin()) {
             foreach ($shippingRates as $i => $r) {
                 if ($r->getMethod() == 'freeshipping') {
                     unset($shippingRates[$i]);
                 }
             }
         }
         $isfree = true;
         $minimum_purchange_amount = Mage::getStoreConfig('sales/minimum_order_custom/minimum_purchange_amount');
         $minimum_purchange_amount_status = Mage::getStoreConfig('sales/minimum_order_custom/minimum_purchange_amount_status');
         if ($minimum_purchange_amount_status == '1' && $minimum_purchange_amount > 0) {
             $minPurchaseAmt = Mage::helper('common')->checkMinPurchageAmount($minimum_purchange_amount);
             if ($minPurchaseAmt) {
                 foreach ($shippingRates as $i => $r) {
                     if ($r->getMethod() == 'standard') {
                         $shippingRates[$i]->setPrice(0);
                         $shippingRates[$i]->setCost(0);
                         $isfree = true;
                     }
                 }
             }
         }
         // ==========================================================================================
         foreach ($shippingRates as $shippingRate) {
             $rate = Mage::getModel('sales/quote_address_rate')->importShippingRate($shippingRate);
             if (!$item) {
                 $this->addShippingRate($rate);
             }
             if ($this->getShippingMethod() == $rate->getCode()) {
                 if ($item) {
                     $item->setBaseShippingAmount($rate->getPrice());
                 } else {
                     /**
                      * possible bug: this should be setBaseShippingAmount(),
                      * see Mage_Sales_Model_Quote_Address_Total_Shipping::collect()
                      * where this value is set again from the current specified rate price
                      * (looks like a workaround for this bug)
                      */
                     $this->setShippingAmount($rate->getPrice());
                 }
                 $found = true;
             }
         }
     }
     return $found;
 }
开发者ID:sagmahajan,项目名称:aswan_release,代码行数:99,代码来源:Address.php


示例12: process

 public function process(Mage_Sales_Model_Quote_Item_Abstract $item)
 {
     $item->setFreeShipping(false);
     $item->setDiscountAmount(0);
     $item->setBaseDiscountAmount(0);
     $item->setDiscountPercent(0);
     $quote = $item->getQuote();
     $address = $item->getAddress();
     if (!$address) {
         $address = $item->getQuote()->getShippingAddress();
     }
     $customerId = $quote->getCustomerId();
     $ruleCustomer = Mage::getModel('salesrule/rule_customer');
     $appliedRuleIds = array();
     foreach ($this->_rules as $rule) {
         /**
          * already tried to validate and failed
          */
         if ($rule->getIsValid() === false) {
             continue;
         }
         if ($rule->getIsValid() !== true) {
             /**
              * too many times used in general
              */
             if ($rule->getUsesPerCoupon() && $rule->getTimesUsed() >= $rule->getUsesPerCoupon()) {
                 $rule->setIsValid(false);
                 continue;
             }
             /**
              * too many times used for this customer
              */
             if ($ruleId = $rule->getId()) {
                 $ruleCustomer->loadByCustomerRule($customerId, $ruleId);
                 if ($ruleCustomer->getId()) {
                     if ($ruleCustomer->getTimesUsed() >= $rule->getUsesPerCustomer()) {
                         continue;
                     }
                 }
             }
             $rule->afterLoad();
             /**
              * quote does not meet rule's conditions
              */
             if (!$rule->validate($address)) {
                 $rule->setIsValid(false);
                 continue;
             }
             /**
              * passed all validations, remember to be valid
              */
             $rule->setIsValid(true);
         }
         /**
          * although the rule is valid, this item is not marked for action
          */
         if (!$rule->getActions()->validate($item)) {
             continue;
         }
         $qty = $rule->getDiscountQty() ? min($item->getQty(), $rule->getDiscountQty()) : $item->getQty();
         $rulePercent = $rule->getDiscountAmount();
         switch ($rule->getSimpleAction()) {
             case 'to_percent':
                 $rulePercent = max(0, 100 - $rule->getDiscountAmount());
                 //no break;
             //no break;
             case 'by_percent':
                 $discountAmount = $qty * $item->getCalculationPrice() * $rulePercent / 100;
                 $baseDiscountAmount = $qty * $item->getBaseCalculationPrice() * $rulePercent / 100;
                 if (!$rule->getDiscountQty()) {
                     $discountPercent = min(100, $item->getDiscountPercent() + $rulePercent);
                     $item->setDiscountPercent($discountPercent);
                 }
                 break;
             case 'to_fixed':
                 $quoteAmount = $quote->getStore()->convertPrice($rule->getDiscountAmount());
                 $discountAmount = $qty * ($item->getCalculationPrice() - $quoteAmount);
                 $baseDiscountAmount = $qty * ($item->getBaseCalculationPrice() - $rule->getDiscountAmount());
                 break;
             case 'by_fixed':
                 $quoteAmount = $quote->getStore()->convertPrice($rule->getDiscountAmount());
                 $discountAmount = $qty * $quoteAmount;
                 $baseDiscountAmount = $qty * $rule->getDiscountAmount();
                 break;
         }
         $discountAmount = $quote->getStore()->roundPrice($discountAmount);
         $baseDiscountAmount = $quote->getStore()->roundPrice($baseDiscountAmount);
         $discountAmount = min($discountAmount, $item->getRowTotal());
         $baseDiscountAmount = min($baseDiscountAmount, $item->getBaseRowTotal());
         $item->setDiscountAmount($discountAmount);
         $item->setBaseDiscountAmount($baseDiscountAmount);
         switch ($rule->getSimpleFreeShipping()) {
             case Mage_SalesRule_Model_Rule::FREE_SHIPPING_ITEM:
                 $item->setFreeShipping($rule->getDiscountQty() ? $rule->getDiscountQty() : true);
                 break;
             case Mage_SalesRule_Model_Rule::FREE_SHIPPING_ADDRESS:
                 $address->setFreeShipping(true);
                 break;
         }
         $appliedRuleIds[$rule->getRuleId()] = $rule->getRuleId();
//.........这里部分代码省略.........
开发者ID:arslbbt,项目名称:mangentovies,代码行数:101,代码来源:Validator.php


示例13: _recalculateParent

 /**
  * Recalculate parent item amounts base on children data
  *
  * @param   Mage_Sales_Model_Quote_Item_Abstract $item
  * @return  Mage_Tax_Model_Sales_Total_Quote
  */
 protected function _recalculateParent(Mage_Sales_Model_Quote_Item_Abstract $item)
 {
     $rowTaxAmount = 0;
     $baseRowTaxAmount = 0;
     foreach ($item->getChildren() as $child) {
         $rowTaxAmount += $child->getTaxAmount();
         $baseRowTaxAmount += $child->getBaseTaxAmount();
     }
     $item->setTaxAmount($rowTaxAmount);
     $item->setBaseTaxAmount($baseRowTaxAmount);
     return $this;
 }
开发者ID:redesignMob,项目名称:extensii,代码行数:18,代码来源:Tax.php


示例14: resetItem

 protected function resetItem(Mage_Sales_Model_Quote_Item_Abstract $item)
 {
     $item->setDiscountAmount(0.0);
     $item->setBaseDiscountAmount(0.0);
     $item->setRowTotalWithDiscount($item->getRowTotal());
     $item->setBaseRowTotalWithDiscount($item->getBaseRowTotal());
     $item->setDiscountPercent(0);
     $item->setAppliedRuleIds('');
     $item->setFreeShipping(false);
 }
开发者ID:aoepeople,项目名称:aoe_salesrule,代码行数:10,代码来源:Discount.php


示例15: getStoreRateForItem

 /**
  * Get tax rate based on store shipping origin address settings
  * This rate can be used for conversion store price including tax to
  * store price excluding tax
  *
  * @param Mage_Sales_Model_Quote_Item_Abstract $item
  * @param null|Mage_Core_Model_Store $store
  * @return float
  */
 public function getStoreRateForItem($item, $store = null)
 {
     $storeRequest = $this->getRateOriginRequest($store)->setProductClassId($item->getProduct()->getTaxClassId());
     return $this->getRate($storeRequest);
 }
开发者ID:okite11,项目名称:frames21,代码行数:14,代码来源:Calculation.php


示例16: getIsItemRowTotalCompoundable

 /**
  * Whether the item row total may be compouded with others
  *
  * @param Mage_Sales_Model_Quote_Item_Abstract $item
  * @return bool
  */
 public function getIsItemRowTotalCompoundable(Mage_Sales_Model_Quote_Item_Abstract $item)
 {
     if ($item->getData("skip_compound_{$this->_itemRowTotalKey}")) {
         return false;
     }
     return true;
 }
开发者ID:ravi2jdesign,项目名称:solvingmagento_1.7.0,代码行数:13,代码来源:Abstract.php


示例17: apply

 public function apply(Mage_Sales_Model_Quote_Item_Abstract $item)
 {
     # Do not apply any discount if Ext is Disabled
     if (Mage::helper('referafriend')->getExtDisabled()) {
         return $this;
     }
     $this->_quote = $quote = $item->getQuote();
     if ($item instanceof Mage_Sales_Model_Quote_Address_Item) {
         $address = $item->getAddress();
     } elseif ($quote->isVirtual()) {
         $address = $quote->getBillingAddress();
     } else {
         $address = $quote->getShippingAddress();
     }
     # allow additional discount logic start
     $hasAdditional = $item->getQuote()->getCouponCode() ? true : false;
     $helper = Mage::helper('referafriend/referrer');
     $baseSubtotal = $address->getBaseSubtotal();
     $clearUse = array();
     if (!$this->_discount) {
         Mage::helper('referafriend')->setCustomerDiscount(0);
         $customer = $quote->getCustomer();
         $referrerId = $customer->getId();
         $discounts = Mage::getResourceModel('referafriend/discount_collection')->loadByReferrer($referrerId);
         if (count($discounts)) {
             foreach ($discounts as $discount) {
                 $rule = Mage::getSingleton('referafriend/rule')->load($discount->getRuleId());
                 if ($rule->getDiscountUsage() == 0 || $rule->getDiscountUsage() > $discount->getDiscountUsed()) {
                     # allow additional discount logic
                     if ($hasAdditional && $rule->getAllowAdditionalDiscount() || !$hasAdditional) {
                         $this->_discount[$discount->getId()] = $discount;
                     } else {
                         $clearUse[] = $discount->getId();
                     }
                 }
             }
         }
     }
     if (!count($this->_discount)) {
         # Reset used discount
         $customer = Mage::getSingleton('customer/session');
         if ($customer->isLoggedIn()) {
             $customer->setDiscountUsed(array());
         }
         return $this;
     }
     $this->_getCouponCode();
     //        $this->_couponCode = $this->_getCouponCode();
     $customer = Mage::getSingleton('customer/session');
     if ($customer->isLoggedIn()) {
         $discountUsed = (array) $customer->getDiscountUsed();
     }
     $rafDiscount = Mage::helper('referafriend')->getCustomerDiscount(false) ? Mage::helper('referafriend')->getCustomerDiscount(false) : 0;
     $notUsed = array();
     foreach ($this->_discount as $discountId => $discount) {
         $discountAmount = 0;
         $baseDiscountAmount = 0;
         $rule = Mage::getModel('referafriend/rule')->load($discount->getRuleId());
         switch ($discount->getType()) {
             case self::TYPE_PERCENT:
                 $discountPercent = min(100, $discount->getAmount());
                 $discountAmount = ($item->getRowTotal() - $item->getDiscountAmount()) * $discountPercent / 100;
                 $baseDiscountAmount = ($item->getBaseRowTotal() - $item->getBaseDiscountAmount()) * $discountPercent / 100;
                 $checkDiscountAmount = $baseSubtotal * $discountPercent / 100;
                 if (!($rule->getDiscountGreater() && $checkDiscountAmount < $rule->getDiscountGreater()) && !($rule->getTotalGreater() && $baseSubtotal < $rule->getTotalGreater())) {
                     if (isset($discountUsed)) {
                         if (!isset($discountUsed[$discountId])) {
                             $discountUsed[$discountId] = false;
                         }
                     }
                     $rafDiscount += $baseDiscountAmount;
                     $discountAmount = min($discountAmount + $item->getDiscountAmount(), $item->getRowTotal());
                     $baseDiscountAmount = min($baseDiscountAmount + $item->getBaseDiscountAmount(), $item->getBaseRowTotal());
                     //$discountPercent = min(100, $item->getDiscountPercent()+$percentDiscount);
                     $item->setDiscountPercent(min(100, $item->getDiscountPercent() + $discountPercent));
                     $discountAmount = $quote->getStore()->roundPrice($discountAmount);
                     $baseDiscountAmount = $quote->getStore()->roundPrice($baseDiscountAmount);
                     $item->setDiscountAmount($discountAmount);
                     $item->setBaseDiscountAmount($baseDiscountAmount);
                 } else {
                     $notUsed[] = $discountId;
                     if (isset($discountUsed[$discountId])) {
                         unset($discountUsed[$discountId]);
                     }
                 }
                 break;
             case self::TYPE_FLATRATE:
                 $discountAmount = min($item->getRowTotal() - $item->getDiscountAmount(), $quote->getStore()->convertPrice($discount->getAmount()));
                 $baseDiscountAmount = min($item->getBaseRowTotal() - $item->getBaseDiscountAmount(), $discount->getAmount());
                 $checkDiscountAmount = $discount->getAmount();
                 if (!($rule->getDiscountGreater() && $checkDiscountAmount < $rule->getDiscountGreater()) && !($rule->getTotalGreater() && $baseSubtotal < $rule->getTotalGreater())) {
                     if (isset($discountUsed)) {
                         if (!isset($discountUsed[$discountId])) {
                             $discountUsed[$discountId] = false;
                         }
                     }
                     $rafDiscount += $baseDiscountAmount;
                     $this->_discount[$discountId]->setAmount($discount->getAmount() - $baseDiscountAmount);
                     /*$discountAmount     = $quote->getStore()->roundPrice($discountAmount);
                       $baseDiscountAmount = $quote->getStore()->roundPrice($baseDiscountAmount);*/
//.........这里部分代码省略.........
开发者ID:bevello,项目名称:bevello,代码行数:101,代码来源:Discount.php


示例18: _afterCollectSuccess

 /**
  * Prevent compounding nominal subtotal in case if the trial payment exists
  *
  * @see Mage_Sales_Model_Quote_Address_Total_Nominal_Subtotal
  * @param Mage_Sales_Model_Quote_Address $address
  * @param Mage_Sales_Model_Quote_Item_Abstract $item
  */
 protected function _afterCollectSuccess($address, $item)
 {
     $item->setData('skip_compound_row_total', true);
 }
开发者ID:relue,项目名称:magento2,代码行数:11,代码来源:Trial.php


示例19: calculateTotalQuantityRequested

 /**
  * Calculate the total quantity requested of a given item. All items in the
  * quote with the same SKU as the given item will be counted toward the
  * total quantity.
  *
  * @param Mage_Sales_Model_Quote_Item_Abstract
  * @param Mage_Sales_Model_Quote_Item_Abstract[]
  * @return int
  */
 public function calculateTotalQuantityRequested(Mage_Sales_Model_Quote_Item_Abstract $item, array $allItems)
 {
     $sku = $item->getSku();
     $quantitiesBySku = $this->calculateTotalQuantitiesBySku($allItems);
     return isset($quantitiesBySku[$sku]) ? $quantitiesBySku[$sku] : 0;
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:15,代码来源:Quantity.php


示例20: isStockManaged

 /**
  * return true if the item's manage stock setting is on
  *
  * @param  Mage_Sales_Model_Quote_Item_Abstract
  * @return bool
  */
 public function isStockManaged(Mage_Sales_Model_Quote_Item_Abstract $item)
 {
     $stock = $item->getProduct()->getStockItem();
     return (bool) $stock->getManageStock();
 }
开发者ID:ryaan-anthony,项目名称:magento-retail-order-management,代码行数:11,代码来源:Selection.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Mage_Sales_Model_Resource_Order_Abstract类代码示例发布时间:2022-05-23
下一篇:
PHP Mage_Sales_Model_Quote_Item类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap