Mage_Bundle_Model_Mysql4_Bundle Class Reference

Inheritance diagram for Mage_Bundle_Model_Mysql4_Bundle:

Mage_CatalogIndex_Model_Mysql4_Data_Abstract Mage_Core_Model_Mysql4_Abstract Mage_Core_Model_Resource_Abstract

List of all members.

Public Member Functions

 getSelectionsData ($productId)
 dropAllQuoteChildItems ($productId)
 dropAllUnneededSelections ($productId, $ids)

Protected Member Functions

 _getSelect ($productId, $columns=array())


Detailed Description

Definition at line 35 of file Bundle.php.


Member Function Documentation

_getSelect ( productId,
columns = array() 
) [protected]

Preparing select for getting selection's raw data by product id also can be specified extra parameter for limit which columns should be selected

Parameters:
int $productId
array $columns
Returns:
Zend_DB_Select

Definition at line 45 of file Bundle.php.

00046     {
00047         return $this->_getReadAdapter()->select()
00048             ->from(array("bundle_option" => $this->getTable('bundle/option')), array("type", "option_id"))
00049             ->where("bundle_option.parent_id = ?", $productId)
00050             ->where("bundle_option.required = 1")
00051             ->joinLeft(array(
00052                 "bundle_selection" => $this->getTable('bundle/selection')),
00053                 "bundle_selection.option_id = bundle_option.option_id", $columns);
00054     }

dropAllQuoteChildItems ( productId  ) 

Removing all quote items for specified product

Parameters:
int $productId

Definition at line 75 of file Bundle.php.

00076     {
00077         $result = $this->_getReadAdapter()->fetchRow(
00078             $this->_getReadAdapter()->select()
00079                 ->from($this->getTable('sales/quote_item'), "GROUP_CONCAT(`item_id`) as items")
00080                 ->where("product_id = ?", $productId));
00081 
00082         if ($result['items'] != '') {
00083             $this->_getWriteAdapter()
00084                 ->query("DELETE FROM ".$this->getTable('sales/quote_item')."
00085                         WHERE `parent_item_id` in (". $result['items'] .")");
00086         }
00087     }

dropAllUnneededSelections ( productId,
ids 
)

Removes specified selections by ids for specified product id

Parameters:
int $productId
array $ids

Definition at line 95 of file Bundle.php.

00096     {
00097         $this->_getWriteAdapter()
00098             ->query("DELETE FROM ".$this->getTable('bundle/selection')."
00099                     WHERE `parent_product_id` = ". $productId . ( count($ids) > 0 ? " and selection_id not in (" . implode(',', $ids) . ")": ''));
00100     }

getSelectionsData ( productId  ) 

Retrieve selection data for specified product id

Parameters:
int $productId
Returns:
array

Definition at line 62 of file Bundle.php.

00063     {
00064         return $this->_getReadAdapter()->fetchAll($this->_getSelect(
00065             $productId,
00066             array("*")
00067         ));
00068     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:23:34 2009 for Magento by  doxygen 1.5.8