Overview

Packages

  • currencysymbol
  • MAbout
  • Mage
    • Admin
    • Adminhtml
    • AdminNotification
    • Api
    • Api2
    • Authorizenet
    • Backup
    • Bundle
    • Captcha
    • Catalog
    • CatalogIndex
    • CatalogInventory
    • CatalogRule
    • CatalogSearch
    • Centinel
    • Checkout
    • Cms
    • Compiler
    • Connect
    • Contacts
    • Core
    • Cron
    • CurrencySymbol
    • Customer
    • Dataflow
    • Directory
    • DirtectPost
    • Downloadable
    • Eav
    • GiftMessage
    • GoogleAnalytics
    • GoogleBase
    • GoogleCheckout
    • ImportExport
    • Index
    • Install
    • Log
    • Media
    • Newsletter
    • Oauth
    • Page
    • PageCache
    • Paygate
    • Payment
    • Paypal
    • PaypalUk
    • Persistent
    • Poll
    • ProductAlert
    • Rating
    • Reports
    • Review
    • Rss
    • Rule
    • Sales
    • SalesRule
    • Sedfriend
    • Sendfriend
    • Shipping
    • Sitemap
    • Tag
    • Tax
    • Usa
    • Weee
    • Widget
    • Wishlist
    • XmlConnect
  • None
  • Phoenix
    • Moneybookers
  • PHP
  • Zend
    • Date
    • Mime
    • XmlRpc

Classes

  • Mage_Log_Helper_Data
  • Mage_Log_Model_Aggregation
  • Mage_Log_Model_Cron
  • Mage_Log_Model_Customer
  • Mage_Log_Model_Log
  • Mage_Log_Model_Mysql4_Aggregation
  • Mage_Log_Model_Mysql4_Customer
  • Mage_Log_Model_Mysql4_Log
  • Mage_Log_Model_Mysql4_Visitor
  • Mage_Log_Model_Mysql4_Visitor_Collection
  • Mage_Log_Model_Mysql4_Visitor_Online
  • Mage_Log_Model_Mysql4_Visitor_Online_Collection
  • Mage_Log_Model_Resource_Aggregation
  • Mage_Log_Model_Resource_Customer
  • Mage_Log_Model_Resource_Log
  • Mage_Log_Model_Resource_Visitor
  • Mage_Log_Model_Resource_Visitor_Collection
  • Mage_Log_Model_Resource_Visitor_Online
  • Mage_Log_Model_Resource_Visitor_Online_Collection
  • Mage_Log_Model_Visitor
  • Mage_Log_Model_Visitor_Online
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Magento
  4:  *
  5:  * NOTICE OF LICENSE
  6:  *
  7:  * This source file is subject to the Open Software License (OSL 3.0)
  8:  * that is bundled with this package in the file LICENSE.txt.
  9:  * It is also available through the world-wide-web at this URL:
 10:  * http://opensource.org/licenses/osl-3.0.php
 11:  * If you did not receive a copy of the license and are unable to
 12:  * obtain it through the world-wide-web, please send an email
 13:  * to license@magentocommerce.com so we can send you a copy immediately.
 14:  *
 15:  * DISCLAIMER
 16:  *
 17:  * Do not edit or add to this file if you wish to upgrade Magento to newer
 18:  * versions in the future. If you wish to customize Magento for your
 19:  * needs please refer to http://www.magentocommerce.com for more information.
 20:  *
 21:  * @category    Mage
 22:  * @package     Mage_Log
 23:  * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 24:  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 25:  */
 26: 
 27: 
 28: /**
 29:  * Customer log resource
 30:  *
 31:  * @category   Mage
 32:  * @package    Mage_Log
 33:  * @author     Magento Core Team <core@magentocommerce.com>
 34:  */
 35: 
 36: class Mage_Log_Model_Resource_Customer extends Mage_Core_Model_Resource_Db_Abstract
 37: {
 38:     /**
 39:      * Visitor data table name
 40:      *
 41:      * @var string
 42:      */
 43:     protected $_visitorTable;
 44: 
 45:     /**
 46:      * Visitor info data table
 47:      *
 48:      * @var string
 49:      */
 50:     protected $_visitorInfoTable;
 51: 
 52:     /**
 53:      * Customer data table
 54:      *
 55:      * @var string
 56:      */
 57:     protected $_customerTable;
 58: 
 59:     /**
 60:      * Url info data table
 61:      *
 62:      * @var string
 63:      */
 64:     protected $_urlInfoTable;
 65: 
 66:     /**
 67:      * Log URL data table name.
 68:      *
 69:      * @var string
 70:      */
 71:     protected $_urlTable;
 72: 
 73:     /**
 74:      * Log quote data table name.
 75:      *
 76:      * @var string
 77:      */
 78:     protected $_quoteTable;
 79: 
 80:     /**
 81:      * Resource initialization
 82:      */
 83:     protected function _construct()
 84:     {
 85:         $this->_init('log/customer', 'log_id');
 86: 
 87:         $this->_visitorTable        = $this->getTable('log/visitor');
 88:         $this->_visitorInfoTable    = $this->getTable('log/visitor_info');
 89:         $this->_urlTable            = $this->getTable('log/url_table');
 90:         $this->_urlInfoTable        = $this->getTable('log/url_info_table');
 91:         $this->_customerTable       = $this->getTable('log/customer');
 92:         $this->_quoteTable          = $this->getTable('log/quote_table');
 93:     }
 94: 
 95:     /**
 96:      * Retrieve select object for load object data
 97:      * 
 98:      * @param string $field
 99:      * @param mixed $value
100:      * @param Mage_Log_Model_Customer $object
101:      * @return Varien_Db_Select
102:      */
103:     protected function _getLoadSelect($field, $value, $object)
104:     {
105:         $select = parent::_getLoadSelect($field, $value, $object);
106:         if ($field == 'customer_id') {
107:             // load additional data by last login
108:             $table  = $this->getMainTable();
109:             $select
110:                 ->joinInner(
111:                     array('lvt' => $this->_visitorTable),
112:                     "lvt.visitor_id = {$table}.visitor_id",
113:                     array('last_visit_at'))
114:                 ->joinInner(
115:                     array('lvit' => $this->_visitorInfoTable),
116:                     'lvt.visitor_id = lvit.visitor_id',
117:                     array('http_referer', 'remote_addr'))
118:                 ->joinInner(
119:                     array('luit' => $this->_urlInfoTable),
120:                     'luit.url_id = lvt.last_url_id',
121:                     array('url'))
122:                 ->order("{$table}.login_at DESC")
123:                 ->limit(1);
124:         }
125:         return $select;
126:     }
127: }
128: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0