Public Member Functions | |
getSelectionsData ($productId) | |
dropAllQuoteChildItems ($productId) | |
dropAllUnneededSelections ($productId, $ids) | |
Protected Member Functions | |
_getSelect ($productId, $columns=array()) |
Definition at line 35 of file Bundle.php.
_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
int | $productId | |
array | $columns |
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
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
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
int | $productId |
Definition at line 62 of file Bundle.php.
00063 { 00064 return $this->_getReadAdapter()->fetchAll($this->_getSelect( 00065 $productId, 00066 array("*") 00067 )); 00068 }