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_Bundle_Adminhtml_Bundle_Product_EditController
  • Mage_Bundle_Adminhtml_Bundle_SelectionController
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Composite_Fieldset_Options_Type_Checkbox
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Composite_Fieldset_Options_Type_Multi
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Composite_Fieldset_Options_Type_Radio
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Composite_Fieldset_Options_Type_Select
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Attributes
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Attributes_Extend
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Attributes_Special
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle_Option
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle_Option_Search
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle_Option_Search_Grid
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle_Option_Selection
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tabs
  • Mage_Bundle_Block_Adminhtml_Sales_Order_Items_Renderer
  • Mage_Bundle_Block_Adminhtml_Sales_Order_View_Items_Renderer
  • Mage_Bundle_Block_Catalog_Product_List_Partof
  • Mage_Bundle_Block_Catalog_Product_Price
  • Mage_Bundle_Block_Catalog_Product_View
  • Mage_Bundle_Block_Catalog_Product_View_Type_Bundle
  • Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option
  • Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Checkbox
  • Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Multi
  • Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Radio
  • Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Select
  • Mage_Bundle_Block_Checkout_Cart_Item_Renderer
  • Mage_Bundle_Block_Sales_Order_Items_Renderer
  • Mage_Bundle_Helper_Catalog_Product_Configuration
  • Mage_Bundle_Helper_Data
  • Mage_Bundle_Model_CatalogIndex_Data_Bundle
  • Mage_Bundle_Model_Mysql4_Bundle
  • Mage_Bundle_Model_Mysql4_Indexer_Price
  • Mage_Bundle_Model_Mysql4_Indexer_Stock
  • Mage_Bundle_Model_Mysql4_Option
  • Mage_Bundle_Model_Mysql4_Option_Collection
  • Mage_Bundle_Model_Mysql4_Price_Index
  • Mage_Bundle_Model_Mysql4_Selection
  • Mage_Bundle_Model_Mysql4_Selection_Collection
  • Mage_Bundle_Model_Observer
  • Mage_Bundle_Model_Option
  • Mage_Bundle_Model_Price_Index
  • Mage_Bundle_Model_Product_Attribute_Source_Price_View
  • Mage_Bundle_Model_Product_Price
  • Mage_Bundle_Model_Product_Type
  • Mage_Bundle_Model_Resource_Bundle
  • Mage_Bundle_Model_Resource_Indexer_Price
  • Mage_Bundle_Model_Resource_Indexer_Stock
  • Mage_Bundle_Model_Resource_Option
  • Mage_Bundle_Model_Resource_Option_Collection
  • Mage_Bundle_Model_Resource_Price_Index
  • Mage_Bundle_Model_Resource_Selection
  • Mage_Bundle_Model_Resource_Selection_Collection
  • Mage_Bundle_Model_Sales_Order_Pdf_Items_Abstract
  • Mage_Bundle_Model_Sales_Order_Pdf_Items_Shipment
  • Mage_Bundle_Model_Selection
  • Mage_Bundle_Model_Source_Option_Selection_Price_Type
  • Mage_Bundle_Model_Source_Option_Type
  • 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_Bundle
 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:  * Bundle Resource Model
 30:  *
 31:  * @category    Mage
 32:  * @package     Mage_Bundle
 33:  * @author      Magento Core Team <core@magentocommerce.com>
 34:  */
 35: class Mage_Bundle_Model_Resource_Bundle extends Mage_CatalogIndex_Model_Resource_Data_Abstract
 36: {
 37:     /**
 38:      * Preparing select for getting selection's raw data by product id
 39:      * also can be specified extra parameter for limit which columns should be selected
 40:      *
 41:      * @param int $productId
 42:      * @param array $columns
 43:      * @return Zend_DB_Select
 44:      */
 45:     protected function _getSelect($productId, $columns = array())
 46:     {
 47:         return $this->_getReadAdapter()->select()
 48:             ->from(array("bundle_option" => $this->getTable('bundle/option')), array('type', 'option_id'))
 49:             ->where("bundle_option.parent_id = ?", $productId)
 50:             ->where("bundle_option.required = 1")
 51:             ->joinLeft(array(
 52:                 "bundle_selection" => $this->getTable('bundle/selection')),
 53:                 "bundle_selection.option_id = bundle_option.option_id",
 54:                 $columns
 55:             );
 56:     }
 57: 
 58:     /**
 59:      * Retrieve selection data for specified product id
 60:      *
 61:      * @param int $productId
 62:      * @return array
 63:      */
 64:     public function getSelectionsData($productId)
 65:     {
 66:         return $this->_getReadAdapter()->fetchAll($this->_getSelect(
 67:             $productId,
 68:             array("*")
 69:         ));
 70:     }
 71: 
 72:     /**
 73:      * Removing all quote items for specified product
 74:      *
 75:      * @param int $productId
 76:      */
 77:     public function dropAllQuoteChildItems($productId)
 78:     {
 79:         $quoteItemIds = $this->_getReadAdapter()->fetchCol(
 80:             $this->_getReadAdapter()->select()
 81:             ->from($this->getTable('sales/quote_item'), array('item_id'))
 82:             ->where('product_id = :product_id'),
 83:             array('product_id' => $productId)
 84:         );
 85: 
 86:         if ($quoteItemIds) {
 87:             $this->_getWriteAdapter()->delete(
 88:                 $this->getTable('sales/quote_item'),
 89:                 array('parent_item_id IN(?)' => $quoteItemIds)
 90:             );
 91:         }
 92:     }
 93: 
 94:     /**
 95:      * Removes specified selections by ids for specified product id
 96:      *
 97:      * @param int $productId
 98:      * @param array $ids
 99:      */
100:     public function dropAllUnneededSelections($productId, $ids)
101:     {
102:         $where = array(
103:             'parent_product_id = ?' => $productId
104:         );
105:         if (!empty($ids)) {
106:             $where['selection_id NOT IN (?) '] = $ids;
107:         }
108:         $this->_getWriteAdapter()
109:             ->delete($this->getTable('bundle/selection'), $where);
110:     }
111: 
112:     /**
113:      * Save product relations
114:      *
115:      * @param int $parentId
116:      * @param array $childIds
117:      * @return Mage_Bundle_Model_Resource_Bundle
118:      */
119:     public function saveProductRelations($parentId, $childIds)
120:     {
121:         Mage::getResourceSingleton('catalog/product_relation')
122:             ->processRelations($parentId, $childIds);
123: 
124:         return $this;
125:     }
126: }
127: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0