Magento EE have the Reward module but the problem is that it's designed for the client to use all of his points everytime, if he have more than quote total, it uses all the necessary points and stay in the remaining points linked to the client. Example:
(To illustrate, 1000 points = U$ 15)
Client points: 11000 Current quote Subtotal: U$ 50 If client opt to use the rewards will be 4000 points used (U$ 60) quote subtotal 0 remaining points 7000
What i need is to make able for the client to choose how many points to use in the case he could use: 1000=15,2000=30,3000=45, 4000=60(turns the order free)
I made some tests and in the Reward module, CartController, added an addAction() (reward/cart/add) where i call something like this:
$quote->setUseRewardPoints(true) ->collectTotals() ->save();
And i edited the totals from reward in a test purpose Enterprise_Reward_Model_Total_Quote_Reward forcing in the collect method this:
$amount = 15; $points = $reward->getPointsEquivalent($amount); $quote->setRewardPointsBalance($points); $quote->setRewardCurrencyAmount($amount); $quote->setBaseRewardCurrencyAmount($amount); $address->setRewardPointsBalance($points); $address->setRewardCurrencyAmount($amount); $address->setBaseRewardCurrencyAmount($amount); $address->setGrandTotal($address->getGrandTotal() - $amount); $address->setBaseGrandTotal($address->getBaseGrandTotal() - $amount);
This works great in cart and saves correctly in sales_flat_quote table: use_reward_points: 1 reward_points_balance: 1000 base_reward_currency_amount: 15.0000 reward_currency_amount: 15.0000
The problem is that in checkout(checkout/onepage native in CE and EE) after i choose the payment method(generally check money order for test purpose) my total is not there anymore with the rewards and the grand total is 55 (50 + 5 from the fixed flat rate) normally...
I was looking in the Observer to see if is there any "shenanigans" that maipulates the quote final value...
But in the end what i really need is to have a way to the client use partially his reward ponits...