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


PHP Mage_Sales_Model_Quote_Address::setFreeShipping方法代码示例

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


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

示例1: collect

 /**
  * set freeshipping for spent point order
  * 
  * @param Mage_Sales_Model_Quote_Address $address
  * @return Magestore_RewardPoints_Model_Total_Quote_Freeshipping
  */
 public function collect(Mage_Sales_Model_Quote_Address $address)
 {
     /** @var $helper Magestore_RewardPoints_Helper_Calculation_Spending */
     $helper = Mage::helper('rewardpoints/calculation_spending');
     if (!$helper->getTotalPointSpent()) {
         return $this;
     }
     $isFreeShipping = Mage::getStoreConfig(Magestore_RewardPoints_Helper_Calculation_Spending::XML_PATH_FREE_SHIPPING, $address->getQuote()->getStoreId());
     if (!$isFreeShipping) {
         return $this;
     }
     $address->setFreeShipping(true);
     Mage::dispatchEvent('rewardpoints_collect_total_freeshipping', array('address' => $address));
     return $this;
 }
开发者ID:kanotest15,项目名称:cbmagento,代码行数:21,代码来源:Freeshipping.php

示例2: collect

 public function collect(Mage_Sales_Model_Quote_Address $address)
 {
     $quote = $address->getQuote();
     $eventArgs = array('website_id' => Mage::app()->getStore($quote->getStoreId())->getWebsiteId(), 'customer_group_id' => $quote->getCustomerGroupId(), 'coupon_code' => $quote->getCouponCode());
     $address->setFreeShipping(0);
     $totalDiscountAmount = 0;
     $subtotalWithDiscount = 0;
     $baseTotalDiscountAmount = 0;
     $baseSubtotalWithDiscount = 0;
     $hasDiscount = false;
     foreach ($address->getAllItems() as $item) {
         if ($item->getNoDiscount()) {
             $item->setDiscountAmount(0);
             $item->setBaseDiscountAmount(0);
             $item->setRowTotalWithDiscount($item->getRowTotal());
             $item->setBaseRowTotalWithDiscount($item->getRowTotal());
             $subtotalWithDiscount += $item->getRowTotal();
             $baseSubtotalWithDiscount += $item->getBaseRowTotal();
         } else {
             $eventArgs['item'] = $item;
             Mage::dispatchEvent('sales_quote_address_discount_item', $eventArgs);
             if ($item->getDiscountAmount()) {
                 $hasDiscount = true;
             }
             $totalDiscountAmount += $item->getDiscountAmount();
             $baseTotalDiscountAmount += $item->getBaseDiscountAmount();
             $item->setRowTotalWithDiscount($item->getRowTotal() - $item->getDiscountAmount());
             $item->setBaseRowTotalWithDiscount($item->getBaseRowTotal() - $item->getBaseDiscountAmount());
             $subtotalWithDiscount += $item->getRowTotalWithDiscount();
             $baseSubtotalWithDiscount += $item->getBaseRowTotalWithDiscount();
         }
     }
     $address->setDiscountAmount($totalDiscountAmount);
     $address->setSubtotalWithDiscount($subtotalWithDiscount);
     $address->setBaseDiscountAmount($baseTotalDiscountAmount);
     $address->setBaseSubtotalWithDiscount($baseSubtotalWithDiscount);
     if (!$hasDiscount) {
         $quote->setCouponCode(null);
     }
     $address->setGrandTotal($address->getGrandTotal() - $address->getDiscountAmount());
     $address->setBaseGrandTotal($address->getBaseGrandTotal() - $address->getBaseDiscountAmount());
     return $this;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:43,代码来源:Discount.php

示例3: 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

示例4: collect

 public function collect(Mage_Sales_Model_Quote_Address $address)
 {
     $quote = $address->getQuote();
     $eventArgs = array('website_id' => Mage::app()->getStore($quote->getStoreId())->getWebsiteId(), 'customer_group_id' => $quote->getCustomerGroupId(), 'coupon_code' => $quote->getCouponCode());
     $address->setFreeShipping(0);
     $totalDiscountAmount = 0;
     $subtotalWithDiscount = 0;
     $baseTotalDiscountAmount = 0;
     $baseSubtotalWithDiscount = 0;
     $items = $address->getAllItems();
     if (!count($items)) {
         $address->setDiscountAmount($totalDiscountAmount);
         $address->setSubtotalWithDiscount($subtotalWithDiscount);
         $address->setBaseDiscountAmount($baseTotalDiscountAmount);
         $address->setBaseSubtotalWithDiscount($baseSubtotalWithDiscount);
         return $this;
     }
     $hasDiscount = false;
     foreach ($items as $item) {
         if ($item->getNoDiscount()) {
             $item->setDiscountAmount(0);
             $item->setBaseDiscountAmount(0);
             $item->setRowTotalWithDiscount($item->getRowTotal());
             $item->setBaseRowTotalWithDiscount($item->getRowTotal());
             $subtotalWithDiscount += $item->getRowTotal();
             $baseSubtotalWithDiscount += $item->getBaseRowTotal();
         } else {
             /**
              * Child item discount we calculate for parent
              */
             if ($item->getParentItemId()) {
                 continue;
             }
             /**
              * Composite item discount calculation
              */
             if ($item->getHasChildren() && $item->isChildrenCalculated()) {
                 foreach ($item->getChildren() as $child) {
                     $eventArgs['item'] = $child;
                     Mage::dispatchEvent('sales_quote_address_discount_item', $eventArgs);
                     if ($child->getDiscountAmount() || $child->getFreeShipping()) {
                         $hasDiscount = true;
                     }
                     /**
                      * Parent free shipping we apply to all children
                      */
                     if ($item->getFreeShipping()) {
                         $child->setFreeShipping($item->getFreeShipping());
                     }
                     /**
                      * @todo Parent discount we apply for all children without discount
                      */
                     if (!$child->getDiscountAmount() && $item->getDiscountPercent()) {
                     }
                     $totalDiscountAmount += $child->getDiscountAmount();
                     //*$item->getQty();
                     $baseTotalDiscountAmount += $child->getBaseDiscountAmount();
                     //*$item->getQty();
                     $child->setRowTotalWithDiscount($child->getRowTotal() - $child->getDiscountAmount());
                     $child->setBaseRowTotalWithDiscount($child->getBaseRowTotal() - $child->getBaseDiscountAmount());
                     $subtotalWithDiscount += $child->getRowTotalWithDiscount();
                     $baseSubtotalWithDiscount += $child->getBaseRowTotalWithDiscount();
                 }
             } else {
                 $eventArgs['item'] = $item;
                 Mage::dispatchEvent('sales_quote_address_discount_item', $eventArgs);
                 if ($item->getDiscountAmount() || $item->getFreeShipping()) {
                     $hasDiscount = true;
                 }
                 $totalDiscountAmount += $item->getDiscountAmount();
                 $baseTotalDiscountAmount += $item->getBaseDiscountAmount();
                 $item->setRowTotalWithDiscount($item->getRowTotal() - $item->getDiscountAmount());
                 $item->setBaseRowTotalWithDiscount($item->getBaseRowTotal() - $item->getBaseDiscountAmount());
                 $subtotalWithDiscount += $item->getRowTotalWithDiscount();
                 $baseSubtotalWithDiscount += $item->getBaseRowTotalWithDiscount();
             }
         }
     }
     $address->setDiscountAmount($totalDiscountAmount);
     $address->setSubtotalWithDiscount($subtotalWithDiscount);
     $address->setBaseDiscountAmount($baseTotalDiscountAmount);
     $address->setBaseSubtotalWithDiscount($baseSubtotalWithDiscount);
     $address->setGrandTotal($address->getGrandTotal() - $address->getDiscountAmount());
     $address->setBaseGrandTotal($address->getBaseGrandTotal() - $address->getBaseDiscountAmount());
     return $this;
 }
开发者ID:okite11,项目名称:frames21,代码行数:86,代码来源:Discount.php

示例5: recalculateShippingDiscounts

 /**
  * Recalulates the shipping discount taking into account whether or not
  * a redemption rule is applied by the user.
  * TODO does this need to be here?
  * @deprecated does this need to be here?
  *
  * @author Jay El <nelkaake@wdca.ca>
  * 
  * @param Mage_Sales_Model_Quote_Address &$address
  * @param Mage_Sales_Model_Quote_Item_Abstract &$item
  * @param array $applied_redemptions
  */
 protected function recalculateShippingDiscounts(Mage_Sales_Model_Quote_Address &$address, &$item, array $applied_redemptions)
 {
     //@nelkaake 04/03/2010 4:56:24 PM : as long as we're not in Mage 1.4
     if (Mage::helper('rewards')->isBaseMageVersionAtLeast('1.4')) {
     } else {
         // Enabled/disable free shipping
         $rules = $this->_getRules2();
         foreach ($rules as &$salesrule) {
             $rule_id = $salesrule->getId();
             // Get the points salesrule versus $salesrule which is any type of salesrule
             $pointsrule = $this->getRule($rule_id);
             if (!$pointsrule->isPointsRule()) {
                 continue;
             }
             // we're only looking at points rules here
             // if it's a rdemption rule and it's not applied, continue on...
             if ($pointsrule->isRedemptionRule() && array_search($rule_id, $applied_redemptions) === false) {
                 continue;
             }
             switch ($pointsrule->getSimpleFreeShipping()) {
                 case Mage_SalesRule_Model_Rule::FREE_SHIPPING_ITEM:
                     $item->setFreeShipping($pointsrule->getDiscountQty() ? $pointsrule->getDiscountQty() : true);
                     break;
                 case Mage_SalesRule_Model_Rule::FREE_SHIPPING_ADDRESS:
                     $address->setFreeShipping(true);
                     break;
             }
         }
     }
     //Mage::log("Free Shipping Report: item={$item->getFreeShipping()}, address={$address->getFreeShipping()}" );
 }
开发者ID:rajarshc,项目名称:Rooja,代码行数:43,代码来源:Validator.php


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