4

I met with a requirement for my magento project, according this I need to provide special discount to specific customer group on their purchase. This discount must be shown in customer account,if they belong to that particular group, and when user want to use that particular discount, price of that item must be discounted according to that discount offer to them.

I know how to create a customer group, but how can I give them desired discount and make it show at time of purchase. so that customer can use it.

please suggest me any method or refer any document.

Thanks!

PHP
  • 1,699
  • 5
  • 24
  • 43

2 Answers2

7

Since you want a discount to show "at time of purchase", use a Shopping Cart Price Rule from the Promotions menu. It can be restricted to certain customer groups.

A customer's group can be set by editing their account from Customers > Manage Customers menu, then look in Account Information for the Customer Group control.

The links I gave are both from the Magento User Guide. Please read it all.
http://www.magentocommerce.com/wiki/welcome_to_the_magento_user_s_guide/welcome_to_the_magento_user_s_guide

clockworkgeek
  • 37,650
  • 9
  • 89
  • 127
  • This is working functionality wise .. but how can it come into notice to the customers that they have special discount?? – PHP Dec 16 '10 at 06:14
  • 1
    The only place I can think of where it shows is in the totals area of the cart page - It is a _shopping cart_ price rule - and that is after products have been chosen. To display elsewhere try a _Catalog Price Rule_ instead or if you have somewhere specific in mind open a new question here are stackoverflow. – clockworkgeek Dec 16 '10 at 11:13
-1
<?php
/**
 * Get the resource model
 */
$resource = Mage::getSingleton('core/resource');

/**
 * Retrieve the read connection
 */
$readConnection = $resource->getConnection('core_read');

/**
 * Retrieve current users groupId
 */
$currentUserGroupId = Mage::getSingleton('customer/session')->getCustomerGroupId();

/**
 *  Creating the custom query to fetch coupons
 */
$query =    '
                SELECT sr.rule_id, sr.name, sr.is_active, src.code, src.expiration_date
                FROM `salesrule` sr
                JOIN `salesrule_coupon` src ON (sr.`rule_id` = src.`rule_id`)
                JOIN `salesrule_customer_group` scg ON(scg.`rule_id` = src.`rule_id`)
                where scg.customer_group_id = '.$currentUserGroupId.'
                AND sr.is_active = 1
                AND (  ( src.expiration_date is null ) or ( src.expiration_date > now() ) )
            ';
//store result set in $rules
$rules = $readConnection->fetchAll($query);

// $rules will contain the array of all the coupons available to the current user


// This array contains all the data required
print_r($rules);

?>