本文整理汇总了PHP中Mage_Customer_Model_Customer::getEntityId方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Customer_Model_Customer::getEntityId方法的具体用法?PHP Mage_Customer_Model_Customer::getEntityId怎么用?PHP Mage_Customer_Model_Customer::getEntityId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Customer_Model_Customer
的用法示例。
在下文中一共展示了Mage_Customer_Model_Customer::getEntityId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateNames
/**
* updating names for subscriber after customer names update
* @param Mage_Customer_Model_Customer $customer
*/
protected function updateNames($customer)
{
$subscriber = Mage::getModel('advancednewsletter/subscriber')->load($customer->getEntityId(), 'customer_id');
if (!$subscriber->getId()) {
return;
}
if ($subscriber->getData('last_name') != $customer->getLastname() || $subscriber->getData('first_name') != $customer->getFirstname()) {
$subscriber->forceWrite(array('first_name' => $customer->getFirstname(), 'last_name' => $customer->getLastname()));
}
if ($subscriber->getEmail() != $customer->getEmail()) {
$duplicate = Mage::getModel('advancednewsletter/subscriber')->load($customer->getEmail(), 'email');
if (!$duplicate->getId()) {
$subscriber->forceWrite(array('email' => $customer->getEmail()));
}
}
}
示例2: _getWrapped
/**
* Wraps post, customer, store data into Varien_Object
*
* @param array $postData
* @param Mage_Customer_Model_Customer $customer
* @param Mage_Core_Model_Store $store
*
* @return Varien_Object
*/
private function _getWrapped($postData, $customer, $store)
{
$objToReturn = new Varien_Object();
$storeId = $store->getStoreId();
$message = isset($postData['message']) ? htmlspecialchars($postData['message']) : '';
$emailAddresses = $postData['email'];
foreach ($emailAddresses as $key => $emailAddress) {
if (empty($emailAddress) || !Zend_Validate::is($emailAddress, 'EmailAddress')) {
unset($emailAddresses[$key]);
}
}
$objToReturn->setData(array('emails' => $emailAddresses, 'customer_id' => $customer->getEntityId(), 'message' => $message, 'store_id' => $storeId));
return $objToReturn;
}
示例3: login
/**
* Send login data through API
*
* @param Mage_Customer_Model_Customer $customer
* @throws Sailthru_Email_Model_Client_Exception
* @return boolean
*/
public function login(Mage_Customer_Model_Customer $customer)
{
try {
$this->_eventType = 'login';
$data = array('id' => $customer->getEmail(), 'key' => 'email', 'fields' => array('keys' => 1, 'engagement' => 1, 'activity' => 1, 'email' => $customer->getEmail(), 'extid' => $customer->getEntityId()), 'login' => array('site' => Mage::helper('core/url')->getHomeUrl(), 'ip' => Mage::helper('core/http')->getRemoteAddr(true), 'user_agent' => Mage::helper('core/http')->getHttpUserAgent(true)));
if ($response = $this->apiPost('user', $data)) {
return $this->setCookie($response);
} else {
throw new Sailthru_Email_Model_Client_Exception("Response: {$response} is not a valid JSON");
}
} catch (Sailthru_Email_Model_Client_Exception $e) {
Mage::logException($e);
} catch (Exception $e) {
Mage::logException($e);
}
}