English 中文(简体)
magento特定客户群体
原标题:Discount for particular customer group in magento

我满足了我的magento项目的一项要求,因为我需要在购买时向特定客户群体提供特别折扣。 这种贴现必须反映在客户账户中,如果它们属于这一特定群体,而且当用户想要使用这一特定折扣时,必须根据向他们提供的贴现价予以折扣。

我知道如何建立一个客户团体,但我如何能够给他们希望的折扣,并在购买时显示。 因此客户可以使用。

please suggest me any method or refer any document.

感谢!

最佳回答

由于你希望贴出“购买时”的贴现,请Shopping Cart Price/em> Rule。 它可以限于某些客户群体。

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

问题回答
<?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);

?>




相关问题
Magento addFieldToFilter allow NULLs

When using the Magento collection method addFieldToFilter is it possible to allow filtering by NULL values? I want to select all the products in a collection that have a custom attribute even if no ...

Get product link from Magento API

I am new to Magento and using their API. I need to be able to get the product url from the API call. I see that I can access the url_key and url_path, but unfortunately that s not necessarily what ...

magento extension installation

I want to install a Magento extension in WAMP, but not from the Magento connect system. How can I do this? I have the module (extension) code and I already installed the sample data in the Magento ...

Link to a specific step in onepage checkout

Is it possible to redirect the browser to nth step in the onepage checkout? If so, how would one go about doing it? I m working on a payment module and have a sort of "cancel" action that i would ...

How do I filter a collection by a YesNo type attribute?

I have a ‘featured’ attribute, which has a Yes/No select-list as the admin input. I presume that the values for Yes and No are 1 and 0, as they are for every other Yes/No list. However, if I try and ...