当前位置: 首页>>代码示例>>PHP>>正文


PHP Varien_Event_Observer::getCustomer方法代码示例

本文整理汇总了PHP中Varien_Event_Observer::getCustomer方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Event_Observer::getCustomer方法的具体用法?PHP Varien_Event_Observer::getCustomer怎么用?PHP Varien_Event_Observer::getCustomer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Varien_Event_Observer的用法示例。


在下文中一共展示了Varien_Event_Observer::getCustomer方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: customerSaveAfter

 /**
  * Customer balance update after save
  *
  * @param Varien_Event_Observer $observer
  */
 public function customerSaveAfter($observer)
 {
     if (!Mage::helper('enterprise_customerbalance')->isEnabled()) {
         return;
     }
     if ($data = $observer->getCustomer()->getCustomerBalanceData()) {
         if (!empty($data['amount_delta'])) {
             $balance = Mage::getModel('enterprise_customerbalance/balance')->setCustomer($observer->getCustomer())->setWebsiteId(isset($data['website_id']) ? $data['website_id'] : $observer->getCustomer()->getWebsiteId())->setAmountDelta($data['amount_delta'])->setComment($data['comment']);
             if (isset($data['notify_by_email']) && isset($data['store_id'])) {
                 $balance->setNotifyByEmail(true, $data['store_id']);
             }
             $balance->save();
         }
     }
 }
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:20,代码来源:Observer.php

示例2: customerSaveAfterEvent

 /**
  * create or update an TYPO3 Frontend User
  *
  * @param Varien_Event_Observer $observer
  */
 public function customerSaveAfterEvent($observer)
 {
     if (!Mage::getSingleton('Flagbit_Typo3connect/Core')->isEnabled()) {
         return;
     }
     // no TYPO3 db data given -> nothing to do
     if (!Mage::getStoreConfig('typo3connect/typo3_db/host') || !Mage::getStoreConfig('typo3connect/typo3_db/username') || !Mage::getStoreConfig('typo3connect/typo3_db/password') || !Mage::getStoreConfig('typo3connect/typo3_db/dbname')) {
         return;
     }
     $customer = $observer->getCustomer();
     // assign the fields
     $fields = array('username' => $customer->getData('email'), 'name' => $customer->getData('lastname'), 'firstname' => $customer->getData('firstname'), 'email' => $customer->getData('email'), 'password' => $customer->getData('password'), 'usergroup' => Mage::helper('Flagbit_Typo3connect')->getConfigData('fe_user_group_uid'), 'pid' => Mage::helper('Flagbit_Typo3connect')->getConfigData('fe_user_pid'), 'tx_fbmagento_id' => $customer->getId());
     try {
         // get fe_users Model
         $feUsers = Mage::getSingleton('Flagbit_Typo3connect/typo3_frontend_user');
         $customer->load($customer->getId());
         if ($customer->getTypo3Uid()) {
             $feUsers->setId($customer->getTypo3Uid());
         }
         foreach ($fields as $key => $value) {
             $feUsers->setData($key, $value);
         }
         $feUsers->save();
         $customer->setData('typo3_uid', $feUsers->getData('uid'));
         $customer->getResource()->saveAttribute($customer, 'typo3_uid');
     } catch (Exception $e) {
         Mage::log($e->getMessage());
     }
 }
开发者ID:maffen,项目名称:TypoGento,代码行数:34,代码来源:Observer.php

示例3: login

 /**
  * Capture customer login data
  *
  * @param Varien_Event_Observer $observer
  * @return
  */
 public function login(Varien_Event_Observer $observer)
 {
     if ($this->_isEnabled) {
         try {
             if ($customer = $observer->getCustomer()) {
                 $response = Mage::getModel('sailthruemail/client_user')->login($customer);
                 return true;
             } else {
                 return false;
             }
         } catch (Exception $e) {
             Mage::logException($e);
         }
     }
     return $this;
 }
开发者ID:xiaoguizhidao,项目名称:sailthru-magento-extension,代码行数:22,代码来源:User.php

