本文整理汇总了PHP中Mage_Customer_Model_Customer::getWebsiteId方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Customer_Model_Customer::getWebsiteId方法的具体用法?PHP Mage_Customer_Model_Customer::getWebsiteId怎么用?PHP Mage_Customer_Model_Customer::getWebsiteId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Customer_Model_Customer
的用法示例。
在下文中一共展示了Mage_Customer_Model_Customer::getWebsiteId方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadByEmail
public function loadByEmail(Mage_Customer_Model_Customer $customer, $email, $testOnly = false)
{
$select = $this->_getReadAdapter()->select()->from($this->getEntityTable(), array($this->getEntityIdField()))->where('email=?', $email);
if ($customer->getSharingConfig()->isWebsiteScope()) {
$select->where('website_id=?', (int) $customer->getWebsiteId());
}
if ($id = $this->_getReadAdapter()->fetchOne($select)) {
$this->load($customer, $id);
}
return $this;
}
示例2: updateRegistryData
public function updateRegistryData(Mage_Customer_Model_Customer $customer, $data)
{
try {
if (!empty($data)) {
$this->setCustomerId($customer->getId());
$this->setWebsiteId($customer->getWebsiteId());
$this->setTypeId($data['type_id']);
$this->setEventName($data['event_name']);
$this->setEventDate($data['event_date']);
$this->setEventCountry($data['event_country']);
$this->setEventLocation($data['event_location']);
}
} catch (Exception $e) {
Mage::logException($e);
}
Mage::log($data);
return $this;
}
示例3: updateRegistryData
public function updateRegistryData(Mage_Customer_Model_Customer $customer, $data)
{
try {
if (!empty($data)) {
$this->setCustomerId($customer->getId());
$this->setWebsiteId($customer->getWebsiteId());
$this->setTypeId($data['type_id']);
$this->setEventName($data['event_name']);
$this->setEventDate($data['event_date']);
$this->setEventCountry($data['event_country']);
$this->setEventLocation($data['event_location']);
} else {
throw new Exception("Error Processing Request:Insufficient Data Provided");
}
} catch (Exception $e) {
Mage::logException($e);
}
return $this;
}
示例4: 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;
}
示例5: 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;
}
示例6: getCustomerStoreId
/**
* Return the Store Id to read configuration settings for this customer from
*
* @param Mage_Customer_Model_Customer $customer
* @return int
*/
public function getCustomerStoreId(Mage_Customer_Model_Customer $customer)
{
/*
* Only set in Adminhtml UI
*/
if (!($storeId = $customer->getSendemailStoreId())) {
/*
* store_id might be zero if the account was created in the admin interface
*/
$storeId = $customer->getStoreId();
if (!$storeId && $customer->getWebsiteId()) {
/*
* Use the default store groups store of the customers website
*/
if ($store = Mage::app()->getWebsite($customer->getWebsiteId())->getDefaultStore()) {
$storeId = $store->getId();
}
}
// In case the website_id is not yet set on the customer, and the
// current store is a frontend store, use the current store ID
if (!$storeId && !Mage::app()->getStore()->isAdmin()) {
$storeId = Mage::app()->getStore()->getId();
}
}
return $storeId;
}
示例7: 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;
}
示例8: _getCustomerStoreId
/**
* Get Customer Store Id
*
* @param Mage_Customer_Model_Customer $customer
* @return int|null
*/
protected function _getCustomerStoreId(Mage_Customer_Model_Customer $customer)
{
$customerStoreId = null;
if ($customer->getId()) {
$customerStoreId = Mage::app()->getWebsite($customer->getWebsiteId())->getDefaultStore()->getId();
}
return $customerStoreId;
}
示例9: _sendWelcomeEmail
/**
* Send welcome email to customer
*
* @param Mage_Customer_Model_Customer $customer
* @param array $customerData
* @return Mage_Customer_Service_Customer
*/
protected function _sendWelcomeEmail($customer, array $customerData)
{
if ($customer->getWebsiteId() && ($this->_isSendEmail($customerData) || $this->_isAutogeneratePassword($customerData))) {
$isNewCustomer = !(bool) $customer->getOrigData($customer->getIdFieldName());
$storeId = $customer->getSendemailStoreId();
if ($isNewCustomer) {
$customer->sendNewAccountEmail('registered', '', $storeId);
} elseif (!$customer->getConfirmation()) {
// Confirm not confirmed customer
$customer->sendNewAccountEmail('confirmed', '', $storeId);
}
}
return $this;
}
示例10: getCustomerLastQuoteId
/**
* get customer last quote id
*
* @param Mage_Customer_Model_Customer $customer
* @return bool|Varien_Object
*/
public function getCustomerLastQuoteId(Mage_Customer_Model_Customer $customer)
{
$storeIds = Mage::app()->getWebsite($customer->getWebsiteId())->getStoreIds();
$collection = Mage::getModel('sales/quote')->getCollection();
$collection->addFieldToFilter('customer_id', $customer->getId())->addFieldToFilter('store_id', array('in' => $storeIds))->setPageSize(1)->setOrder('entity_id');
if ($collection->count()) {
return $collection->getFirstItem();
} else {
return false;
}
}
示例11: customerSaveBefore
/**
* Customer validate before save
*
* @param Mage_Customer_Model_Customer $model
* @return void
*/
public function customerSaveBefore($model)
{
if ($model->getId() && !$this->_role->hasWebsiteAccess($model->getWebsiteId(), true)) {
$this->_throwSave();
} elseif (!$model->getId() && !$this->_role->getIsWebsiteLevel()) {
$this->_throwSave();
}
}
示例12: _sendNewReleaseEmail
/**
* Send email with new release information.
*
* @param Mage_Customer_Model_Customer $customer
* Customer to send the mail to
* @param Faett_Package_Model_Link_Purchased $linkPurchased
* The data about when the product has been purchased
* @param Faett_Package_Model_Link $link
* Data previously created link
* @return Faett_Package_Model_Mysql4_Link
* The instance
*/
protected function _sendNewReleaseEmail(Mage_Customer_Model_Customer $customer, Faett_Package_Model_Link_Purchased $linkPurchased, Faett_Package_Model_Link $link)
{
try {
// load the translation model
$translate = Mage::getSingleton('core/translate');
$translate->setTranslateInline(false);
// initialize the store ID necessary for the translation
$storeId = $customer->getStoreId();
if ($customer->getWebsiteId() != '0' && $storeId == '0') {
$storeIds = Mage::app()->getWebsite($customer->getWebsiteId())->getStoreIds();
reset($storeIds);
$storeId = current($storeIds);
}
// load the email template, generate and send the mail
Mage::getModel('core/email_template')->setDesignConfig(array('area' => 'frontend', 'store' => $storeId))->sendTransactional(Mage::getStoreConfig(Faett_Channel_Model_Service::XML_PATH_EMAILS_RELEASE_NEW), Mage::getStoreConfig(Mage_Customer_Model_Customer::XML_PATH_REGISTER_EMAIL_IDENTITY), $customer->getEmail(), $customer->getName(), array('customer' => $customer, 'linkPurchased' => $linkPurchased, 'link' => $link));
// close the translation model
$translate->setTranslateInline(true);
} catch (Exception $e) {
Mage::logException($e);
}
// return the instance itself
return $this;
}