Monthly Archives: April 2012

Reward Points Functionality of Magento EE

Magento Enterprise is a powerful and flexible eCommerce platform. However, as Magento adoption rapidly increases, there are retailers who require more than the Magento developers can provide.

Works on Magento’s Reward Points Functionality

Recently, I have worked on Magento’s Reward Points functionality. Our work on Magento development included a little bit of custom coding in order to bring about the usage of reward points in X percent of total checkout value.

I was panicked while dealing with Magento checkout as the time consumption for this was unknown. After detailed study a quick solution was obtained. The solution to this problem was including the method that returns the reward points balance and fake the reward points using the logic “use reward points in X percent of total (subtotal) checkout value”.

Drawbacks

Faking the amount of reward points will fake the amount throughout the site. We just wanted to fake it throughout the checkout process until we create a successful order.
It will be difficult for me to give you a detailed code overview. But I can give details of what I have coded.

First of all let’s rewrite the Enterprise_Reward_Model_Reward class trough modules config.xml files.

<global>
<models>
<enterprise_reward>
<rewrite>
<reward>Inchoo_MyModule_Model_Reward</reward>
</rewrite>
</enterprise_reward>
</models>
</global>

After this you need to implement Inchoo_MyModule_Model_Reward.

class Inchoo_MyModule_Model_Reward extends Enterprise_Reward_Model_Reward
{
public function getPointsBalance()
{
$request = Mage::app()->getRequest();

if ($request->getModuleName() == ‘checkout’) {
if (($quote = Mage::getModel(‘checkout/session’)->getQuote())) {
$totals = $quote->getTotals();
$cartTotal = floor($totals["subtotal"]->getValue());
if ($cartTotal > 0) {
$rpPercent = 23; /* some integer value representing percent, could read this trough some config */

$rpAllowedMax = $cartTotal * ($rpPercent / 100);
$rpAllowedMax = floor($rpAllowedMax);

if ((int)$this->getData(‘points_balance’) >= $rpAllowedMax) {
return $rpAllowedMax;
}
}
}
}

return $this->getData(‘points_balance’);
}
}

In all these the best part is getPointsBalance() method. This method doesn’t exist in the parent class. This is a Magento/PHP magic method implemented trough Varien_Object. By implementing this method a control over the returned balance value is achieved, while still being able to fetch the true non-touched value of points_balance by calling the $reward->getData(‘points_balance’) later in the code.

Finally, we limit the special “use reward points in X percent of total (subtotal) checkout value” function behavior to “checkout” module by usage of if($request->getModuleName() == ‘checkout’). It can even be limited to a controller action level. Everything must be tested to prevent breaking of the calls to $reward->getPointsBalance() on places that should not implement the above logic.

The default message for Reward Points shown on the Payment step of the checkout can be changed as shown below:

<?php echo Mage::helper(‘enterprise_reward’)->__(‘Use my reward points, %s available out of %d total’, Mage::helper(‘enterprise_reward’)->formatReward($this->getPointsBalance(), $this->getCurrencyAmount()), $this->getReward()->getData(‘points_balance’)); ?>

Conclusion

Even though my approach was not the best, still it strikes the right balances between “do it on time and do it stable”. I hope that this post gave you an idea of how Magento EE uses the reward point’s functionality.

Tips on Choosing the Best Magento Solution Partner

Finding the Complete Magento Solution Partner

The search for a reliable Magento Solution Partner can very well be compared to the search for a life partner, since reliability, honesty and that undeniable vibe are common elements in both cases. Small and medium enterprises, agencies and storeowners have sought out a Magento storefront that could do wonders for their business from time to time, but all have not been lucky. Web development interactive agency EyeMagine has pointed towards certain factors that one should keep in mind when seeking out the right Magento Solution Partner.

1. Design – Design is perhaps the most important element to complete an ecommerce site. A poorly designed ecommerce site can never hope to attract or retain customers, but instead can waylay their buying decisions. A well-organized and neatly designed ecommerce site on the other hand, can influence a buyer positively and even bring him back later.

Good solid design and enhanced user experience are very important for a successful ecommerce website.

2. Customized Features – Features on an ecommerce site are as important as the design, if not more so. Magento offers some really useful features, to which you can even add some new features, and it’s vital for you to know how. Here are some instances of customizations that can be made to your Magento web development:

  • Blog postings
  • PR management system
  • Invoice based sales reports
  • Product organizer

3. Theme – A customized theme can give your ecommerce site great mileage if it reflects your business idea. Magento has several templates and themes, one of which would be your default theme. This theme can be overridden by a new theme that you could create to enhance your site.

4. Payment Gateway – Since Magento supports online transactions, you can choose from a payment gateway like Authorize.net or PayPal that can be integrated into Magento’s platform.

If you are opting for Magento development in India, you can be rest assured that Indian developers will take care of all these above mentioned points. Click here to know more.