我需要在注册后更改客户状态。因此,当用户在管理员批准后尝试登录我的站点时,他可以访问该帐户,同时我想使用触发器并更改该客户的状态以及提供给我的另一个SAP服务器数据库的更新所以在这里我需要知道在客户状态更改状态期间将触发什么事件..?请任何人回答我的问题..
这里使用Netzarbeiter_CustomerActivation代码
******法典************
公共功能客户保存后($observer) { /** @var Mage_Customer_Model_Customer $customer */ $customer = $observer->getEvent()->getCustomer();
$helper = Mage::helper('customeractivation');
$storeId = $helper->getCustomerStoreId($customer);
if (! $helper->isModuleActive($storeId)) {
return;
}
$groupId = $customer->getGroupId();
$defaultStatus = $helper->getDefaultActivationStatus($groupId, $storeId);
try {
if (Mage::app()->getStore()->isAdmin()) {
if (!$customer->getOrigData('customer_activated') && $customer->getCustomerActivated()) {
// Send customer email only if it isn't a new account and it isn't activated by default
if (!($customer->getCustomerActivationNewAccount() && $defaultStatus)) {
$helper->sendCustomerNotificationEmail($customer);
*** Added Code Here **********
获取用户详细信息,并在管理员批准后,客户详细信息将通过您的API发送到另一台服务器
$CustomerID=$customer->getId();
$FirstName=$customer->getFirstname();
$MiddleName=$customer->getMiddlename();
$LastName=$customer->getLastname();
$Gender=$customer->getGender();
$EmailID=$customer->getEmail();
$WebSite=$customer->getWebsiteId();
$GroupID=$customer->getGroupId();
$DOB=$customer->getDob();
$TaxVat=$customer->getTaxvat();
$date= date("Ymd", strtotime($DOB));
$url = "http://server/WebSAPApi/Service1.asmx/CreateCustomer?CustomerID=$CustomerID&FirstName=$FirstName&MiddleName=$MiddleName&LastName=$LastName&Gender=$Gender&EmailID=$EmailID&WebSite=$WebSite&GroupID=$GroupID&DOB=$date&TaxVat=$TaxVat";
function httpGet($url)
{
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
$output=curl_exec($ch);
curl_close($ch);
return $output;
}
$msg = httpGet($url);
Mage::log($url.$msg, null, 'mylog.log', true);**
添加的代码结束
****** }
}
} else {
if ($customer->getCustomerActivationNewAccount()) {
// Only notify the admin if the default is deactivated or the "always notify" flag is configured
$alwaysNotify = Mage::getStoreConfig(self::XML_PATH_ALWAYS_NOTIFY_ADMIN, $storeId,$d);
if (!$defaultStatus || $alwaysNotify) {
$helper->sendAdminNotificationEmail($customer);
}
}
$customer->setCustomerActivationNewAccount(false);
}
} catch (Exception $e) {
Mage::throwException($e->getMessage());
}
}