4

我遇到了我的 magento 项目的要求,因此我需要为特定客户群的购买提供特别折扣。如果客户属于该特定组,则此折扣必须显示在客户帐户中,并且当用户想要使用该特定折扣时,该商品的价格必须根据该折扣提供给他们。

我知道如何创建客户群,但我怎样才能给他们想要的折扣并在购买时显示出来。以便客户可以使用它。

请建议我任何方法或参考任何文件。

谢谢!

4

2 回答 2

7

由于您希望“在购买时”显示折扣,请使用促销菜单中的购物车价格规则。它可以仅限于某些客户群体。

可以通过从“客户”>“管理客户”菜单中编辑其帐户来设置客户组,然后查看“客户组”控件的帐户信息。

我提供的链接都来自 Magento 用户指南。请全部阅读。
http://www.magentocommerce.com/wiki/welcome_to_the_magento_user_s_guide/welcome_to_the_magento_user_s_guide

于 2010-12-14T12:18:09.260 回答
-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);

?>
于 2013-07-05T01:02:47.190 回答