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_Reports_Block_Product_Abstract
  • Mage_Reports_Block_Product_Compared
  • Mage_Reports_Block_Product_Viewed
  • Mage_Reports_Block_Product_Widget_Compared
  • Mage_Reports_Block_Product_Widget_Viewed
  • Mage_Reports_Exception
  • Mage_Reports_Helper_Data
  • Mage_Reports_Model_Config
  • Mage_Reports_Model_Event
  • Mage_Reports_Model_Event_Observer
  • Mage_Reports_Model_Event_Type
  • Mage_Reports_Model_Flag
  • Mage_Reports_Model_Grouped_Collection
  • Mage_Reports_Model_Mysql4_Accounts_Collection
  • Mage_Reports_Model_Mysql4_Coupons_Collection
  • Mage_Reports_Model_Mysql4_Customer_Collection
  • Mage_Reports_Model_Mysql4_Customer_Orders_Collection
  • Mage_Reports_Model_Mysql4_Customer_Totals_Collection
  • Mage_Reports_Model_Mysql4_Entity_Summary_Collection_Abstract
  • Mage_Reports_Model_Mysql4_Event
  • Mage_Reports_Model_Mysql4_Event_Collection
  • Mage_Reports_Model_Mysql4_Event_Type
  • Mage_Reports_Model_Mysql4_Event_Type_Collection
  • Mage_Reports_Model_Mysql4_Invoiced_Collection
  • Mage_Reports_Model_Mysql4_Order_Collection
  • Mage_Reports_Model_Mysql4_Product_Collection
  • Mage_Reports_Model_Mysql4_Product_Downloads_Collection
  • Mage_Reports_Model_Mysql4_Product_Index_Abstract
  • Mage_Reports_Model_Mysql4_Product_Index_Collection_Abstract
  • Mage_Reports_Model_Mysql4_Product_Index_Compared
  • Mage_Reports_Model_Mysql4_Product_Index_Compared_Collection
  • Mage_Reports_Model_Mysql4_Product_Index_Viewed
  • Mage_Reports_Model_Mysql4_Product_Index_Viewed_Collection
  • Mage_Reports_Model_Mysql4_Product_Lowstock_Collection
  • Mage_Reports_Model_Mysql4_Product_Ordered_Collection
  • Mage_Reports_Model_Mysql4_Product_Sold_Collection
  • Mage_Reports_Model_Mysql4_Product_Viewed_Collection
  • Mage_Reports_Model_Mysql4_Quote_Collection
  • Mage_Reports_Model_Mysql4_Refunded_Collection
  • Mage_Reports_Model_Mysql4_Report_Abstract
  • Mage_Reports_Model_Mysql4_Report_Collection
  • Mage_Reports_Model_Mysql4_Review_Collection
  • Mage_Reports_Model_Mysql4_Review_Customer_Collection
  • Mage_Reports_Model_Mysql4_Review_Product_Collection
  • Mage_Reports_Model_Mysql4_Shipping_Collection
  • Mage_Reports_Model_Mysql4_Tag_Collection
  • Mage_Reports_Model_Mysql4_Tag_Customer_Collection
  • Mage_Reports_Model_Mysql4_Tag_Product_Collection
  • Mage_Reports_Model_Mysql4_Tax_Collection
  • Mage_Reports_Model_Mysql4_Wishlist_Collection
  • Mage_Reports_Model_Mysql4_Wishlist_Product_Collection
  • Mage_Reports_Model_Product_Index_Abstract
  • Mage_Reports_Model_Product_Index_Compared
  • Mage_Reports_Model_Product_Index_Viewed
  • Mage_Reports_Model_Report
  • Mage_Reports_Model_Resource_Accounts_Collection
  • Mage_Reports_Model_Resource_Coupons_Collection
  • Mage_Reports_Model_Resource_Customer_Collection
  • Mage_Reports_Model_Resource_Customer_Orders_Collection
  • Mage_Reports_Model_Resource_Customer_Totals_Collection
  • Mage_Reports_Model_Resource_Entity_Summary_Collection_Abstract
  • Mage_Reports_Model_Resource_Event
  • Mage_Reports_Model_Resource_Event_Collection
  • Mage_Reports_Model_Resource_Event_Type
  • Mage_Reports_Model_Resource_Event_Type_Collection
  • Mage_Reports_Model_Resource_Helper_Mysql4
  • Mage_Reports_Model_Resource_Invoiced_Collection
  • Mage_Reports_Model_Resource_Order_Collection
  • Mage_Reports_Model_Resource_Product_Collection
  • Mage_Reports_Model_Resource_Product_Downloads_Collection
  • Mage_Reports_Model_Resource_Product_Index_Abstract
  • Mage_Reports_Model_Resource_Product_Index_Collection_Abstract
  • Mage_Reports_Model_Resource_Product_Index_Compared
  • Mage_Reports_Model_Resource_Product_Index_Compared_Collection
  • Mage_Reports_Model_Resource_Product_Index_Viewed
  • Mage_Reports_Model_Resource_Product_Index_Viewed_Collection
  • Mage_Reports_Model_Resource_Product_Lowstock_Collection
  • Mage_Reports_Model_Resource_Product_Ordered_Collection
  • Mage_Reports_Model_Resource_Product_Sold_Collection
  • Mage_Reports_Model_Resource_Product_Viewed_Collection
  • Mage_Reports_Model_Resource_Quote_Collection
  • Mage_Reports_Model_Resource_Refunded_Collection
  • Mage_Reports_Model_Resource_Report_Abstract
  • Mage_Reports_Model_Resource_Report_Collection
  • Mage_Reports_Model_Resource_Report_Collection_Abstract
  • Mage_Reports_Model_Resource_Report_Product_Viewed
  • Mage_Reports_Model_Resource_Report_Product_Viewed_Collection
  • Mage_Reports_Model_Resource_Review_Collection
  • Mage_Reports_Model_Resource_Review_Customer_Collection
  • Mage_Reports_Model_Resource_Review_Product_Collection
  • Mage_Reports_Model_Resource_Shipping_Collection
  • Mage_Reports_Model_Resource_Shopcart_Product_Collection
  • Mage_Reports_Model_Resource_Tag_Collection
  • Mage_Reports_Model_Resource_Tag_Customer_Collection
  • Mage_Reports_Model_Resource_Tag_Product_Collection
  • Mage_Reports_Model_Resource_Tax_Collection
  • Mage_Reports_Model_Resource_Wishlist_Collection
  • Mage_Reports_Model_Resource_Wishlist_Product_Collection
  • Mage_Reports_Model_Session
  • Mage_Reports_Model_Test
  • Mage_Reports_Model_Totals

