Magento - displaying reward points for products with tax

We are launching Magento based e-commerce site. It runs Magento Enterprise 1.10.

We are based in the UK - so we like to display all prices including tax (VAT). Our store is set to prices entered including VAT, and Magento returns a VAT calculator at checkout.

The site uses a built-in corporate reward feature and offers customers 10 points for every £ 1 they spend.

The display of reward points (currently using the "echo $ this-> getRewardPoints ()" function in the catalog and cart) shows bonus points including tax (so £ 15 = 150 points), but at the checkout using the same function showing potential points for item, calculates item reward points minus tax (so £ 15 = 120 points).

When an order is placed, reward points are added to the customer's account. Less tax. This clearly confuses users.

As a temporary measure, I have stopped showing incorrect point totals on

We are looking for:

a) Get Magento to always display points including VAT and add the correct points when placing an order (and leave the points to pounds ratio as it is) b) Get Magento to always display and add points without VAT - and therefore we would put the coefficient of points - pounds before compensation.

Any help or pointers on this would be appreciated.

+3


source to share


2 answers


I also had a client, so I wrote a custom module that overrides a function that calculates reward only on additional charges to allow it to calculate tax + tax + as well. I just added a new option to the rewards configuration area to allow the calculation, including taxes, yes or no.

Don't want to describe the process of creating a custom module (there are many resources for that), but the actual function that does the calculation is in this file: code / core / enterprise / reward / model / action / OrderExtra.php

If you want to do it quick and dirty, find the getPoints function and change the calculation of $ currencyAmount (if there is $ quote):

$monetaryAmount = $quote->getBaseGrandTotal() - $address->getBaseShippingAmount();

      

and (if there is no $ quote)



$monetaryAmount = $this->getEntity()->getBaseTotalPaid() - $this->getEntity()->getBaseShippingAmount();

      

Hope it helps!

EDIT: The actual code from the getPoints function should look something like this:

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();

        // *****CALCULATE POINTS INCLUDING TAX
        $monetaryAmount -= $address->getBaseTaxAmount();

        // set points to 0 if calcualtion is negative
        $monetaryAmount = $monetaryAmount < 0 ? 0 : $monetaryAmount;
    } else {
      // use only money customer spend - shipping
        $monetaryAmount = $this->getEntity()->getBaseTotalPaid() - $this->getEntity()->getBaseShippingAmount();

        // *****CALCULATE POINTS INCLUDING TAX
        $monetaryAmount -= $this->getEntity()->getBaseTaxAmount();
    }

      

+2


source


The same problem occurred, but it turned out to be easier to simply remove the sales tax.

$monetaryAmount = $quote->getBaseGrandTotal()
- $address->getBaseShippingAmount()
- $address->getBaseShippingTaxAmount();

      



and changes to the else function. Works great

$monetaryAmount = $this->getEntity()->getBaseTotalPaid()
- $this->getEntity()->getBaseShippingAmount()
- $this->getEntity()->getBaseShippingTaxAmount();

      

+1


source







All Articles