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_Catalog_Block_Breadcrumbs
  • Mage_Catalog_Block_Category_View
  • Mage_Catalog_Block_Category_Widget_Link
  • Mage_Catalog_Block_Layer_Filter_Abstract
  • Mage_Catalog_Block_Layer_Filter_Attribute
  • Mage_Catalog_Block_Layer_Filter_Category
  • Mage_Catalog_Block_Layer_Filter_Decimal
  • Mage_Catalog_Block_Layer_Filter_Price
  • Mage_Catalog_Block_Layer_State
  • Mage_Catalog_Block_Layer_View
  • Mage_Catalog_Block_Navigation
  • Mage_Catalog_Block_Product
  • Mage_Catalog_Block_Product_Abstract
  • Mage_Catalog_Block_Product_Compare_Abstract
  • Mage_Catalog_Block_Product_Compare_List
  • Mage_Catalog_Block_Product_Compare_Sidebar
  • Mage_Catalog_Block_Product_Gallery
  • Mage_Catalog_Block_Product_List
  • Mage_Catalog_Block_Product_List_Crosssell
  • Mage_Catalog_Block_Product_List_Promotion
  • Mage_Catalog_Block_Product_List_Random
  • Mage_Catalog_Block_Product_List_Related
  • Mage_Catalog_Block_Product_List_Toolbar
  • Mage_Catalog_Block_Product_List_Upsell
  • Mage_Catalog_Block_Product_New
  • Mage_Catalog_Block_Product_Price
  • Mage_Catalog_Block_Product_Price_Template
  • Mage_Catalog_Block_Product_Send
  • Mage_Catalog_Block_Product_View
  • Mage_Catalog_Block_Product_View_Abstract
  • Mage_Catalog_Block_Product_View_Additional
  • Mage_Catalog_Block_Product_View_Attributes
  • Mage_Catalog_Block_Product_View_Description
  • Mage_Catalog_Block_Product_View_Media
  • Mage_Catalog_Block_Product_View_Options
  • Mage_Catalog_Block_Product_View_Options_Abstract
  • Mage_Catalog_Block_Product_View_Options_Type_Date
  • Mage_Catalog_Block_Product_View_Options_Type_Default
  • Mage_Catalog_Block_Product_View_Options_Type_File
  • Mage_Catalog_Block_Product_View_Options_Type_Select
  • Mage_Catalog_Block_Product_View_Options_Type_Text
  • Mage_Catalog_Block_Product_View_Price
  • Mage_Catalog_Block_Product_View_Tabs
  • Mage_Catalog_Block_Product_View_Type_Configurable
  • Mage_Catalog_Block_Product_View_Type_Grouped
  • Mage_Catalog_Block_Product_View_Type_Simple
  • Mage_Catalog_Block_Product_View_Type_Virtual
  • Mage_Catalog_Block_Product_Widget_Link
  • Mage_Catalog_Block_Product_Widget_New
  • Mage_Catalog_Block_Seo_Sitemap_Abstract
  • Mage_Catalog_Block_Seo_Sitemap_Category
  • Mage_Catalog_Block_Seo_Sitemap_Product
  • Mage_Catalog_Block_Seo_Sitemap_Tree_Category
  • Mage_Catalog_Block_Widget_Link
  • Mage_Catalog_CategoryController
  • Mage_Catalog_Exception
  • Mage_Catalog_Helper_Category
  • Mage_Catalog_Helper_Category_Flat
  • Mage_Catalog_Helper_Data
  • Mage_Catalog_Helper_Image
  • Mage_Catalog_Helper_Map
  • Mage_Catalog_Helper_Output
  • Mage_Catalog_Helper_Product
  • Mage_Catalog_Helper_Product_Compare
  • Mage_Catalog_Helper_Product_Configuration
  • Mage_Catalog_Helper_Product_Flat
  • Mage_Catalog_Helper_Product_Options
  • Mage_Catalog_Helper_Product_Url
  • Mage_Catalog_Helper_Product_View
  • Mage_Catalog_IndexController
  • Mage_Catalog_Model_Abstract
  • Mage_Catalog_Model_Api2_Product
  • Mage_Catalog_Model_Api2_Product_Category
  • Mage_Catalog_Model_Api2_Product_Category_Rest
  • Mage_Catalog_Model_Api2_Product_Category_Rest_Admin_V1
  • Mage_Catalog_Model_Api2_Product_Category_Rest_Customer_V1
  • Mage_Catalog_Model_Api2_Product_Category_Rest_Guest_V1
  • Mage_Catalog_Model_Api2_Product_Image
  • Mage_Catalog_Model_Api2_Product_Image_Rest
  • Mage_Catalog_Model_Api2_Product_Image_Rest_Admin_V1
  • Mage_Catalog_Model_Api2_Product_Image_Rest_Customer_V1
  • Mage_Catalog_Model_Api2_Product_Image_Rest_Guest_V1
  • Mage_Catalog_Model_Api2_Product_Image_Validator_Image
  • Mage_Catalog_Model_Api2_Product_Rest
  • Mage_Catalog_Model_Api2_Product_Rest_Admin_V1
  • Mage_Catalog_Model_Api2_Product_Rest_Customer_V1
  • Mage_Catalog_Model_Api2_Product_Rest_Guest_V1
  • Mage_Catalog_Model_Api2_Product_Validator_Product
  • Mage_Catalog_Model_Api2_Product_Website
  • Mage_Catalog_Model_Api2_Product_Website_Rest
  • Mage_Catalog_Model_Api2_Product_Website_Rest_Admin_V1
  • Mage_Catalog_Model_Api2_Product_Website_Validator_Admin_Website
  • Mage_Catalog_Model_Api_Resource
  • Mage_Catalog_Model_Attribute_Backend_Customlayoutupdate
  • Mage_Catalog_Model_Category
  • Mage_Catalog_Model_Category_Api
  • Mage_Catalog_Model_Category_Api_V2
  • Mage_Catalog_Model_Category_Attribute_Api
  • Mage_Catalog_Model_Category_Attribute_Api_V2
  • Mage_Catalog_Model_Category_Attribute_Backend_Image
  • Mage_Catalog_Model_Category_Attribute_Backend_Sortby
  • Mage_Catalog_Model_Category_Attribute_Backend_Urlkey
  • Mage_Catalog_Model_Category_Attribute_Source_Layout
  • Mage_Catalog_Model_Category_Attribute_Source_Mode
  • Mage_Catalog_Model_Category_Attribute_Source_Page
  • Mage_Catalog_Model_Category_Attribute_Source_Sortby
  • Mage_Catalog_Model_Category_Indexer_Flat
  • Mage_Catalog_Model_Category_Indexer_Product
  • Mage_Catalog_Model_Config
  • Mage_Catalog_Model_Convert
  • Mage_Catalog_Model_Convert_Adapter_Catalog
  • Mage_Catalog_Model_Convert_Adapter_Product
  • Mage_Catalog_Model_Convert_Parser_Product
  • Mage_Catalog_Model_Design
  • Mage_Catalog_Model_Entity_Attribute
  • Mage_Catalog_Model_Entity_Product_Attribute_Frontend_Image
  • Mage_Catalog_Model_Index
  • Mage_Catalog_Model_Indexer_Url
  • Mage_Catalog_Model_Layer
  • Mage_Catalog_Model_Layer_Filter_Abstract
  • Mage_Catalog_Model_Layer_Filter_Attribute
  • Mage_Catalog_Model_Layer_Filter_Category
  • Mage_Catalog_Model_Layer_Filter_Decimal
  • Mage_Catalog_Model_Layer_Filter_Item
  • Mage_Catalog_Model_Layer_Filter_Price
  • Mage_Catalog_Model_Layer_Filter_Price_Algorithm
  • Mage_Catalog_Model_Layer_State
  • Mage_Catalog_Model_Observer
  • Mage_Catalog_Model_Product
  • Mage_Catalog_Model_Product_Action
  • Mage_Catalog_Model_Product_Api
  • Mage_Catalog_Model_Product_Api_V2
  • Mage_Catalog_Model_Product_Attribute_Api
  • Mage_Catalog_Model_Product_Attribute_Api_V2
  • Mage_Catalog_Model_Product_Attribute_Backend_Boolean
  • Mage_Catalog_Model_Product_Attribute_Backend_Groupprice
  • Mage_Catalog_Model_Product_Attribute_Backend_Groupprice_Abstract
  • Mage_Catalog_Model_Product_Attribute_Backend_Media
  • Mage_Catalog_Model_Product_Attribute_Backend_Msrp
  • Mage_Catalog_Model_Product_Attribute_Backend_Price
  • Mage_Catalog_Model_Product_Attribute_Backend_Recurring
  • Mage_Catalog_Model_Product_Attribute_Backend_Sku
  • Mage_Catalog_Model_Product_Attribute_Backend_Startdate
  • Mage_Catalog_Model_Product_Attribute_Backend_Tierprice
  • Mage_Catalog_Model_Product_Attribute_Backend_Urlkey
  • Mage_Catalog_Model_Product_Attribute_Frontend_Image
  • Mage_Catalog_Model_Product_Attribute_Group
  • Mage_Catalog_Model_Product_Attribute_Media_Api
  • Mage_Catalog_Model_Product_Attribute_Media_Api_V2
  • Mage_Catalog_Model_Product_Attribute_Set_Api
  • Mage_Catalog_Model_Product_Attribute_Set_Api_V2
  • Mage_Catalog_Model_Product_Attribute_Source_Boolean
  • Mage_Catalog_Model_Product_Attribute_Source_Countryofmanufacture
  • Mage_Catalog_Model_Product_Attribute_Source_Layout
  • Mage_Catalog_Model_Product_Attribute_Source_Msrp_Type
  • Mage_Catalog_Model_Product_Attribute_Source_Msrp_Type_Enabled
  • Mage_Catalog_Model_Product_Attribute_Source_Msrp_Type_Price
  • Mage_Catalog_Model_Product_Attribute_Tierprice_Api
  • Mage_Catalog_Model_Product_Attribute_Tierprice_Api_V2
  • Mage_Catalog_Model_Product_Compare_Item
  • Mage_Catalog_Model_Product_Compare_List
  • Mage_Catalog_Model_Product_Condition
  • Mage_Catalog_Model_Product_Configuration_Item_Option
  • Mage_Catalog_Model_Product_Flat_Flag
  • Mage_Catalog_Model_Product_Flat_Indexer
  • Mage_Catalog_Model_Product_Flat_Observer
  • Mage_Catalog_Model_Product_Image
  • Mage_Catalog_Model_Product_Indexer_Eav
  • Mage_Catalog_Model_Product_Indexer_Flat
  • Mage_Catalog_Model_Product_Indexer_Price
  • Mage_Catalog_Model_Product_Link
  • Mage_Catalog_Model_Product_Link_Api
  • Mage_Catalog_Model_Product_Link_Api_V2
  • Mage_Catalog_Model_Product_Media_Config
  • Mage_Catalog_Model_Product_Option
  • Mage_Catalog_Model_Product_Option_Api
  • Mage_Catalog_Model_Product_Option_Api_V2
  • Mage_Catalog_Model_Product_Option_Observer
  • Mage_Catalog_Model_Product_Option_Type_Date
  • Mage_Catalog_Model_Product_Option_Type_Default
  • Mage_Catalog_Model_Product_Option_Type_File
  • Mage_Catalog_Model_Product_Option_Type_Select
  • Mage_Catalog_Model_Product_Option_Type_Text
  • Mage_Catalog_Model_Product_Option_Value
  • Mage_Catalog_Model_Product_Option_Value_Api
  • Mage_Catalog_Model_Product_Option_Value_Api_V2
  • Mage_Catalog_Model_Product_Status
  • Mage_Catalog_Model_Product_Type
  • Mage_Catalog_Model_Product_Type_Abstract
  • Mage_Catalog_Model_Product_Type_Api
  • Mage_Catalog_Model_Product_Type_Api_V2
  • Mage_Catalog_Model_Product_Type_Configurable
  • Mage_Catalog_Model_Product_Type_Configurable_Attribute
  • Mage_Catalog_Model_Product_Type_Configurable_Price
  • Mage_Catalog_Model_Product_Type_Grouped
  • Mage_Catalog_Model_Product_Type_Grouped_Price
  • Mage_Catalog_Model_Product_Type_Price
  • Mage_Catalog_Model_Product_Type_Simple
  • Mage_Catalog_Model_Product_Type_Virtual
  • Mage_Catalog_Model_Product_Url
  • Mage_Catalog_Model_Product_Visibility
  • Mage_Catalog_Model_Product_Website
  • Mage_Catalog_Model_Resource_Abstract
  • Mage_Catalog_Model_Resource_Attribute
  • Mage_Catalog_Model_Resource_Category
  • Mage_Catalog_Model_Resource_Category_Attribute_Collection
  • Mage_Catalog_Model_Resource_Category_Attribute_Frontend_Image
  • Mage_Catalog_Model_Resource_Category_Attribute_Source_Layout
  • Mage_Catalog_Model_Resource_Category_Attribute_Source_Mode
  • Mage_Catalog_Model_Resource_Category_Attribute_Source_Page
  • Mage_Catalog_Model_Resource_Category_Collection
  • Mage_Catalog_Model_Resource_Category_Flat
  • Mage_Catalog_Model_Resource_Category_Flat_Collection
  • Mage_Catalog_Model_Resource_Category_Indexer_Product
  • Mage_Catalog_Model_Resource_Category_Tree
  • Mage_Catalog_Model_Resource_Collection_Abstract
  • Mage_Catalog_Model_Resource_Config
  • Mage_Catalog_Model_Resource_Eav_Attribute
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Abstract
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Attribute
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Category
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Attribute_Collection
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Attribute_Frontend_Image
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Attribute_Source_Layout
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Attribute_Source_Mode
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Attribute_Source_Page
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Flat
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Flat_Collection
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Indexer_Product
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Tree
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Collection_Abstract
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Config
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Layer_Filter_Attribute
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Layer_Filter_Decimal
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Layer_Filter_Price
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Action
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Attribute_Backend_Image
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Attribute_Backend_Media
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Attribute_Backend_Tierprice
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Attribute_Backend_Urlkey
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Attribute_Collection
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Attribute_Frontend_Image
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Attribute_Frontend_Tierprice
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Compare_Item
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Compare_Item_Collection
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Flat
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Flat_Indexer
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Indexer_Abstract
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Indexer_Eav
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Indexer_Eav_Abstract
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Indexer_Eav_Decimal
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Indexer_Eav_Source
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Indexer_Price
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Indexer_Price_Configurable
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Indexer_Price_Default
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Indexer_Price_Grouped
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Link
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Link_Collection
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Link_Product_Collection
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Option
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Option_Collection
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Option_Value
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Option_Value_Collection
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Relation
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Status
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Type_Configurable
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Type_Configurable_Attribute
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Type_Configurable_Attribute_Collection
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Type_Configurable_Product_Collection
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Website
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Sendfriend
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Sendfriend_Collection
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Setup
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Url
  • Mage_Catalog_Model_Resource_Helper_Mysql4
  • Mage_Catalog_Model_Resource_Layer_Filter_Attribute
  • Mage_Catalog_Model_Resource_Layer_Filter_Decimal
  • Mage_Catalog_Model_Resource_Layer_Filter_Price
  • Mage_Catalog_Model_Resource_Product
  • Mage_Catalog_Model_Resource_Product_Action
  • Mage_Catalog_Model_Resource_Product_Attribute_Backend_Groupprice
  • Mage_Catalog_Model_Resource_Product_Attribute_Backend_Groupprice_Abstract
  • Mage_Catalog_Model_Resource_Product_Attribute_Backend_Image
  • Mage_Catalog_Model_Resource_Product_Attribute_Backend_Media
  • Mage_Catalog_Model_Resource_Product_Attribute_Backend_Tierprice
  • Mage_Catalog_Model_Resource_Product_Attribute_Backend_Urlkey
  • Mage_Catalog_Model_Resource_Product_Attribute_Collection
  • Mage_Catalog_Model_Resource_Product_Attribute_Frontend_Image
  • Mage_Catalog_Model_Resource_Product_Attribute_Frontend_Tierprice
  • Mage_Catalog_Model_Resource_Product_Collection
  • Mage_Catalog_Model_Resource_Product_Compare_Item
  • Mage_Catalog_Model_Resource_Product_Compare_Item_Collection
  • Mage_Catalog_Model_Resource_Product_Flat
  • Mage_Catalog_Model_Resource_Product_Flat_Indexer
  • Mage_Catalog_Model_Resource_Product_Indexer_Abstract
  • Mage_Catalog_Model_Resource_Product_Indexer_Eav
  • Mage_Catalog_Model_Resource_Product_Indexer_Eav_Abstract
  • Mage_Catalog_Model_Resource_Product_Indexer_Eav_Decimal
  • Mage_Catalog_Model_Resource_Product_Indexer_Eav_Source
  • Mage_Catalog_Model_Resource_Product_Indexer_Price
  • Mage_Catalog_Model_Resource_Product_Indexer_Price_Configurable
  • Mage_Catalog_Model_Resource_Product_Indexer_Price_Default
  • Mage_Catalog_Model_Resource_Product_Indexer_Price_Grouped
  • Mage_Catalog_Model_Resource_Product_Link
  • Mage_Catalog_Model_Resource_Product_Link_Collection
  • Mage_Catalog_Model_Resource_Product_Link_Product_Collection
  • Mage_Catalog_Model_Resource_Product_Option
  • Mage_Catalog_Model_Resource_Product_Option_Collection
  • Mage_Catalog_Model_Resource_Product_Option_Value
  • Mage_Catalog_Model_Resource_Product_Option_Value_Collection
  • Mage_Catalog_Model_Resource_Product_Relation
  • Mage_Catalog_Model_Resource_Product_Status
  • Mage_Catalog_Model_Resource_Product_Type_Configurable
  • Mage_Catalog_Model_Resource_Product_Type_Configurable_Attribute
  • Mage_Catalog_Model_Resource_Product_Type_Configurable_Attribute_Collection
  • Mage_Catalog_Model_Resource_Product_Type_Configurable_Product_Collection
  • Mage_Catalog_Model_Resource_Product_Website
  • Mage_Catalog_Model_Resource_Setup
  • Mage_Catalog_Model_Resource_Url
  • Mage_Catalog_Model_Session
  • Mage_Catalog_Model_System_Config_Backend_Catalog_Category_Flat
  • Mage_Catalog_Model_System_Config_Backend_Catalog_Product_Flat
  • Mage_Catalog_Model_System_Config_Backend_Catalog_Url_Rewrite_Suffix
  • Mage_Catalog_Model_Template_Filter
  • Mage_Catalog_Model_Url
  • Mage_Catalog_Product_CompareController
  • Mage_Catalog_ProductController
  • Mage_Catalog_Seo_SitemapController
  • Mage_CatalogSearch_Model_Resource_Helper_Mysql4
  • Mage_XmlConnect_Model_Catalog_Category_Media_Config