Interfaces

  • Mage_Reports_Model_Resource_Helper_Interface
  • 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_Reports
 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:  * Reports Product Index Abstract Product Resource Collection
 30:  *
 31:  * @category    Mage
 32:  * @package     Mage_Reports
 33:  * @author      Magento Core Team <core@magentocommerce.com>
 34:  */
 35: abstract class Mage_Reports_Model_Resource_Product_Index_Collection_Abstract
 36:     extends Mage_Catalog_Model_Resource_Product_Collection
 37: {
 38:     /**
 39:      * Customer id
 40:      *
 41:      * @var null|int
 42:      */
 43:     protected $_customerId = null;
 44: 
 45:     /**
 46:      * Retrieve Product Index table name
 47:      *
 48:      */
 49:     abstract protected function _getTableName();
 50: 
 51:     /**
 52:      * Join index table
 53:      *
 54:      * @return Mage_Reports_Model_Resource_Product_Index_Collection_Abstract
 55:      */
 56:     protected function _joinIdxTable()
 57:     {
 58:         if (!$this->getFlag('is_idx_table_joined')) {
 59:             $this->joinTable(
 60:                 array('idx_table' => $this->_getTableName()),
 61:                 'product_id=entity_id',
 62:                 array(
 63:                     'product_id'    => 'product_id',
 64:                     'item_store_id' => 'store_id',
 65:                     'added_at'      => 'added_at'
 66:                 ),
 67:                 $this->_getWhereCondition()
 68:             );
 69:             $this->setFlag('is_idx_table_joined', true);
 70:         }
 71:         return $this;
 72:     }
 73: 
 74:     /**
 75:      * Add Viewed Products Index to Collection
 76:      *
 77:      * @return Mage_Reports_Model_Resource_Product_Index_Collection_Abstract
 78:      */
 79:     public function addIndexFilter()
 80:     {
 81:         $this->_joinIdxTable();
 82:         $this->_productLimitationFilters['store_table'] = 'idx_table';
 83:         $this->setFlag('url_data_object', true);
 84:         $this->setFlag('do_not_use_category_id', true);
 85:         return $this;
 86:     }
 87: 
 88:     /**
 89:      * Add filter by product ids
 90:      *
 91:      * @param array $ids
 92:      * @return Mage_Reports_Model_Resource_Product_Index_Collection_Abstract
 93:      */
 94:     public function addFilterByIds($ids)
 95:     {
 96:         if (empty($ids)) {
 97:             $this->getSelect()->where('1=0');
 98:         } else {
 99:             $this->getSelect()->where('e.entity_id IN(?)', $ids);
100:         }
101:         return $this;
102:     }
103: 
104:     /**
105:      * Retrieve Where Condition to Index table
106:      *
107:      * @return array
108:      */
109:     protected function _getWhereCondition()
110:     {
111:         $condition = array();
112: 
113:         if (Mage::getSingleton('customer/session')->isLoggedIn()) {
114:             $condition['customer_id'] = Mage::getSingleton('customer/session')->getCustomerId();
115:         } elseif ($this->_customerId) {
116:             $condition['customer_id'] = $this->_customerId;
117:         } else {
118:             $condition['visitor_id'] = Mage::getSingleton('log/visitor')->getId();
119:         }
120: 
121:         return $condition;
122:     }
123: 
124:     /**
125:      * Set customer id, that will be used in 'whereCondition'
126:      *
127:      * @param int $id
128:      * @return Mage_Reports_Model_Resource_Product_Index_Collection_Abstract
129:      */
130:     public function setCustomerId($id)
131:     {
132:         $this->_customerId = (int)$id;
133:         return $this;
134:     }
135: 
136:     /**
137:      * Add order by "added at"
138:      *
139:      * @param string $dir
140:      * @return Mage_Reports_Model_Resource_Product_Index_Collection_Abstract
141:      */
142:     public function setAddedAtOrder($dir = self::SORT_ORDER_DESC)
143:     {
144:         if ($this->getFlag('is_idx_table_joined')) {
145:             $this->getSelect()->order('added_at ' . $dir);
146:         }
147:         return $this;
148:     }
149: 
150:     /**
151:      * Add exclude Product Ids
152:      *
153:      * @param int|array $productIds
154:      * @return Mage_Reports_Model_Resource_Product_Index_Collection_Abstract
155:      */
156:     public function excludeProductIds($productIds)
157:     {
158:         if (empty($productIds)) {
159:             return $this;
160:         }
161:         $this->_joinIdxTable();
162:         $this->getSelect()->where('idx_table.product_id NOT IN(?)', $productIds);
163:         return $this;
164:     }
165: }
166: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0