Discount for a specific customer group at magento

I met a requirement for my magento project, according to this I need to provide a special discount to a certain group of customers when buying them. This discount must be indicated on the customer account if it belongs to this particular group, and when the user wants to use this particular discount, the price of this item must be discounted in accordance with this discount offer.

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

suggest me some method or specify some document.

Thanks!

+4
source share
2 answers

Since you want to get a discount to show "at the time of purchase", use the "Cart Price Rule" in the "Stocks" menu. It may be limited to certain customer groups.

A can be set up by editing your account under Clients> Client Management, and then go to Account Information to control a group of clients.

The links I gave are in the Magento user guide. Please read all.
http://www.magentocommerce.com/wiki/welcome_to_the_magento_user_s_guide/welcome_to_the_magento_user_s_guide

+7
source
<?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); ?> 
-1
source

Source: https://habr.com/ru/post/1332087/


All Articles