本文整理汇总了PHP中Mage_Customer_Model_Customer::hasData方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Customer_Model_Customer::hasData方法的具体用法?PHP Mage_Customer_Model_Customer::hasData怎么用?PHP Mage_Customer_Model_Customer::hasData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Customer_Model_Customer
的用法示例。
在下文中一共展示了Mage_Customer_Model_Customer::hasData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _customerAddress
protected function _customerAddress(Mage_Customer_Model_Customer &$customer)
{
$_address = $customer->getDefaultBillingAddress();
//use default billing address as address synced in Marketo
if (!$_address) {
return false;
}
//PREPARE ADDITIONAL DATA
$_address->setData($this->_addressKey, true);
$this->_prepareData($_address);
foreach ($_address->getData() as $field => $value) {
if (!$customer->hasData($field)) {
//replace only when customer
$customer->setData($field, $value);
}
}
return true;
}
示例2: loadByUsername
/**
* Load customer by username
*
* @param Mage_Customer_Model_Customer $customer
* @param string $username
* @return Mage_Customer_Model_Entity_Customer
* @throws Mage_Core_Exception
*/
public function loadByUsername(Mage_Customer_Model_Customer $customer, $username)
{
if (!Mage::getStoreConfigFlag('username/general/case_sensitive')) {
$filter = new Zend_Filter_StringToLower(array('encoding' => 'UTF-8'));
$username = $filter->filter($username);
}
$select = $this->_getReadAdapter()->select()->from($this->getEntityTable(), array($this->getEntityIdField()))->joinNatural(array('cev' => $this->getTable('customer_entity_varchar')))->joinNatural(array('ea' => $this->getTable('eav/attribute')))->where('ea.attribute_code=\'username\' AND cev.value=?', $username);
if ($customer->getSharingConfig()->isWebsiteScope()) {
if (!$customer->hasData('website_id')) {
Mage::throwException(Mage::helper('customer')->__('Customer website ID must be specified when using the website scope.'));
}
$select->where('website_id=?', (int) $customer->getWebsiteId());
}
if ($id = $this->_getReadAdapter()->fetchOne($select, 'entity_id')) {
$this->load($customer, $id);
} else {
$customer->setData(array());
}
return $this;
}
示例3: loadByEmail
/**
* Load customer by email
*
* @throws Mage_Core_Exception
*
* @param Mage_Customer_Model_Customer $customer
* @param string $email
* @param bool $testOnly
* @return Mage_Customer_Model_Resource_Customer
*/
public function loadByEmail(Mage_Customer_Model_Customer $customer, $email, $testOnly = false)
{
$adapter = $this->_getReadAdapter();
$bind = array('customer_email' => $email);
$select = $adapter->select()->from($this->getEntityTable(), array($this->getEntityIdField()))->where('email = :customer_email');
if ($customer->getSharingConfig()->isWebsiteScope()) {
if (!$customer->hasData('website_id')) {
Mage::throwException(Mage::helper('Mage_Customer_Helper_Data')->__('Customer website ID must be specified when using the website scope'));
}
$bind['website_id'] = (int) $customer->getWebsiteId();
$select->where('website_id = :website_id');
}
$customerId = $adapter->fetchOne($select, $bind);
if ($customerId) {
$this->load($customer, $customerId);
} else {
$customer->setData(array());
}
return $this;
}
示例4: loadByEmail
/**
* Load customer by email
*
* @param Mage_Customer_Model_Customer $customer
* @param string $email
* @param bool $testOnly
* @return Mage_Customer_Model_Entity_Customer
* @throws Mage_Core_Exception
*/
public function loadByEmail(Mage_Customer_Model_Customer $customer, $email, $testOnly = false)
{
$select = $this->_getReadAdapter()->select()->from($this->getEntityTable(), array($this->getEntityIdField()))->where('email=:customer_email');
if ($customer->getSharingConfig()->isWebsiteScope()) {
if (!$customer->hasData('website_id')) {
Mage::throwException(Mage::helper('customer')->__('Customer website id must be specified, when using website scope.'));
}
$select->where('website_id=?', (int) $customer->getWebsiteId());
}
if ($id = $this->_getReadAdapter()->fetchOne($select, array('customer_email' => $email))) {
$this->load($customer, $id);
} else {
$customer->setData(array());
}
return $this;
}