Interfaces

  • Mage_Catalog_Helper_Product_Configuration_Interface
  • Mage_Catalog_Model_Product_Condition_Interface
  • Mage_Catalog_Model_Product_Configuration_Item_Interface
  • Mage_Catalog_Model_Product_Configuration_Item_Option_Interface
  • Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Indexer_Price_Interface
  • Mage_Catalog_Model_Resource_Product_Indexer_Price_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_Catalog
  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:  * Catalog product model
  29:  *
  30:  * @method Mage_Catalog_Model_Resource_Product getResource()
  31:  * @method Mage_Catalog_Model_Resource_Product _getResource()
  32:  *
  33:  * @category   Mage
  34:  * @package    Mage_Catalog
  35:  * @author      Magento Core Team <core@magentocommerce.com>
  36:  */
  37: class Mage_Catalog_Model_Product extends Mage_Catalog_Model_Abstract
  38: {
  39:     /**
  40:      * Entity code.
  41:      * Can be used as part of method name for entity processing
  42:      */
  43:     const ENTITY                 = 'catalog_product';
  44: 
  45:     const CACHE_TAG              = 'catalog_product';
  46:     protected $_cacheTag         = 'catalog_product';
  47:     protected $_eventPrefix      = 'catalog_product';
  48:     protected $_eventObject      = 'product';
  49:     protected $_canAffectOptions = false;
  50: 
  51:     /**
  52:      * Product type instance
  53:      *
  54:      * @var Mage_Catalog_Model_Product_Type_Abstract
  55:      */
  56:     protected $_typeInstance            = null;
  57: 
  58:     /**
  59:      * Product type instance as singleton
  60:      */
  61:     protected $_typeInstanceSingleton   = null;
  62: 
  63:     /**
  64:      * Product link instance
  65:      *
  66:      * @var Mage_Catalog_Model_Product_Link
  67:      */
  68:     protected $_linkInstance;
  69: 
  70:     /**
  71:      * Product object customization (not stored in DB)
  72:      *
  73:      * @var array
  74:      */
  75:     protected $_customOptions = array();
  76: 
  77:     /**
  78:      * Product Url Instance
  79:      *
  80:      * @var Mage_Catalog_Model_Product_Url
  81:      */
  82:     protected $_urlModel = null;
  83: 
  84:     protected static $_url;
  85:     protected static $_urlRewrite;
  86: 
  87:     protected $_errors = array();
  88: 
  89:     protected $_optionInstance;
  90: 
  91:     protected $_options = array();
  92: 
  93:     /**
  94:      * Product reserved attribute codes
  95:      */
  96:     protected $_reservedAttributes;
  97: 
  98:     /**
  99:      * Flag for available duplicate function
 100:      *
 101:      * @var boolean
 102:      */
 103:     protected $_isDuplicable = true;
 104: 
 105:     /**
 106:      * Flag for get Price function
 107:      *
 108:      * @var boolean
 109:      */
 110:     protected $_calculatePrice = true;
 111: 
 112:     /**
 113:      * Initialize resources
 114:      */
 115:     protected function _construct()
 116:     {
 117:         $this->_init('catalog/product');
 118:     }
 119: 
 120:     /**
 121:      * Init mapping array of short fields to
 122:      * its full names
 123:      *
 124:      * @return Varien_Object
 125:      */
 126:     protected function _initOldFieldsMap()
 127:     {
 128:         $this->_oldFieldsMap = Mage::helper('catalog')->getOldFieldMap();
 129:         return $this;
 130:     }
 131: 
 132:     /**
 133:      * Retrieve Store Id
 134:      *
 135:      * @return int
 136:      */
 137:     public function getStoreId()
 138:     {
 139:         if ($this->hasData('store_id')) {
 140:             return $this->getData('store_id');
 141:         }
 142:         return Mage::app()->getStore()->getId();
 143:     }
 144: 
 145:     /**
 146:      * Get collection instance
 147:      *
 148:      * @return object
 149:      */
 150:     public function getResourceCollection()
 151:     {
 152:         if (empty($this->_resourceCollectionName)) {
 153:             Mage::throwException(Mage::helper('catalog')->__('The model collection resource name is not defined.'));
 154:         }
 155:         $collection = Mage::getResourceModel($this->_resourceCollectionName);
 156:         $collection->setStoreId($this->getStoreId());
 157:         return $collection;
 158:     }
 159: 
 160:     /**
 161:      * Get product url model
 162:      *
 163:      * @return Mage_Catalog_Model_Product_Url
 164:      */
 165:     public function getUrlModel()
 166:     {
 167:         if ($this->_urlModel === null) {
 168:             $this->_urlModel = Mage::getSingleton('catalog/product_url');
 169:         }
 170:         return $this->_urlModel;
 171:     }
 172: 
 173:     /**
 174:      * Validate Product Data
 175:      *
 176:      * @todo implement full validation process with errors returning which are ignoring now
 177:      *
 178:      * @return Mage_Catalog_Model_Product
 179:      */
 180:     public function validate()
 181:     {
 182: //        $this->getAttributes();
 183: //        Mage::dispatchEvent($this->_eventPrefix.'_validate_before', array($this->_eventObject=>$this));
 184: //        $result = $this->_getResource()->validate($this);
 185: //        Mage::dispatchEvent($this->_eventPrefix.'_validate_after', array($this->_eventObject=>$this));
 186: //        return $result;
 187:         Mage::dispatchEvent($this->_eventPrefix.'_validate_before', array($this->_eventObject=>$this));
 188:         $this->_getResource()->validate($this);
 189:         Mage::dispatchEvent($this->_eventPrefix.'_validate_after', array($this->_eventObject=>$this));
 190:         return $this;
 191:     }
 192: 
 193:     /**
 194:      * Get product name
 195:      *
 196:      * @return string
 197:      */
 198:     public function getName()
 199:     {
 200:         return $this->_getData('name');
 201:     }
 202: 
 203:     /**
 204:      * Get product price throught type instance
 205:      *
 206:      * @return unknown
 207:      */
 208:     public function getPrice()
 209:     {
 210:         if ($this->_calculatePrice || !$this->getData('price')) {
 211:             return $this->getPriceModel()->getPrice($this);
 212:         } else {
 213:             return $this->getData('price');
 214:         }
 215:     }
 216: 
 217:     /**
 218:      * Set Price calculation flag
 219:      *
 220:      * @param bool $calculate
 221:      * @return void
 222:      */
 223:     public function setPriceCalculation($calculate = true)
 224:     {
 225:         $this->_calculatePrice = $calculate;
 226:     }
 227: 
 228:     /**
 229:      * Get product type identifier
 230:      *
 231:      * @return string
 232:      */
 233:     public function getTypeId()
 234:     {
 235:         return $this->_getData('type_id');
 236:     }
 237: 
 238:     /**
 239:      * Get product status
 240:      *
 241:      * @return int
 242:      */
 243:     public function getStatus()
 244:     {
 245:         if (is_null($this->_getData('status'))) {
 246:             $this->setData('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
 247:         }
 248:         return $this->_getData('status');
 249:     }
 250: 
 251:     /**
 252:      * Retrieve type instance
 253:      *
 254:      * Type instance implement type depended logic
 255:      *
 256:      * @param  bool $singleton
 257:      * @return Mage_Catalog_Model_Product_Type_Abstract
 258:      */
 259:     public function getTypeInstance($singleton = false)
 260:     {
 261:         if ($singleton === true) {
 262:             if (is_null($this->_typeInstanceSingleton)) {
 263:                 $this->_typeInstanceSingleton = Mage::getSingleton('catalog/product_type')
 264:                     ->factory($this, true);
 265:             }
 266:             return $this->_typeInstanceSingleton;
 267:         }
 268: 
 269:         if ($this->_typeInstance === null) {
 270:             $this->_typeInstance = Mage::getSingleton('catalog/product_type')
 271:                 ->factory($this);
 272:         }
 273:         return $this->_typeInstance;
 274:     }
 275: 
 276:     /**
 277:      * Set type instance for external
 278:      *
 279:      * @param Mage_Catalog_Model_Product_Type_Abstract $instance  Product type instance
 280:      * @param bool                                     $singleton Whether instance is singleton
 281:      * @return Mage_Catalog_Model_Product
 282:      */
 283:     public function setTypeInstance($instance, $singleton = false)
 284:     {
 285:         if ($singleton === true) {
 286:             $this->_typeInstanceSingleton = $instance;
 287:         } else {
 288:             $this->_typeInstance = $instance;
 289:         }
 290:         return $this;
 291:     }
 292: 
 293:     /**
 294:      * Retrieve link instance
 295:      *
 296:      * @return  Mage_Catalog_Model_Product_Link
 297:      */
 298:     public function getLinkInstance()
 299:     {
 300:         if (!$this->_linkInstance) {
 301:             $this->_linkInstance = Mage::getSingleton('catalog/product_link');
 302:         }
 303:         return $this->_linkInstance;
 304:     }
 305: 
 306:     /**
 307:      * Retrive product id by sku
 308:      *
 309:      * @param   string $sku
 310:      * @return  integer
 311:      */
 312:     public function getIdBySku($sku)
 313:     {
 314:         return $this->_getResource()->getIdBySku($sku);
 315:     }
 316: 
 317:     /**
 318:      * Retrieve product category id
 319:      *
 320:      * @return int
 321:      */
 322:     public function getCategoryId()
 323:     {
 324:         if ($category = Mage::registry('current_category')) {
 325:             return $category->getId();
 326:         }
 327:         return false;
 328:     }
 329: 
 330:     /**
 331:      * Retrieve product category
 332:      *
 333:      * @return Mage_Catalog_Model_Category
 334:      */
 335:     public function getCategory()
 336:     {
 337:         $category = $this->getData('category');
 338:         if (is_null($category) && $this->getCategoryId()) {
 339:             $category = Mage::getModel('catalog/category')->load($this->getCategoryId());
 340:             $this->setCategory($category);
 341:         }
 342:         return $category;
 343:     }
 344: 
 345:     /**
 346:      * Set assigned category IDs array to product
 347:      *
 348:      * @param array|string $ids
 349:      * @return Mage_Catalog_Model_Product
 350:      */
 351:     public function setCategoryIds($ids)
 352:     {
 353:         if (is_string($ids)) {
 354:             $ids = explode(',', $ids);
 355:         } elseif (!is_array($ids)) {
 356:             Mage::throwException(Mage::helper('catalog')->__('Invalid category IDs.'));
 357:         }
 358:         foreach ($ids as $i => $v) {
 359:             if (empty($v)) {
 360:                 unset($ids[$i]);
 361:             }
 362:         }
 363: 
 364:         $this->setData('category_ids', $ids);
 365:         return $this;
 366:     }
 367: 
 368:     /**
 369:      * Retrieve assigned category Ids
 370:      *
 371:      * @return array
 372:      */
 373:     public function getCategoryIds()
 374:     {
 375:         if (! $this->hasData('category_ids')) {
 376:             $wasLocked = false;
 377:             if ($this->isLockedAttribute('category_ids')) {
 378:                 $wasLocked = true;
 379:                 $this->unlockAttribute('category_ids');
 380:             }
 381:             $ids = $this->_getResource()->getCategoryIds($this);
 382:             $this->setData('category_ids', $ids);
 383:             if ($wasLocked) {
 384:                 $this->lockAttribute('category_ids');
 385:             }
 386:         }
 387: 
 388:         return (array) $this->_getData('category_ids');
 389:     }
 390: 
 391:     /**
 392:      * Retrieve product categories
 393:      *
 394:      * @return Varien_Data_Collection
 395:      */
 396:     public function getCategoryCollection()
 397:     {
 398:         return $this->_getResource()->getCategoryCollection($this);
 399:     }
 400: 
 401:     /**
 402:      * Retrieve product websites identifiers
 403:      *
 404:      * @return array
 405:      */
 406:     public function getWebsiteIds()
 407:     {
 408:         if (!$this->hasWebsiteIds()) {
 409:             $ids = $this->_getResource()->getWebsiteIds($this);
 410:             $this->setWebsiteIds($ids);
 411:         }
 412:         return $this->getData('website_ids');
 413:     }
 414: 
 415:     /**
 416:      * Get all sore ids where product is presented
 417:      *
 418:      * @return array
 419:      */
 420:     public function getStoreIds()
 421:     {
 422:         if (!$this->hasStoreIds()) {
 423:             $storeIds = array();
 424:             if ($websiteIds = $this->getWebsiteIds()) {
 425:                 foreach ($websiteIds as $websiteId) {
 426:                     $websiteStores = Mage::app()->getWebsite($websiteId)->getStoreIds();
 427:                     $storeIds = array_merge($storeIds, $websiteStores);
 428:                 }
 429:             }
 430:             $this->setStoreIds($storeIds);
 431:         }
 432:         return $this->getData('store_ids');
 433:     }
 434: 
 435:     /**
 436:      * Retrieve product attributes
 437:      * if $groupId is null - retrieve all product attributes
 438:      *
 439:      * @param int  $groupId   Retrieve attributes of the specified group
 440:      * @param bool $skipSuper Not used
 441:      * @return array
 442:      */
 443:     public function getAttributes($groupId = null, $skipSuper = false)
 444:     {
 445:         $productAttributes = $this->getTypeInstance(true)->getEditableAttributes($this);
 446:         if ($groupId) {
 447:             $attributes = array();
 448:             foreach ($productAttributes as $attribute) {
 449:                 if ($attribute->isInGroup($this->getAttributeSetId(), $groupId)) {
 450:                     $attributes[] = $attribute;
 451:                 }
 452:             }
 453:         } else {
 454:             $attributes = $productAttributes;
 455:         }
 456: 
 457:         return $attributes;
 458:     }
 459: 
 460:     /**
 461:      * Check product options and type options and save them, too
 462:      */
 463:     protected function _beforeSave()
 464:     {
 465:         $this->cleanCache();
 466:         $this->setTypeHasOptions(false);
 467:         $this->setTypeHasRequiredOptions(false);
 468: 
 469:         $this->getTypeInstance(true)->beforeSave($this);
 470: 
 471:         $hasOptions         = false;
 472:         $hasRequiredOptions = false;
 473: 
 474:         /**
 475:          * $this->_canAffectOptions - set by type instance only
 476:          * $this->getCanSaveCustomOptions() - set either in controller when "Custom Options" ajax tab is loaded,
 477:          * or in type instance as well
 478:          */
 479:         $this->canAffectOptions($this->_canAffectOptions && $this->getCanSaveCustomOptions());
 480:         if ($this->getCanSaveCustomOptions()) {
 481:             $options = $this->getProductOptions();
 482:             if (is_array($options)) {
 483:                 $this->setIsCustomOptionChanged(true);
 484:                 foreach ($this->getProductOptions() as $option) {
 485:                     $this->getOptionInstance()->addOption($option);
 486:                     if ((!isset($option['is_delete'])) || $option['is_delete'] != '1') {
 487:                         $hasOptions = true;
 488:                     }
 489:                 }
 490:                 foreach ($this->getOptionInstance()->getOptions() as $option) {
 491:                     if ($option['is_require'] == '1') {
 492:                         $hasRequiredOptions = true;
 493:                         break;
 494:                     }
 495:                 }
 496:             }
 497:         }
 498: 
 499:         /**
 500:          * Set true, if any
 501:          * Set false, ONLY if options have been affected by Options tab and Type instance tab
 502:          */
 503:         if ($hasOptions || (bool)$this->getTypeHasOptions()) {
 504:             $this->setHasOptions(true);
 505:             if ($hasRequiredOptions || (bool)$this->getTypeHasRequiredOptions()) {
 506:                 $this->setRequiredOptions(true);
 507:             } elseif ($this->canAffectOptions()) {
 508:                 $this->setRequiredOptions(false);
 509:             }
 510:         } elseif ($this->canAffectOptions()) {
 511:             $this->setHasOptions(false);
 512:             $this->setRequiredOptions(false);
 513:         }
 514:         parent::_beforeSave();
 515:     }
 516: 
 517:     /**
 518:      * Check/set if options can be affected when saving product
 519:      * If value specified, it will be set.
 520:      *
 521:      * @param   bool $value
 522:      * @return  bool
 523:      */
 524:     public function canAffectOptions($value = null)
 525:     {
 526:         if (null !== $value) {
 527:             $this->_canAffectOptions = (bool)$value;
 528:         }
 529:         return $this->_canAffectOptions;
 530:     }
 531: 
 532:     /**
 533:      * Saving product type related data and init index
 534:      *
 535:      * @return Mage_Catalog_Model_Product
 536:      */
 537:     protected function _afterSave()
 538:     {
 539:         $this->getLinkInstance()->saveProductRelations($this);
 540:         $this->getTypeInstance(true)->save($this);
 541: 
 542:         /**
 543:          * Product Options
 544:          */
 545:         $this->getOptionInstance()->setProduct($this)
 546:             ->saveOptions();
 547: 
 548:         $result = parent::_afterSave();
 549: 
 550:         Mage::getSingleton('index/indexer')->processEntityAction(
 551:             $this, self::ENTITY, Mage_Index_Model_Event::TYPE_SAVE
 552:         );
 553:         return $result;
 554:     }
 555: 
 556:     /**
 557:      * Clear chache related with product and protect delete from not admin
 558:      * Register indexing event before delete product
 559:      *
 560:      * @return Mage_Catalog_Model_Product
 561:      */
 562:     protected function _beforeDelete()
 563:     {
 564:         $this->_protectFromNonAdmin();
 565:         $this->cleanCache();
 566:         Mage::getSingleton('index/indexer')->logEvent(
 567:             $this, self::ENTITY, Mage_Index_Model_Event::TYPE_DELETE
 568:         );
 569:         return parent::_beforeDelete();
 570:     }
 571: 
 572:     /**
 573:      * Init indexing process after product delete commit
 574:      *
 575:      * @return Mage_Catalog_Model_Product
 576:      */
 577:     protected function _afterDeleteCommit()
 578:     {
 579:         parent::_afterDeleteCommit();
 580:         Mage::getSingleton('index/indexer')->indexEvents(
 581:             self::ENTITY, Mage_Index_Model_Event::TYPE_DELETE
 582:         );
 583:     }
 584: 
 585:     /**
 586:      * Load product options if they exists
 587:      *
 588:      * @return Mage_Catalog_Model_Product
 589:      */
 590:     protected function _afterLoad()
 591:     {
 592:         parent::_afterLoad();
 593:         /**
 594:          * Load product options
 595:          */
 596:         if ($this->getHasOptions()) {
 597:             foreach ($this->getProductOptionsCollection() as $option) {
 598:                 $option->setProduct($this);
 599:                 $this->addOption($option);
 600:             }
 601:         }
 602:         return $this;
 603:     }
 604: 
 605:     /**
 606:      * Retrieve resource instance wrapper
 607:      *
 608:      * @return Mage_Catalog_Model_Resource_Eav_Mysql4_Product
 609:      */
 610:     protected function _getResource()
 611:     {
 612:         return parent::_getResource();
 613:     }
 614: 
 615:     /**
 616:      * Clear cache related with product id
 617:      *
 618:      * @return Mage_Catalog_Model_Product
 619:      */
 620:     public function cleanCache()
 621:     {
 622:         Mage::app()->cleanCache('catalog_product_'.$this->getId());
 623:         return $this;
 624:     }
 625: 
 626:     /**
 627:      * Get product price model
 628:      *
 629:      * @return Mage_Catalog_Model_Product_Type_Price
 630:      */
 631:     public function getPriceModel()
 632:     {
 633:         return Mage::getSingleton('catalog/product_type')->priceFactory($this->getTypeId());
 634:     }
 635: 
 636:     /**
 637:      * Get product group price
 638:      *
 639:      * @return float
 640:      */
 641:     public function getGroupPrice()
 642:     {
 643:         return $this->getPriceModel()->getGroupPrice($this);
 644:     }
 645: 
 646:     /**
 647:      * Get product tier price by qty
 648:      *
 649:      * @param   double $qty
 650:      * @return  double
 651:      */
 652:     public function getTierPrice($qty=null)
 653:     {
 654:         return $this->getPriceModel()->getTierPrice($qty, $this);
 655:     }
 656: 
 657:     /**
 658:      * Count how many tier prices we have for the product
 659:      *
 660:      * @return  int
 661:      */
 662:     public function getTierPriceCount()
 663:     {
 664:         return $this->getPriceModel()->getTierPriceCount($this);
 665:     }
 666: 
 667:     /**
 668:      * Get formated by currency tier price
 669:      *
 670:      * @param   double $qty
 671:      * @return  array || double
 672:      */
 673:     public function getFormatedTierPrice($qty=null)
 674:     {
 675:         return $this->getPriceModel()->getFormatedTierPrice($qty, $this);
 676:     }
 677: 
 678:     /**
 679:      * Get formated by currency product price
 680:      *
 681:      * @return  array || double
 682:      */
 683:     public function getFormatedPrice()
 684:     {
 685:         return $this->getPriceModel()->getFormatedPrice($this);
 686:     }
 687: 
 688:     /**
 689:      * Sets final price of product
 690:      *
 691:      * This func is equal to magic 'setFinalPrice()', but added as a separate func, because in cart with bundle
 692:      * products it's called very often in Item->getProduct(). So removing chain of magic with more cpu consuming
 693:      * algorithms gives nice optimization boost.
 694:      *
 695:      * @param float $price Price amount
 696:      * @return Mage_Catalog_Model_Product
 697:      */
 698:     public function setFinalPrice($price)
 699:     {
 700:         $this->_data['final_price'] = $price;
 701:         return $this;
 702:     }
 703: 
 704:     /**
 705:      * Get product final price
 706:      *
 707:      * @param double $qty
 708:      * @return double
 709:      */
 710:     public function getFinalPrice($qty=null)
 711:     {
 712:         $price = $this->_getData('final_price');
 713:         if ($price !== null) {
 714:             return $price;
 715:         }
 716:         return $this->getPriceModel()->getFinalPrice($qty, $this);
 717:     }
 718: 
 719:     /**
 720:      * Returns calculated final price
 721:      *
 722:      * @return float
 723:      */
 724:     public function getCalculatedFinalPrice()
 725:     {
 726:         return $this->_getData('calculated_final_price');
 727:     }
 728: 
 729:     /**
 730:      * Returns minimal price
 731:      *
 732:      * @return float
 733:      */
 734:     public function getMinimalPrice()
 735:     {
 736:         return max($this->_getData('minimal_price'), 0);
 737:     }
 738: 
 739:     /**
 740:      * Returns special price
 741:      *
 742:      * @return float
 743:      */
 744:     public function getSpecialPrice()
 745:     {
 746:         return $this->_getData('special_price');
 747:     }
 748: 
 749:     /**
 750:      * Returns starting date of the special price
 751:      *
 752:      * @return mixed
 753:      */
 754:     public function getSpecialFromDate()
 755:     {
 756:         return $this->_getData('special_from_date');
 757:     }
 758: 
 759:     /**
 760:      * Returns end date of the special price
 761:      *
 762:      * @return mixed
 763:      */
 764:     public function getSpecialToDate()
 765:     {
 766:         return $this->_getData('special_to_date');
 767:     }
 768: 
 769: 
 770: /*******************************************************************************
 771:  ** Linked products API
 772:  */
 773:     /**
 774:      * Retrieve array of related roducts
 775:      *
 776:      * @return array
 777:      */
 778:     public function getRelatedProducts()
 779:     {
 780:         if (!$this->hasRelatedProducts()) {
 781:             $products = array();
 782:             $collection = $this->getRelatedProductCollection();
 783:             foreach ($collection as $product) {
 784:                 $products[] = $product;
 785:             }
 786:             $this->setRelatedProducts($products);
 787:         }
 788:         return $this->getData('related_products');
 789:     }
 790: 
 791:     /**
 792:      * Retrieve related products identifiers
 793:      *
 794:      * @return array
 795:      */
 796:     public function getRelatedProductIds()
 797:     {
 798:         if (!$this->hasRelatedProductIds()) {
 799:             $ids = array();
 800:             foreach ($this->getRelatedProducts() as $product) {
 801:                 $ids[] = $product->getId();
 802:             }
 803:             $this->setRelatedProductIds($ids);
 804:         }
 805:         return $this->getData('related_product_ids');
 806:     }
 807: 
 808:     /**
 809:      * Retrieve collection related product
 810:      *
 811:      * @return Mage_Catalog_Model_Resource_Product_Link_Product_Collection
 812:      */
 813:     public function getRelatedProductCollection()
 814:     {
 815:         $collection = $this->getLinkInstance()->useRelatedLinks()
 816:             ->getProductCollection()
 817:             ->setIsStrongMode();
 818:         $collection->setProduct($this);
 819:         return $collection;
 820:     }
 821: 
 822:     /**
 823:      * Retrieve collection related link
 824:      *
 825:      * @return Mage_Catalog_Model_Resource_Product_Link_Collection
 826:      */
 827:     public function getRelatedLinkCollection()
 828:     {
 829:         $collection = $this->getLinkInstance()->useRelatedLinks()
 830:             ->getLinkCollection();
 831:         $collection->setProduct($this);
 832:         $collection->addLinkTypeIdFilter();
 833:         $collection->addProductIdFilter();
 834:         $collection->joinAttributes();
 835:         return $collection;
 836:     }
 837: 
 838:     /**
 839:      * Retrieve array of up sell products
 840:      *
 841:      * @return array
 842:      */
 843:     public function getUpSellProducts()
 844:     {
 845:         if (!$this->hasUpSellProducts()) {
 846:             $products = array();
 847:             foreach ($this->getUpSellProductCollection() as $product) {
 848:                 $products[] = $product;
 849:             }
 850:             $this->setUpSellProducts($products);
 851:         }
 852:         return $this->getData('up_sell_products');
 853:     }
 854: 
 855:     /**
 856:      * Retrieve up sell products identifiers
 857:      *
 858:      * @return array
 859:      */
 860:     public function getUpSellProductIds()
 861:     {
 862:         if (!$this->hasUpSellProductIds()) {
 863:             $ids = array();
 864:             foreach ($this->getUpSellProducts() as $product) {
 865:                 $ids[] = $product->getId();
 866:             }
 867:             $this->setUpSellProductIds($ids);
 868:         }
 869:         return $this->getData('up_sell_product_ids');
 870:     }
 871: 
 872:     /**
 873:      * Retrieve collection up sell product
 874:      *
 875:      * @return Mage_Catalog_Model_Resource_Product_Link_Product_Collection
 876:      */
 877:     public function getUpSellProductCollection()
 878:     {
 879:         $collection = $this->getLinkInstance()->useUpSellLinks()
 880:             ->getProductCollection()
 881:             ->setIsStrongMode();
 882:         $collection->setProduct($this);
 883:         return $collection;
 884:     }
 885: 
 886:     /**
 887:      * Retrieve collection up sell link
 888:      *
 889:      * @return Mage_Catalog_Model_Resource_Product_Link_Collection
 890:      */
 891:     public function getUpSellLinkCollection()
 892:     {
 893:         $collection = $this->getLinkInstance()->useUpSellLinks()
 894:             ->getLinkCollection();
 895:         $collection->setProduct($this);
 896:         $collection->addLinkTypeIdFilter();
 897:         $collection->addProductIdFilter();
 898:         $collection->joinAttributes();
 899:         return $collection;
 900:     }
 901: 
 902:     /**
 903:      * Retrieve array of cross sell products
 904:      *
 905:      * @return array
 906:      */
 907:     public function getCrossSellProducts()
 908:     {
 909:         if (!$this->hasCrossSellProducts()) {
 910:             $products = array();
 911:             foreach ($this->getCrossSellProductCollection() as $product) {
 912:                 $products[] = $product;
 913:             }
 914:             $this->setCrossSellProducts($products);
 915:         }
 916:         return $this->getData('cross_sell_products');
 917:     }
 918: 
 919:     /**
 920:      * Retrieve cross sell products identifiers
 921:      *
 922:      * @return array
 923:      */
 924:     public function getCrossSellProductIds()
 925:     {
 926:         if (!$this->hasCrossSellProductIds()) {
 927:             $ids = array();
 928:             foreach ($this->getCrossSellProducts() as $product) {
 929:                 $ids[] = $product->getId();
 930:             }
 931:             $this->setCrossSellProductIds($ids);
 932:         }
 933:         return $this->getData('cross_sell_product_ids');
 934:     }
 935: 
 936:     /**
 937:      * Retrieve collection cross sell product
 938:      *
 939:      * @return Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Link_Product_Collection
 940:      */
 941:     public function getCrossSellProductCollection()
 942:     {
 943:         $collection = $this->getLinkInstance()->useCrossSellLinks()
 944:             ->getProductCollection()
 945:             ->setIsStrongMode();
 946:         $collection->setProduct($this);
 947:         return $collection;
 948:     }
 949: 
 950:     /**
 951:      * Retrieve collection cross sell link
 952:      *
 953:      * @return Mage_Catalog_Model_Resource_Product_Link_Collection
 954:      */
 955:     public function getCrossSellLinkCollection()
 956:     {
 957:         $collection = $this->getLinkInstance()->useCrossSellLinks()
 958:             ->getLinkCollection();
 959:         $collection->setProduct($this);
 960:         $collection->addLinkTypeIdFilter();
 961:         $collection->addProductIdFilter();
 962:         $collection->joinAttributes();
 963:         return $collection;
 964:     }
 965: 
 966:     /**
 967:      * Retrieve collection grouped link
 968:      *
 969:      * @return Mage_Catalog_Model_Resource_Product_Link_Collection
 970:      */
 971:     public function getGroupedLinkCollection()
 972:     {
 973:         $collection = $this->getLinkInstance()->useGroupedLinks()
 974:             ->getLinkCollection();
 975:         $collection->setProduct($this);
 976:         $collection->addLinkTypeIdFilter();
 977:         $collection->addProductIdFilter();
 978:         $collection->joinAttributes();
 979:         return $collection;
 980:     }
 981: 
 982: /*******************************************************************************
 983:  ** Media API
 984:  */
 985:     /**
 986:      * Retrive attributes for media gallery
 987:      *
 988:      * @return array
 989:      */
 990:     public function getMediaAttributes()
 991:     {
 992:         if (!$this->hasMediaAttributes()) {
 993:             $mediaAttributes = array();
 994:             foreach ($this->getAttributes() as $attribute) {
 995:                 if($attribute->getFrontend()->getInputType() == 'media_image') {
 996:                     $mediaAttributes[$attribute->getAttributeCode()] = $attribute;
 997:                 }
 998:             }
 999:             $this->setMediaAttributes($mediaAttributes);
1000:         }
1001:         return $this->getData('media_attributes');
1002:     }
1003: 
1004:     /**
1005:      * Retrive media gallery images
1006:      *
1007:      * @return Varien_Data_Collection
1008:      */
1009:     public function getMediaGalleryImages()
1010:     {
1011:         if(!$this->hasData('media_gallery_images') && is_array($this->getMediaGallery('images'))) {
1012:             $images = new Varien_Data_Collection();
1013:             foreach ($this->getMediaGallery('images') as $image) {
1014:                 if ($image['disabled']) {
1015:                     continue;
1016:                 }
1017:                 $image['url'] = $this->getMediaConfig()->getMediaUrl($image['file']);
1018:                 $image['id'] = isset($image['value_id']) ? $image['value_id'] : null;
1019:                 $image['path'] = $this->getMediaConfig()->getMediaPath($image['file']);
1020:                 $images->addItem(new Varien_Object($image));
1021:             }
1022:             $this->setData('media_gallery_images', $images);
1023:         }
1024: 
1025:         return $this->getData('media_gallery_images');
1026:     }
1027: 
1028:     /**
1029:      * Add image to media gallery
1030:      *
1031:      * @param string        $file              file path of image in file system
1032:      * @param string|array  $mediaAttribute    code of attribute with type 'media_image',
1033:      *                                          leave blank if image should be only in gallery
1034:      * @param boolean       $move              if true, it will move source file
1035:      * @param boolean       $exclude           mark image as disabled in product page view
1036:      * @return Mage_Catalog_Model_Product
1037:      */
1038:     public function addImageToMediaGallery($file, $mediaAttribute=null, $move=false, $exclude=true)
1039:     {
1040:         $attributes = $this->getTypeInstance(true)->getSetAttributes($this);
1041:         if (!isset($attributes['media_gallery'])) {
1042:             return $this;
1043:         }
1044:         $mediaGalleryAttribute = $attributes['media_gallery'];
1045:         /* @var $mediaGalleryAttribute Mage_Catalog_Model_Resource_Eav_Attribute */
1046:         $mediaGalleryAttribute->getBackend()->addImage($this, $file, $mediaAttribute, $move, $exclude);
1047:         return $this;
1048:     }
1049: 
1050:     /**
1051:      * Retrive product media config
1052:      *
1053:      * @return Mage_Catalog_Model_Product_Media_Config
1054:      */
1055:     public function getMediaConfig()
1056:     {
1057:         return Mage::getSingleton('catalog/product_media_config');
1058:     }
1059: 
1060:     /**
1061:      * Create duplicate
1062:      *
1063:      * @return Mage_Catalog_Model_Product
1064:      */
1065:     public function duplicate()
1066:     {
1067:         $this->getWebsiteIds();
1068:         $this->getCategoryIds();
1069: 
1070:         /* @var $newProduct Mage_Catalog_Model_Product */
1071:         $newProduct = Mage::getModel('catalog/product')->setData($this->getData())
1072:             ->setIsDuplicate(true)
1073:             ->setOriginalId($this->getId())
1074:             ->setSku(null)
1075:             ->setStatus(Mage_Catalog_Model_Product_Status::STATUS_DISABLED)
1076:             ->setCreatedAt(null)
1077:             ->setUpdatedAt(null)
1078:             ->setId(null)
1079:             ->setStoreId(Mage::app()->getStore()->getId());
1080: 
1081:         Mage::dispatchEvent(
1082:             'catalog_model_product_duplicate',
1083:             array('current_product' => $this, 'new_product' => $newProduct)
1084:         );
1085: 
1086:         /* Prepare Related*/
1087:         $data = array();
1088:         $this->getLinkInstance()->useRelatedLinks();
1089:         $attributes = array();
1090:         foreach ($this->getLinkInstance()->getAttributes() as $_attribute) {
1091:             if (isset($_attribute['code'])) {
1092:                 $attributes[] = $_attribute['code'];
1093:             }
1094:         }
1095:         foreach ($this->getRelatedLinkCollection() as $_link) {
1096:             $data[$_link->getLinkedProductId()] = $_link->toArray($attributes);
1097:         }
1098:         $newProduct->setRelatedLinkData($data);
1099: 
1100:         /* Prepare UpSell*/
1101:         $data = array();
1102:         $this->getLinkInstance()->useUpSellLinks();
1103:         $attributes = array();
1104:         foreach ($this->getLinkInstance()->getAttributes() as $_attribute) {
1105:             if (isset($_attribute['code'])) {
1106:                 $attributes[] = $_attribute['code'];
1107:             }
1108:         }
1109:         foreach ($this->getUpSellLinkCollection() as $_link) {
1110:             $data[$_link->getLinkedProductId()] = $_link->toArray($attributes);
1111:         }
1112:         $newProduct->setUpSellLinkData($data);
1113: 
1114:         /* Prepare Cross Sell */
1115:         $data = array();
1116:         $this->getLinkInstance()->useCrossSellLinks();
1117:         $attributes = array();
1118:         foreach ($this->getLinkInstance()->getAttributes() as $_attribute) {
1119:             if (isset($_attribute['code'])) {
1120:                 $attributes[] = $_attribute['code'];
1121:             }
1122:         }
1123:         foreach ($this->getCrossSellLinkCollection() as $_link) {
1124:             $data[$_link->getLinkedProductId()] = $_link->toArray($attributes);
1125:         }
1126:         $newProduct->setCrossSellLinkData($data);
1127: 
1128:         /* Prepare Grouped */
1129:         $data = array();
1130:         $this->getLinkInstance()->useGroupedLinks();
1131:         $attributes = array();
1132:         foreach ($this->getLinkInstance()->getAttributes() as $_attribute) {
1133:             if (isset($_attribute['code'])) {
1134:                 $attributes[] = $_attribute['code'];
1135:             }
1136:         }
1137:         foreach ($this->getGroupedLinkCollection() as $_link) {
1138:             $data[$_link->getLinkedProductId()] = $_link->toArray($attributes);
1139:         }
1140:         $newProduct->setGroupedLinkData($data);
1141: 
1142:         $newProduct->save();
1143: 
1144:         $this->getOptionInstance()->duplicate($this->getId(), $newProduct->getId());
1145:         $this->getResource()->duplicate($this->getId(), $newProduct->getId());
1146: 
1147:         // TODO - duplicate product on all stores of the websites it is associated with
1148:         /*if ($storeIds = $this->getWebsiteIds()) {
1149:             foreach ($storeIds as $storeId) {
1150:                 $this->setStoreId($storeId)
1151:                    ->load($this->getId());
1152: 
1153:                 $newProduct->setData($this->getData())
1154:                     ->setSku(null)
1155:                     ->setStatus(Mage_Catalog_Model_Product_Status::STATUS_DISABLED)
1156:                     ->setId($newId)
1157:                     ->save();
1158:             }
1159:         }*/
1160:         return $newProduct;
1161:     }
1162: 
1163:     /**
1164:      * Is product grouped
1165:      *
1166:      * @return bool
1167:      */
1168:     public function isSuperGroup()
1169:     {
1170:         return $this->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_GROUPED;
1171:     }
1172: 
1173:     /**
1174:      * Alias for isConfigurable()
1175:      *
1176:      * @return bool
1177:      */
1178:     public function isSuperConfig()
1179:     {
1180:         return $this->isConfigurable();
1181:     }
1182:     /**
1183:      * Check is product grouped
1184:      *
1185:      * @return bool
1186:      */
1187:     public function isGrouped()
1188:     {
1189:         return $this->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_GROUPED;
1190:     }
1191: 
1192:     /**
1193:      * Check is product configurable
1194:      *
1195:      * @return bool
1196:      */
1197:     public function isConfigurable()
1198:     {
1199:         return $this->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE;
1200:     }
1201: 
1202:     /**
1203:      * Whether product configurable or grouped
1204:      *
1205:      * @return bool
1206:      */
1207:     public function isSuper()
1208:     {
1209:         return $this->isConfigurable() || $this->isGrouped();
1210:     }
1211: 
1212:     /**
1213:      * Returns visible status IDs in catalog
1214:      *
1215:      * @return array
1216:      */
1217:     public function getVisibleInCatalogStatuses()
1218:     {
1219:         return Mage::getSingleton('catalog/product_status')->getVisibleStatusIds();
1220:     }
1221: 
1222:     /**
1223:      * Retrieve visible statuses
1224:      *
1225:      * @return array
1226:      */
1227:     public function getVisibleStatuses()
1228:     {
1229:         return Mage::getSingleton('catalog/product_status')->getVisibleStatusIds();
1230:     }
1231: 
1232:     /**
1233:      * Check Product visilbe in catalog
1234:      *
1235:      * @return bool
1236:      */
1237:     public function isVisibleInCatalog()
1238:     {
1239:         return in_array($this->getStatus(), $this->getVisibleInCatalogStatuses());
1240:     }
1241: 
1242:     /**
1243:      * Retrieve visible in site visibilities
1244:      *
1245:      * @return array
1246:      */
1247:     public function getVisibleInSiteVisibilities()
1248:     {
1249:         return Mage::getSingleton('catalog/product_visibility')->getVisibleInSiteIds();
1250:     }
1251: 
1252:     /**
1253:      * Check Product visible in site
1254:      *
1255:      * @return bool
1256:      */
1257:     public function isVisibleInSiteVisibility()
1258:     {
1259:         return in_array($this->getVisibility(), $this->getVisibleInSiteVisibilities());
1260:     }
1261: 
1262:     /**
1263:      * Checks product can be duplicated
1264:      *
1265:      * @return boolean
1266:      */
1267:     public function isDuplicable()
1268:     {
1269:         return $this->_isDuplicable;
1270:     }
1271: 
1272:     /**
1273:      * Set is duplicable flag
1274:      *
1275:      * @param boolean $value
1276:      * @return Mage_Catalog_Model_Product
1277:      */
1278:     public function setIsDuplicable($value)
1279:     {
1280:         $this->_isDuplicable = (boolean) $value;
1281:         return $this;
1282:     }
1283: 
1284: 
1285:     /**
1286:      * Check is product available for sale
1287:      *
1288:      * @return bool
1289:      */
1290:     public function isSalable()
1291:     {
1292:         Mage::dispatchEvent('catalog_product_is_salable_before', array(
1293:             'product'   => $this
1294:         ));
1295: 
1296:         $salable = $this->isAvailable();
1297: 
1298:         $object = new Varien_Object(array(
1299:             'product'    => $this,
1300:             'is_salable' => $salable
1301:         ));
1302:         Mage::dispatchEvent('catalog_product_is_salable_after', array(
1303:             'product'   => $this,
1304:             'salable'   => $object
1305:         ));
1306:         return $object->getIsSalable();
1307:     }
1308: 
1309:     /**
1310:      * Check whether the product type or stock allows to purchase the product
1311:      *
1312:      * @return bool
1313:      */
1314:     public function isAvailable()
1315:     {
1316:         return $this->getTypeInstance(true)->isSalable($this)
1317:             || Mage::helper('catalog/product')->getSkipSaleableCheck();
1318:     }
1319: 
1320:     /**
1321:      * Is product salable detecting by product type
1322:      *
1323:      * @return bool
1324:      */
1325:     public function getIsSalable()
1326:     {
1327:         $productType = $this->getTypeInstance(true);
1328:         if (is_callable(array($productType, 'getIsSalable'))) {
1329:             return $productType->getIsSalable($this);
1330:         }
1331:         if ($this->hasData('is_salable')) {
1332:             return $this->getData('is_salable');
1333:         }
1334: 
1335:         return $this->isSalable();
1336:     }
1337: 
1338:     /**
1339:      * Check is a virtual product
1340:      * Data helper wrapper
1341:      *
1342:      * @return bool
1343:      */
1344:     public function isVirtual()
1345:     {
1346:         return $this->getIsVirtual();
1347:     }
1348: 
1349:     /**
1350:      * Whether the product is a recurring payment
1351:      *
1352:      * @return bool
1353:      */
1354:     public function isRecurring()
1355:     {
1356:         return $this->getIsRecurring() == '1';
1357:     }
1358: 
1359:     /**
1360:      * Alias for isSalable()
1361:      *
1362:      * @return bool
1363:      */
1364:     public function isSaleable()
1365:     {
1366:         return $this->isSalable();
1367:     }
1368: 
1369:     /**
1370:      * Whether product available in stock
1371:      *
1372:      * @return bool
1373:      */
1374:     public function isInStock()
1375:     {
1376:         return $this->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_ENABLED;
1377:     }
1378: 
1379:     /**
1380:      * Get attribute text by its code
1381:      *
1382:      * @param $attributeCode Code of the attribute
1383:      * @return string
1384:      */
1385:     public function getAttributeText($attributeCode)
1386:     {
1387:         return $this->getResource()
1388:             ->getAttribute($attributeCode)
1389:                 ->getSource()
1390:                     ->getOptionText($this->getData($attributeCode));
1391:     }
1392: 
1393:     /**
1394:      * Returns array with dates for custom design
1395:      *
1396:      * @return array
1397:      */
1398:     public function getCustomDesignDate()
1399:     {
1400:         $result = array();
1401:         $result['from'] = $this->getData('custom_design_from');
1402:         $result['to'] = $this->getData('custom_design_to');
1403: 
1404:         return $result;
1405:     }
1406: 
1407:     /**
1408:      * Retrieve Product URL
1409:      *
1410:      * @param  bool $useSid
1411:      * @return string
1412:      */
1413:     public function getProductUrl($useSid = null)
1414:     {
1415:         return $this->getUrlModel()->getProductUrl($this, $useSid);
1416:     }
1417: 
1418:     /**
1419:      * Retrieve URL in current store
1420:      *
1421:      * @param array $params the route params
1422:      * @return string
1423:      */
1424:     public function getUrlInStore($params = array())
1425:     {
1426:         return $this->getUrlModel()->getUrlInStore($this, $params);
1427:     }
1428: 
1429:     /**
1430:      * Formats URL key
1431:      *
1432:      * @param $str URL
1433:      * @return string
1434:      */
1435:     public function formatUrlKey($str)
1436:     {
1437:         return $this->getUrlModel()->formatUrlKey($str);
1438:     }
1439: 
1440:     /**
1441:      * Retrieve Product Url Path (include category)
1442:      *
1443:      * @param Mage_Catalog_Model_Category $category
1444:      * @return string
1445:      */
1446:     public function getUrlPath($category=null)
1447:     {
1448:         return $this->getUrlModel()->getUrlPath($this, $category);
1449:     }
1450: 
1451:     /**
1452:      * Save current attribute with code $code and assign new value
1453:      *
1454:      * @param string $code  Attribute code
1455:      * @param mixed  $value New attribute value
1456:      * @param int    $store Store ID
1457:      * @return void
1458:      */
1459:     public function addAttributeUpdate($code, $value, $store)
1460:     {
1461:         $oldValue = $this->getData($code);
1462:         $oldStore = $this->getStoreId();
1463: 
1464:         $this->setData($code, $value);
1465:         $this->setStoreId($store);
1466:         $this->getResource()->saveAttribute($this, $code);
1467: 
1468:         $this->setData($code, $oldValue);
1469:         $this->setStoreId($oldStore);
1470:     }
1471: 
1472:     /**
1473:      * Renders the object to array
1474:      *
1475:      * @param array $arrAttributes Attribute array
1476:      * @return array
1477:      */
1478:     public function toArray(array $arrAttributes=array())
1479:     {
1480:         $data = parent::toArray($arrAttributes);
1481:         if ($stock = $this->getStockItem()) {
1482:             $data['stock_item'] = $stock->toArray();
1483:         }
1484:         unset($data['stock_item']['product']);
1485:         return $data;
1486:     }
1487: 
1488:     /**
1489:      * Same as setData(), but also initiates the stock item (if it is there)
1490:      *
1491:      * @param array $data Array to form the object from
1492:      * @return Mage_Catalog_Model_Product
1493:      */
1494:     public function fromArray($data)
1495:     {
1496:         if (isset($data['stock_item'])) {
1497:             if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) {
1498:                 $stockItem = Mage::getModel('cataloginventory/stock_item')
1499:                     ->setData($data['stock_item'])
1500:                     ->setProduct($this);
1501:                 $this->setStockItem($stockItem);
1502:             }
1503:             unset($data['stock_item']);
1504:         }
1505:         $this->setData($data);
1506:         return $this;
1507:     }
1508: 
1509:     /**
1510:      * @deprecated after 1.4.2.0
1511:      * @return Mage_Catalog_Model_Product
1512:      */
1513:     public function loadParentProductIds()
1514:     {
1515:         return $this->setParentProductIds(array());
1516:     }
1517: 
1518:     /**
1519:      * Delete product
1520:      *
1521:      * @return Mage_Catalog_Model_Product
1522:      */
1523:     public function delete()
1524:     {
1525:         parent::delete();
1526:         Mage::dispatchEvent($this->_eventPrefix.'_delete_after_done', array($this->_eventObject=>$this));
1527:         return $this;
1528:     }
1529: 
1530:     /**
1531:      * Returns request path
1532:      *
1533:      * @return string
1534:      */
1535:     public function getRequestPath()
1536:     {
1537:         return $this->_getData('request_path');
1538:     }
1539: 
1540:     /**
1541:      * Custom function for other modules
1542:      * @return string
1543:      */
1544: 
1545:     public function getGiftMessageAvailable()
1546:     {
1547:         return $this->_getData('gift_message_available');
1548:     }
1549: 
1550:     /**
1551:      * Returns rating summary
1552:      *
1553:      * @return mixed
1554:      */
1555:     public function getRatingSummary()
1556:     {
1557:         return $this->_getData('rating_summary');
1558:     }
1559: 
1560:     /**
1561:      * Check is product composite
1562:      *
1563:      * @return bool
1564:      */
1565:     public function isComposite()
1566:     {
1567:         return $this->getTypeInstance(true)->isComposite($this);
1568:     }
1569: 
1570:     /**
1571:      * Check if product can be configured
1572:      *
1573:      * @return bool
1574:      */
1575:     public function canConfigure()
1576:     {
1577:         $options = $this->getOptions();
1578:         return !empty($options) || $this->getTypeInstance(true)->canConfigure($this);
1579:     }
1580: 
1581:     /**
1582:      * Retrieve sku through type instance
1583:      *
1584:      * @return string
1585:      */
1586:     public function getSku()
1587:     {
1588:         return $this->getTypeInstance(true)->getSku($this);
1589:     }
1590: 
1591:     /**
1592:      * Retrieve weight throught type instance
1593:      *
1594:      * @return unknown
1595:      */
1596:     public function getWeight()
1597:     {
1598:         return $this->getTypeInstance(true)->getWeight($this);
1599:     }
1600: 
1601:     /**
1602:      * Retrieve option instance
1603:      *
1604:      * @return Mage_Catalog_Model_Product_Option
1605:      */
1606:     public function getOptionInstance()
1607:     {
1608:         if (!$this->_optionInstance) {
1609:             $this->_optionInstance = Mage::getSingleton('catalog/product_option');
1610:         }
1611:         return $this->_optionInstance;
1612:     }
1613: 
1614:     /**
1615:      * Retrieve options collection of product
1616:      *
1617:      * @return Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Option_Collection
1618:      */
1619:     public function getProductOptionsCollection()
1620:     {
1621:         $collection = $this->getOptionInstance()
1622:             ->getProductOptionCollection($this);
1623: 
1624:         return $collection;
1625:     }
1626: 
1627:     /**
1628:      * Add option to array of product options
1629:      *
1630:      * @param Mage_Catalog_Model_Product_Option $option
1631:      * @return Mage_Catalog_Model_Product
1632:      */
1633:     public function addOption(Mage_Catalog_Model_Product_Option $option)
1634:     {
1635:         $this->_options[$option->getId()] = $option;
1636:         return $this;
1637:     }
1638: 
1639:     /**
1640:      * Get option from options array of product by given option id
1641:      *
1642:      * @param int $optionId
1643:      * @return Mage_Catalog_Model_Product_Option | null
1644:      */
1645:     public function getOptionById($optionId)
1646:     {
1647:         if (isset($this->_options[$optionId])) {
1648:             return $this->_options[$optionId];
1649:         }
1650: 
1651:         return null;
1652:     }
1653: 
1654:     /**
1655:      * Get all options of product
1656:      *
1657:      * @return array
1658:      */
1659:     public function getOptions()
1660:     {
1661:         return $this->_options;
1662:     }
1663: 
1664:     /**
1665:      * Retrieve is a virtual product
1666:      *
1667:      * @return bool
1668:      */
1669:     public function getIsVirtual()
1670:     {
1671:         return $this->getTypeInstance(true)->isVirtual($this);
1672:     }
1673: 
1674:     /**
1675:      * Add custom option information to product
1676:      *
1677:      * @param   string $code    Option code
1678:      * @param   mixed  $value   Value of the option
1679:      * @param   int    $product Product ID
1680:      * @return  Mage_Catalog_Model_Product
1681:      */
1682:     public function addCustomOption($code, $value, $product=null)
1683:     {
1684:         $product = $product ? $product : $this;
1685:         $option = Mage::getModel('catalog/product_configuration_item_option')
1686:             ->addData(array(
1687:                 'product_id'=> $product->getId(),
1688:                 'product'   => $product,
1689:                 'code'      => $code,
1690:                 'value'     => $value,
1691:             ));
1692:         $this->_customOptions[$code] = $option;
1693:         return $this;
1694:     }
1695: 
1696:     /**
1697:      * Sets custom options for the product
1698:      *
1699:      * @param array $options Array of options
1700:      * @return void
1701:      */
1702:     public function setCustomOptions(array $options)
1703:     {
1704:         $this->_customOptions = $options;
1705:     }
1706: 
1707:     /**
1708:      * Get all custom options of the product
1709:      *
1710:      * @return array
1711:      */
1712:     public function getCustomOptions()
1713:     {
1714:         return $this->_customOptions;
1715:     }
1716: 
1717:     /**
1718:      * Get product custom option info
1719:      *
1720:      * @param   string $code
1721:      * @return  array
1722:      */
1723:     public function getCustomOption($code)
1724:     {
1725:         if (isset($this->_customOptions[$code])) {
1726:             return $this->_customOptions[$code];
1727:         }
1728:         return null;
1729:     }
1730: 
1731:     /**
1732:      * Checks if there custom option for this product
1733:      *
1734:      * @return bool
1735:      */
1736:     public function hasCustomOptions()
1737:     {
1738:         if (count($this->_customOptions)) {
1739:             return true;
1740:         } else {
1741:             return false;
1742:         }
1743:     }
1744: 
1745:     /**
1746:      * Check availability display product in category
1747:      *
1748:      * @param   int $categoryId
1749:      * @return  bool
1750:      */
1751:     public function canBeShowInCategory($categoryId)
1752:     {
1753:         return $this->_getResource()->canBeShowInCategory($this, $categoryId);
1754:     }
1755: 
1756:     /**
1757:      * Retrieve category ids where product is available
1758:      *
1759:      * @return array
1760:      */
1761:     public function getAvailableInCategories()
1762:     {
1763:         return $this->_getResource()->getAvailableInCategories($this);
1764:     }
1765: 
1766:     /**
1767:      * Retrieve default attribute set id
1768:      *
1769:      * @return int
1770:      */
1771:     public function getDefaultAttributeSetId()
1772:     {
1773:         return $this->getResource()->getEntityType()->getDefaultAttributeSetId();
1774:     }
1775: 
1776:     /**
1777:      * Return Catalog Product Image helper instance
1778:      *
1779:      * @return Mage_Catalog_Helper_Image
1780:      */
1781:     protected function _getImageHelper()
1782:     {
1783:         return Mage::helper('catalog/image');
1784:     }
1785: 
1786:     /**
1787:      * Return re-sized image URL
1788:      *
1789:      * @deprecated since 1.1.5
1790:      * @return string
1791:      */
1792:     public function getImageUrl()
1793:     {
1794:         return (string)$this->_getImageHelper()->init($this, 'image')->resize(265);
1795:     }
1796: 
1797:     /**
1798:      * Return re-sized small image URL
1799:      *
1800:      * @deprecated since 1.1.5
1801:      * @param int $width
1802:      * @param int $height
1803:      * @return string
1804:      */
1805:     public function getSmallImageUrl($width = 88, $height = 77)
1806:     {
1807:         return (string)$this->_getImageHelper()->init($this, 'small_image')->resize($width, $height);
1808:     }
1809: 
1810:     /**
1811:      * Return re-sized thumbnail image URL
1812:      *
1813:      * @deprecated since 1.1.5
1814:      * @param int $width
1815:      * @param int $height
1816:      * @return string
1817:      */
1818:     public function getThumbnailUrl($width = 75, $height = 75)
1819:     {
1820:         return (string)$this->_getImageHelper()->init($this, 'thumbnail')->resize($width, $height);
1821:     }
1822: 
1823:     /**
1824:      *  Returns system reserved attribute codes
1825:      *
1826:      *  @return array Reserved attribute names
1827:      */
1828:     public function getReservedAttributes()
1829:     {
1830:         if ($this->_reservedAttributes === null) {
1831:             $_reserved = array('position');
1832:             $methods = get_class_methods(__CLASS__);
1833:             foreach ($methods as $method) {
1834:                 if (preg_match('/^get([A-Z]{1}.+)/', $method, $matches)) {
1835:                     $method = $matches[1];
1836:                     $tmp = strtolower(preg_replace('/(.)([A-Z])/', "$1_$2", $method));
1837:                     $_reserved[] = $tmp;
1838:                 }
1839:             }
1840:             $_allowed = array(
1841:                 'type_id','calculated_final_price','request_path','rating_summary'
1842:             );
1843:             $this->_reservedAttributes = array_diff($_reserved, $_allowed);
1844:         }
1845:         return $this->_reservedAttributes;
1846:     }
1847: 
1848:     /**
1849:      *  Check whether attribute reserved or not
1850:      *
1851:      *  @param Mage_Catalog_Model_Entity_Attribute $attribute Attribute model object
1852:      *  @return boolean
1853:      */
1854:     public function isReservedAttribute ($attribute)
1855:     {
1856:         return $attribute->getIsUserDefined()
1857:             && in_array($attribute->getAttributeCode(), $this->getReservedAttributes());
1858:     }
1859: 
1860:     /**
1861:      * Set original loaded data if needed
1862:      *
1863:      * @param string $key
1864:      * @param mixed $data
1865:      * @return Varien_Object
1866:      */
1867:     public function setOrigData($key=null, $data=null)
1868:     {
1869:         if (Mage::app()->getStore()->isAdmin()) {
1870:             return parent::setOrigData($key, $data);
1871:         }
1872: 
1873:         return $this;
1874:     }
1875: 
1876:     /**
1877:      * Reset all model data
1878:      *
1879:      * @return Mage_Catalog_Model_Product
1880:      */
1881:     public function reset()
1882:     {
1883:         $this->unlockAttributes();
1884:         $this->_clearData();
1885:         return $this;
1886:     }
1887: 
1888:     /**
1889:      * Get cahce tags associated with object id
1890:      *
1891:      * @return array
1892:      */
1893:     public function getCacheIdTags()
1894:     {
1895:         $tags = parent::getCacheIdTags();
1896:         $affectedCategoryIds = $this->getAffectedCategoryIds();
1897:         if (!$affectedCategoryIds) {
1898:             $affectedCategoryIds = $this->getCategoryIds();
1899:         }
1900:         foreach ($affectedCategoryIds as $categoryId) {
1901:             $tags[] = Mage_Catalog_Model_Category::CACHE_TAG.'_'.$categoryId;
1902:         }
1903:         return $tags;
1904:     }
1905: 
1906:     /**
1907:      * Check for empty SKU on each product
1908:      *
1909:      * @param  array $productIds
1910:      * @return boolean|null
1911:      */
1912:     public function isProductsHasSku(array $productIds)
1913:     {
1914:         $products = $this->_getResource()->getProductsSku($productIds);
1915:         if (count($products)) {
1916:             foreach ($products as $product) {
1917:                 if (empty($product['sku'])) {
1918:                     return false;
1919:                 }
1920:             }
1921:             return true;
1922:         }
1923:         return null;
1924:     }
1925: 
1926:     /**
1927:      * Parse buyRequest into options values used by product
1928:      *
1929:      * @param  Varien_Object $buyRequest
1930:      * @return Varien_Object
1931:      */
1932:     public function processBuyRequest(Varien_Object $buyRequest)
1933:     {
1934:         $options = new Varien_Object();
1935: 
1936:         /* add product custom options data */
1937:         $customOptions = $buyRequest->getOptions();
1938:         if (is_array($customOptions)) {
1939:             $options->setOptions(array_diff($buyRequest->getOptions(), array('')));
1940:         }
1941: 
1942:         /* add product type selected options data */
1943:         $type = $this->getTypeInstance(true);
1944:         $typeSpecificOptions = $type->processBuyRequest($this, $buyRequest);
1945:         $options->addData($typeSpecificOptions);
1946: 
1947:         /* check correctness of product's options */
1948:         $options->setErrors($type->checkProductConfiguration($this, $buyRequest));
1949: 
1950:         return $options;
1951:     }
1952: 
1953:     /**
1954:      * Get preconfigured values from product
1955:      *
1956:      * @return Varien_Object
1957:      */
1958:     public function getPreconfiguredValues()
1959:     {
1960:         $preconfiguredValues = $this->getData('preconfigured_values');
1961:         if (!$preconfiguredValues) {
1962:             $preconfiguredValues = new Varien_Object();
1963:         }
1964: 
1965:         return $preconfiguredValues;
1966:     }
1967: 
1968:     /**
1969:      * Prepare product custom options.
1970:      * To be sure that all product custom options does not has ID and has product instance
1971:      *
1972:      * @return Mage_Catalog_Model_Product
1973:      */
1974:     public function prepareCustomOptions()
1975:     {
1976:         foreach ($this->getCustomOptions() as $option) {
1977:             if (!is_object($option->getProduct()) || $option->getId()) {
1978:                 $this->addCustomOption($option->getCode(), $option->getValue());
1979:             }
1980:         }
1981: 
1982:         return $this;
1983:     }
1984: 
1985:     /**
1986:      * Clearing references on product
1987:      *
1988:      * @return Mage_Catalog_Model_Product
1989:      */
1990:     protected function _clearReferences()
1991:     {
1992:         $this->_clearOptionReferences();
1993:         return $this;
1994:     }
1995: 
1996:     /**
1997:      * Clearing product's data
1998:      *
1999:      * @return Mage_Catalog_Model_Product
2000:      */
2001:     protected function _clearData()
2002:     {
2003:         foreach ($this->_data as $data){
2004:             if (is_object($data) && method_exists($data, 'reset')){
2005:                 $data->reset();
2006:             }
2007:         }
2008: 
2009:         $this->setData(array());
2010:         $this->setOrigData();
2011:         $this->_customOptions       = array();
2012:         $this->_optionInstance      = null;
2013:         $this->_options             = array();
2014:         $this->_canAffectOptions    = false;
2015:         $this->_errors              = array();
2016: 
2017:         return $this;
2018:     }
2019: 
2020:     /**
2021:      * Clearing references to product from product's options
2022:      *
2023:      * @return Mage_Catalog_Model_Product
2024:      */
2025:     protected function _clearOptionReferences()
2026:     {
2027:         /**
2028:          * unload product options
2029:          */
2030:         if (!empty($this->_options)) {
2031:             foreach ($this->_options as $key => $option) {
2032:                 $option->setProduct();
2033:                 $option->clearInstance();
2034:             }
2035:         }
2036: 
2037:         return $this;
2038:     }
2039: 
2040:     /**
2041:      * Retrieve product entities info as array
2042:      *
2043:      * @param string|array $columns One or several columns
2044:      * @return array
2045:      */
2046:     public function getProductEntitiesInfo($columns = null)
2047:     {
2048:         return $this->_getResource()->getProductEntitiesInfo($columns);
2049:     }
2050: 
2051:     /**
2052:      * Checks whether product has disabled status
2053:      *
2054:      * @return bool
2055:      */
2056:     public function isDisabled()
2057:     {
2058:         return $this->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_DISABLED;
2059:     }
2060: }
2061: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0