题
我满足了我的Magento项目的要求,因此,我需要在购买时向特定客户组提供特别的折扣。该折扣必须在客户帐户中显示,如果它们属于该特定组,并且当用户想要使用该特定折扣时,该项目的价格必须根据对他们的折扣优惠进行折扣。
我知道如何创建客户群,但是我该如何给他们理想的折扣并在购买时使其显示出来。因此客户可以使用它。
请建议我任何方法或参考任何文件。
谢谢!
解决方案
由于您想打折以显示“在购买时”,请使用 购物车价格 规则 来自 促销 菜单。它可以限于某些客户群。
一个 客户团体 可以通过从中编辑其帐户来设置 客户>管理客户 菜单,然后看 帐户信息 为了 客户群 控制。
我给出的链接都来自Magento用户指南。请阅读全部。
http://www.magentocommerce.com/wiki/welcome_to_the_magento_user_ser_s_guide/welcome_to_the_the_magento_user_ser_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);
?>
不隶属于 StackOverflow