示例4: customerLoadAfter

 /**
  * Retrieve correct tax class - from quote address, if given, otherwise from default shipping address
  *
  * @param Varien_Event_Observer $observer
  */
 public function customerLoadAfter(Varien_Event_Observer $observer)
 {
     /** @var $customer Mage_Customer_Model_Customer */
     $customer = $observer->getCustomer();
     if ($shippingAddress = $customer->getDefaultShippingAddress()) {
         if ($taxClassId = $shippingAddress->getTaxClassId()) {
             $customer->setTaxClassId($taxClassId);
         }
     }
     if ($quoteId = Mage::getSingleton('checkout/session')->getQuoteId()) {
         /** @var $quoteShippingAddressCollection Mage_Sales_Model_Resource_Quote_Address_Collection */
         $quoteShippingAddressCollection = Mage::getResourceModel('sales/quote_address_collection');
         $quoteShippingAddressCollection->addFieldToFilter('quote_id', $quoteId);
         $quoteShippingAddressCollection->addFieldToFilter('address_type', 'shipping');
         $quoteShippingAddress = $quoteShippingAddressCollection->getFirstItem();
         if ($quoteShippingAddress->getId()) {
             if ($taxClassId = $quoteShippingAddress->getTaxClassId()) {
                 $customer->setTaxClassId($taxClassId);
             }
         }
     }
 }
开发者ID:giuseppemorelli,项目名称:EuropeanTax,代码行数:27,代码来源:Observer.php

示例5: customer_save_after

 public function customer_save_after(Varien_Event_Observer $observer)
 {
     // Check if customer is not new, only export then
     if ($observer->getCustomer()->getOrigData()) {
         $this->_handleEvent($observer, self::EVENT_CUSTOMER_SAVE_AFTER, Xtento_OrderExport_Model_Export::ENTITY_CUSTOMER);
     }
 }
开发者ID:xiaoguizhidao,项目名称:autotech_design,代码行数:7,代码来源:Event.php

