magento rewrite enterprise model

in xml:

<models>
	  <myreward>
		<class>Bysoft_Myreward_Model</class>
	  </myreward>
	  <enterprise_reward>
		<rewrite>
				<action_orderExtra>Bysoft_Myreward_Model_Action_OrderExtra</action_orderExtra>
		</rewrite>
	</enterprise_reward>
</models>

 pay attention to : <action_orderExtra> in this section, E is casesentive

 

in model file:

This function will make order reword base total include shipping fee and tax amount 

<?php
class Bysoft_Myreward_Model_Action_OrderExtra extends Enterprise_Reward_Model_Action_OrderExtra
{
	/**
	 * Retrieve points delta for action
	 *
	 * @param int $websiteId
	 * @return int
	 */
    public function getPoints($websiteId)
    {
        if (!Mage::helper('enterprise_reward')->isOrderAllowed($this->getReward()->getWebsiteId())) {
            return 0;
        }
        if ($this->_quote) {
            $quote = $this->_quote;
            // known issue: no support for multishipping quote
            $address = $quote->getIsVirtual() ? $quote->getBillingAddress() : $quote->getShippingAddress();
            // use only money customer spend - shipping & tax
            $monetaryAmount = $quote->getBaseGrandTotal();
              //  - $address->getBaseShippingAmount()
              //  - $address->getBaseTaxAmount();
            $monetaryAmount = $monetaryAmount < 0 ? 0 : $monetaryAmount;
        } else {
            $monetaryAmount = $this->getEntity()->getBaseTotalPaid();
            //    - $this->getEntity()->getBaseShippingAmount()
            //    - $this->getEntity()->getBaseTaxAmount();
        }
        $pointsDelta = $this->getReward()->getRateToPoints()->calculateToPoints((float)$monetaryAmount);
        return $pointsDelta;
    }
}
		

 

你可能感兴趣的:(rewrite)