示例6: makerCustomerChangeAfter

 /**
  * When customer is modified change the maker type accordingly to approver
  * and if maker himself moved to general disable maker.
  *
  * @param unknown $observer            
  */
 public function makerCustomerChangeAfter(Varien_Event_Observer $observer)
 {
     if (self::$_observerExecutionCounter > 1) {
         return $this;
     }
     self::$_observerExecutionCounter++;
     $customer = $observer->getCustomer();
     $request = $observer->getRequest();
     $customer_id = $customer->getId();
     $is_approver = $customer->getIsApprover();
     $has_approver = $customer->getZmyapprover();
     $mcActive = (int) $customer->getAttribute('maker_status')->getSource()->getOptionId('active');
     $approver_cust_type = (int) $customer->getZiscorporate();
     // customer
     // type
     $general_cust_type = (int) $customer->getAttribute('ziscorporate')->getSource()->getOptionId('general');
     // db connection establishment
     // $resource = Mage::getSingleton ( 'core/resource' );
     // $writeConnection = $resource->getConnection ( 'core_write' );
     // $readConnection = $resource->getConnection ( 'core_read' );
     // if approver
     if ($is_approver) {
         // if the customer is an approver
         $makers = Mage::getResourceModel('customer/customer_collection')->addAttributeToFilter('zmyapprover', $customer_id)->addAttributeToFilter('maker_status', $mcActive)->addAttributeToSelect('*')->addNameToSelect();
         // if bussiness, corporate, credit user
         if ($approver_cust_type == 816 || $approver_cust_type == 814 || $approver_cust_type == 470 || $approver_cust_type == 815) {
             foreach ($makers as $maker) {
                 $maker->setData('ziscorporate', $approver_cust_type);
                 try {
                     $maker->getResource()->saveAttribute($maker, 'ziscorporate');
                 } catch (Exception $e) {
                     Mage::log($e->getMessage(), null, 'mclog.log');
                 }
             }
         } else {
             foreach ($makers as $maker) {
                 $maker->setData('ziscorporate', $general_cust_type);
                 $maker->setData('maker_status', 0);
                 $maker->setData('zmyapprover', '');
                 try {
                     $maker->getResource()->saveAttribute($maker, 'maker_status');
                     $maker->getResource()->saveAttribute($maker, 'ziscorporate');
                     $maker->getResource()->saveAttribute($maker, 'zmyapprover');
                 } catch (Exception $e) {
                     Mage::log($e->getMessage(), null, 'mclog.log');
                 }
             }
         }
         // if approver cutomer type is general send mail to all makers
         if ($approver_cust_type != 816 && $approver_cust_type != 814 && $approver_cust_type != 470 && $approver_cust_type != 815) {
             // disabling the approver privileg on customer moved to personel
             $customer->setData('is_approver', 0);
             // set approver status
             // to no
             try {
                 $customer->getResource()->saveAttribute($customer, 'is_approver');
                 // save
                 // customer
                 // attribute
             } catch (Exception $e) {
                 Mage::log($e->getMessage(), null, 'mclog.log');
             }
             $customer->setData('is_approver', 0);
             // set approver status
             // to no
             try {
                 $customer->getResource()->saveAttribute($customer, 'is_approver');
                 // save
                 // customer
                 // attribute
             } catch (Exception $e) {
                 Mage::log($e->getMessage(), null, 'mclog.log');
             }
             $email_template = Mage::getModel('core/email_template');
             $templateId = Mage::getModel('core/email_template')->loadByCode(self::EMAIL_TEMPLATE_XML_PATH_MC1)->getId();
             // get
             // template
             // email
             // id
             // by
             // code
             // $maker_emails
             // =
             // array();
             foreach ($makers as $maker) {
                 // send mails to all the makers
                 // of the approver
                 $mail_vars = array('approver' => $customer, 'maker' => $maker);
                 // send mail
                 $email_template->sendTransactional($templateId, 'sales', $maker->getEmail(), $maker->getName(), $mail_vars);
             }
         }
     }
     // if a maker changes his/her customer type.
//.........这里部分代码省略.........
开发者ID:shebin512,项目名称:Magento_Zoff,代码行数:101,代码来源:Observer.php

示例7: markCustomerForReimport

 /**
  * @param Varien_Event_Observer $observer
  */
 public function markCustomerForReimport(Varien_Event_Observer $observer)
 {
     /* @var $customer Mage_Customer_Model_Customer */
     $customer = $observer->getCustomer();
     /* @var $contactQueue Bronto_Customer_Model_Queue */
     Mage::getModel('bronto_customer/queue')->getCustomerRow($customer->getId(), $customer->getStoreId())->setCreatedAt($customer->getCreatedAt())->setUpdatedAt(Mage::getSingleton('core/date')->gmtDate())->setBrontoImported(null)->setBrontoSuppressed(null)->save();
 }
开发者ID:bevello,项目名称:bevello,代码行数:10,代码来源:Observer.php

示例8: loginTracking

 public function loginTracking(Varien_Event_Observer $observer)
 {
     if (!Mage::getStoreConfigFlag('factfinder/config/personalization')) {
         return;
     }
     $customer = $observer->getCustomer();
     if ($customer->getId()) {
         $customerId = md5('customer_' . $customer->getId());
         /** @var $tracking Flagbit_FactFinder_Model_Handler_Tracking */
         $tracking = Mage::getModel('factfinder_tracking/handler_tracking');
         $tracking->trackLogin(Mage::helper('factfinder_tracking')->getSessionId(), null, $customerId);
     }
 }
开发者ID:KaiStapel,项目名称:Magento-FACTFinder,代码行数:13,代码来源:Observer.php

示例9: adminhtml_customer_prepare_save

 /**
  * Used ALWAYS on the save in admin and front end
  *
  * @param Varien_Event_Observer $observer
  */
 public function adminhtml_customer_prepare_save(Varien_Event_Observer $observer)
 {
     $customer = $observer->getCustomer();
     // check if new
     if ($customer->entity_id) {
         // update customer
         if ($customer->group_id != '1') {
             $this->pmtUpdate($customer);
         }
     } else {
         // new customer
         try {
             if ($customer->group_id == "1") {
             } else {
                 // Note: create and assign own clinician_group_id happens on customer_save_before
                 $this->clinicianCreateClinicianGroup($customer);
                 // register to pmt
                 $pmt_user_id = $this->pmtRegister($customer);
                 // pmt user id
                 $customer->setPmtUserId($pmt_user_id);
                 // send email for account to notify @inmedtech
                 if (Mage::app()->getRequest()->getPost('account_apply_credit')) {
                     $data = ['account_apply_credit' => Mage::app()->getRequest()->getPost('account_apply_credit') ? 'Yes' : 'No', 'account_request_limit' => Mage::app()->getRequest()->getPost('account_request_limit'), 'account_years_in_business' => Mage::app()->getRequest()->getPost('account_years_in_business'), 'account_social_security_ein' => Mage::app()->getRequest()->getPost('account_social_security_ein'), 'account_bankruptcy' => Mage::app()->getRequest()->getPost('account_bankruptcy')];
                 }
                 $this->adminEmail($customer, null, 3, null, 'admin_new_account_template', $data);
                 // if account credit
                 if (Mage::app()->getRequest()->getPost('account_apply_credit')) {
                     $this->sendRegistrationEmail($customer, 'new_account_clinician_credit_template');
                 } else {
                     $this->sendRegistrationEmail($customer, 'new_account_clinician_template');
                 }
             }
         } catch (Exception $e) {
             $this->sendErrorEmail($customer, 'No customer in observer', 1, $e->getMessage());
         }
     }
 }
开发者ID:technomagegithub,项目名称:inmed-magento,代码行数:42,代码来源:Observer.php

示例10: changeIdentity

 public function changeIdentity(Varien_Event_Observer $event)
 {
     if (!Mage::getStoreConfig('zendesk/general/customer_sync')) {
         return;
     }
     $user = null;
     $customer = $event->getCustomer();
     $email = $customer->getEmail();
     $orig_email = $customer->getOrigData();
     $orig_email = $orig_email['email'];
     //Get Customer Group
     $group_id = $customer->getGroupId();
     $group = Mage::getModel('customer/group')->load($group_id);
     //Get Customer Last Login Date
     $log_customer = Mage::getModel('log/customer')->loadByCustomer($customer);
     if ($log_customer->getLoginAt()) {
         $logged_in = date("Y-m-d\\TH:i:s\\Z", strtotime($log_customer->getLoginAt()));
     } else {
         $logged_in = "";
     }
     //Get Customer Sales Statistics
     $order_totals = Mage::getResourceModel('sales/order_collection');
     $lifetime_sale = 0;
     $average_sale = 0;
     if (is_object($order_totals)) {
         $order_totals->addFieldToSelect('*')->addFieldToFilter('customer_id', $customer->getId())->addFieldToFilter('status', Mage_Sales_Model_Order::STATE_COMPLETE)->addAttributeToSelect('grand_total')->getColumnValues('grand_total');
         $sum = 0;
         foreach ($order_totals as $total) {
             if (isset($total['grand_total'])) {
                 $sum += (double) $total['grand_total'];
             }
         }
         $lifetime_sale = Mage::helper('core')->currency($sum, true, false);
         $average_sale = Mage::helper('core')->currency($sum / (count($order_totals) ?: 1), true, false);
     }
     $info['user'] = array("name" => $customer->getFirstname() . " " . $customer->getLastname(), "email" => $email, "user_fields" => array("group" => $group->getCode(), "name" => $customer->getFirstname() . " " . $customer->getLastname(), "id" => $customer->getId(), "logged_in" => $logged_in, "average_sale" => $average_sale, "lifetime_sale" => $lifetime_sale));
     if ($orig_email && $orig_email !== $email) {
         $user = Mage::getModel('zendesk/api_users')->find($orig_email);
         if (isset($user['id'])) {
             $data['identity'] = array('type' => 'email', 'value' => $email, 'verified' => true);
             $identity = Mage::getModel('zendesk/api_users')->addIdentity($user['id'], $data);
             if (isset($identity['id'])) {
                 Mage::getModel('zendesk/api_users')->setPrimaryIdentity($user['id'], $identity['id']);
             }
         }
     }
     if (!$user) {
         $user = Mage::getModel('zendesk/api_users')->find($email);
     }
     if (isset($user['id'])) {
         $this->syncData($user['id'], $info);
     } else {
         $info['user']['verified'] = true;
         $this->createAccount($info);
     }
 }
开发者ID:buheryfi,项目名称:magento_extension,代码行数:56,代码来源:Observer.php

示例11: registerSuccess

 public function registerSuccess(Varien_Event_Observer $observer)
 {
     if ($this->_getHelper()->isEnabled()) {
         /* @var Mage_Customer_Model_Customer $customer */
         $customer = $observer->getCustomer();
         /*
          * Dados da conta
          */
         $data = $this->_getRequestDataObject();
         $data->setEmail($customer->getEmail());
         $data->setNome($customer->getName());
         $data->setAniversario($customer->getDob());
         $data->setGender($this->_getGenderLabel($customer->getGender()));
         $data->setCpfCnpj($customer->getTaxvat());
         $data->setData('store_name', $this->_getStoreDataObject()->getName());
         $this->_getApi()->addLeadConversion(self::LEAD_ACCOUNTCREATE, $data);
     }
 }
开发者ID:gabrielqs,项目名称:Flowecommerce_Resultadosdigitais,代码行数:18,代码来源:Observer.php

示例12: customerSaveAfter

 /**
  * Dummy Function for testing and code
  * TODO remove the function from config.xml and here
  *
  * @param Varien_Event_Observer $observer            
  * @return Zoffio_WmsApi_Model_Observer
  */
 public function customerSaveAfter(Varien_Event_Observer $observer)
 {
     if (self::$_observerExecutionCounter > 1) {
         return $this;
     }
     self::$_observerExecutionCounter++;
     Mage::log(__CLASS__ . "_" . __FUNCTION__, null, 'shebin.log');
     // $event = $observer->getEvent();
     $customer = $observer->getCustomer();
     Mage::log(get_class($customer), null, 'shebin.log');
     $customer_id = $customer->getId();
     $zoff_domain = 'zoffio.com';
     $wms_email_id = $customer_id . "@" . $zoff_domain;
     Mage::log($wms_email_id, null, 'shebin.log');
     $complexFilter = array('complex_filter' => array(array('key' => 'email', 'value' => array('key' => 'eq', 'value' => $wms_email_id))));
     // Mage::log($complexFilter, null, 'shebin.log');
     // Mage::log(self::$_apiPassword, null, 'shebin.log');
     // establish the connection to WMS api
     $proxy = new SoapClient(self::$_apiUrl);
     $sessionId = $proxy->login(self::$_apiUser, self::$_apiPassword);
     try {
         $customerList = $proxy->customerCustomerList($sessionId, $complexFilter);
     } catch (Exception $e) {
         Mage::log($e->getMessage(), null, 'shebin.log');
         Mage::log($e->getTraceAsString(), null, 'shebin.log');
     }
     // Mage::log($event->getData(),null,'shebin.log');
     // Mage::log($customer->getData(), null, 'shebin.log');
     Mage::log($customerList, null, 'shebin.log');
     // If Customer doesn't exist in the WMS
     if (empty($customerList)) {
         // Add the customer
         $customer_details = array('email' => $wms_email_id, 'firstname' => $customer->getFirstname(), 'lastname' => $customer->getLastname(), 'website_id' => $customer->getWebsiteId(), 'store_id' => $customer->getStoreId(), 'group_id' => $customer->getGroupId());
         Mage::log($customer_details, null, 'shebin.log');
         try {
             $result = $proxy->customerCustomerCreate($sessionId, $customer_details);
         } catch (Exception $e) {
             Mage::log($e->getMessage(), null, 'shebin.log');
             // Mage::getSingleton('core/session')->addWarning("Zoffio WMS
             // API : ".$wms_email_id." : ".$e->getMessage());
         }
         Mage::log($result, null, 'shebin.log');
         return $this;
     }
     $proxy->endSession($sessionId);
     // closing session
     return $this;
     // Mage::log($observer->getData(),null,'shebin.log');
     // Mage::dispatchEvent('admin_session_user_login_success',
     // array('user'=>$user));
     // $user = $observer->getEvent()->getUser();
     // $user->doSomething();
 }
开发者ID:shebin512,项目名称:Magento_Zoff,代码行数:60,代码来源:Observer.php

示例13: setFacebookPixelOnCustomerRegisterSuccess

 /**
  * Fired by customer_register_success event
  *
  * @param Varien_Event_Observer $observer Magento observer object
  *
  * @return $this
  */
 public function setFacebookPixelOnCustomerRegisterSuccess(Varien_Event_Observer $observer)
 {
     if (Mage::helper('hevelop_facebookpixel')->isEnabled() === false) {
         return $this;
     }
     $customer = $observer->getCustomer();
     Mage::unregister('facebookpixel_customer_registered');
     Mage::register('facebookpixel_customer_registered', $customer);
     return $this;
 }
开发者ID:hevelop,项目名称:facebookpixel,代码行数:17,代码来源:Observer.php


注:本文中的Varien_Event_Observer::getCustomer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。