00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 class Mage_Bundle_Model_Mysql4_Price_Index extends Mage_Core_Model_Mysql4_Abstract
00036 {
00037
00038
00039
00040
00041
00042 protected $_attributes = array();
00043
00044
00045
00046
00047
00048
00049 protected $_websites;
00050
00051
00052
00053
00054
00055
00056 protected $_customerGroups;
00057
00058
00059
00060
00061
00062 protected function _construct()
00063 {
00064 $this->_init('bundle/price_index', 'entity_id');
00065 }
00066
00067
00068
00069
00070
00071
00072
00073 protected function _getAttribute($attributeCode)
00074 {
00075 if (!isset($this->_attributes[$attributeCode])) {
00076 $this->_attributes[$attributeCode] = Mage::getSingleton('catalog/config')
00077 ->getAttribute('catalog_product', $attributeCode);
00078 }
00079 return $this->_attributes[$attributeCode];
00080 }
00081
00082
00083
00084
00085
00086
00087 protected function _getWebsites()
00088 {
00089 if (is_null($this->_websites)) {
00090 $this->_websites = Mage::app()->getWebsites(false);
00091 }
00092 return $this->_websites;
00093 }
00094
00095
00096
00097
00098
00099
00100 protected function _getCustomerGroups()
00101 {
00102 if (is_null($this->_customerGroups)) {
00103 $this->_customerGroups = array();
00104 foreach (Mage::getModel('customer/group')->getCollection() as $group) {
00105 $this->_customerGroups[$group->getId()] = $group;
00106 }
00107 }
00108 return $this->_customerGroups;
00109 }
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119 public function getProducts($product = null, $lastEntityId = 0, $limit = 100)
00120 {
00121 $select = $this->_getReadAdapter()->select()
00122 ->from(
00123 array('e' => $this->getTable('catalog/product')),
00124 array('entity_id'))
00125 ->where('e.type_id=?', 'bundle');
00126 if ($product instanceof Mage_Core_Model_Product) {
00127 $select->where('e.entity_id=?', $product->getId());
00128 }
00129 elseif ($product instanceof Mage_Catalog_Model_Product_Condition_Interface) {
00130 $value = new Zend_Db_Expr($product->getIdsSelect($this->_getReadAdapter()));
00131 $select->where('e.entity_id IN(?)', $value);
00132 }
00133 elseif (is_numeric($product) || is_array($product)) {
00134 $select->where('e.entity_id IN(?)', $product);
00135 }
00136
00137 $priceType = $this->_getAttribute('price_type');
00138 $priceTypeAlias = 't_' . $priceType->getAttributeCode();
00139 $joinConds = array(
00140 $this->_getReadAdapter()->quoteInto($priceTypeAlias . '.attribute_id=?', $priceType->getAttributeId()),
00141 $priceTypeAlias.'.store_id=0',
00142 $priceTypeAlias.'.entity_id=e.entity_id'
00143 );
00144 $select->joinLeft(
00145 array($priceTypeAlias => $priceType->getBackend()->getTable()),
00146 join(' AND ', $joinConds),
00147 array('price_type' => $priceTypeAlias . '.value')
00148 );
00149
00150 $select->where('e.entity_id>?', $lastEntityId)
00151 ->order('e.entity_id')
00152 ->limit($limit);
00153
00154 return $this->_getReadAdapter()->fetchPairs($select);
00155 }
00156
00157
00158
00159
00160
00161
00162
00163 public function reindex($products = null)
00164 {
00165 $lastEntityId = 0;
00166 while (true) {
00167 $productsData = $this->getProducts($products, $lastEntityId);
00168 if (!$productsData) {
00169 break;
00170 }
00171
00172 foreach ($productsData as $productId => $priceType) {
00173 $this->_reindexProduct($productId, $priceType);
00174 $lastEntityId = $productId;
00175 }
00176 }
00177
00178 return $this;
00179 }
00180
00181
00182
00183
00184
00185
00186
00187
00188 protected function _reindexProduct($productId, $priceType)
00189 {
00190 $options = $this->getSelections($productId);
00191 $selectionProducts = array();
00192 foreach ($options as $option) {
00193 foreach ($option['selections'] as $selection) {
00194 $selectionProducts[$selection['product_id']] = $selection['product_id'];
00195 }
00196 }
00197
00198 $priceIndex = array();
00199 if ($priceType == Mage_Bundle_Model_Product_Price::PRICE_TYPE_DYNAMIC) {
00200
00201 $priceIndex = $this->getProductsPriceFromIndex($selectionProducts);
00202 }
00203
00204 foreach ($this->_getWebsites() as $website) {
00205 if (!$website->getDefaultStore()) {
00206 continue;
00207 }
00208 $salableStatus = $this->getProductsSalableStatus($selectionProducts, $website);
00209 $priceData = $this->getProductsPriceData($productId, $website);
00210 $priceData = $priceData[$productId];
00211
00212
00213 foreach ($this->_getCustomerGroups() as $group) {
00214
00215 if ($priceType == Mage_Bundle_Model_Product_Price::PRICE_TYPE_FIXED) {
00216 $basePrice = $this->_getBasePrice($productId, $priceData, $website, $group);
00217 $customOptions = $this->getCustomOptions($productId, $website);
00218 }
00219 elseif ($priceType == Mage_Bundle_Model_Product_Price::PRICE_TYPE_DYNAMIC) {
00220 $basePrice = 0;
00221 }
00222
00223 list($minPrice, $maxPrice) = $this->_calculateBundleSelections($options, $salableStatus,
00224 $productId, $priceType, $basePrice, $priceData, $priceIndex, $website, $group);
00225
00226 if ($priceType == Mage_Bundle_Model_Product_Price::PRICE_TYPE_FIXED) {
00227 list($minPrice, $maxPrice) = $this->_calculateCustomOptions($customOptions, $basePrice, $minPrice, $maxPrice);
00228 }
00229
00230 $this->_savePriceIndex($productId, $website->getId(), $group->getId(), $minPrice, $maxPrice);
00231 }
00232 }
00233
00234 return $this;
00235 }
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247 protected function _savePriceIndex($productId, $websiteId, $groupId, $minPrice, $maxPrice)
00248 {
00249 $adapter = $this->_getWriteAdapter();
00250 $adapter->beginTransaction();
00251 $sql = sprintf('INSERT INTO %s VALUES(?,?,?,?,?) ON DUPLICATE KEY UPDATE'
00252 . ' `min_price`=VALUES(`min_price`), `max_price`=VALUES(`max_price`)',
00253 $adapter->quoteIdentifier($this->getMainTable()));
00254 $bind = array($productId, $websiteId, $groupId, $minPrice, $maxPrice);
00255 $adapter->query($sql, $bind);
00256 $adapter->commit();
00257
00258 return $this;
00259 }
00260
00261
00262
00263
00264
00265
00266
00267 public function getSelections($productId)
00268 {
00269 $options = array();
00270 $select = $this->_getReadAdapter()->select()
00271 ->from(
00272 array('option_table' => $this->getTable('bundle/option')),
00273 array('option_id', 'required', 'type'))
00274 ->join(
00275 array('selection_table' => $this->getTable('bundle/selection')),
00276 'selection_table.option_id=option_table.option_id',
00277 array('selection_id', 'product_id', 'selection_price_type',
00278 'selection_price_value', 'selection_qty', 'selection_can_change_qty')
00279 )
00280 ->where('option_table.parent_id=?', $productId);
00281 $query = $this->_getReadAdapter()->query($select);
00282 while ($row = $query->fetch()) {
00283 if (!isset($options[$row['option_id']])) {
00284 $options[$row['option_id']] = array(
00285 'option_id' => $row['option_id'],
00286 'required' => $row['required'],
00287 'type' => $row['type'],
00288 'selections' => array()
00289 );
00290 }
00291 $options[$row['option_id']]['selections'][$row['selection_id']] = array(
00292 'selection_id' => $row['selection_id'],
00293 'product_id' => $row['product_id'],
00294 'price_type' => $row['selection_price_type'],
00295 'price_value' => $row['selection_price_value'],
00296 'qty' => $row['selection_qty'],
00297 'can_change_qty' => $row['selection_can_change_qty']
00298 );
00299 }
00300
00301 return $options;
00302 }
00303
00304
00305
00306
00307
00308
00309
00310
00311 public function getProductsSalableStatus($products, Mage_Core_Model_Website $website)
00312 {
00313 $productsData = array();
00314 $select = $this->_getReadAdapter()->select()
00315 ->from(array('e' => $this->getTable('catalog/product')), 'entity_id')
00316 ->where('e.entity_id IN(?)', $products);
00317
00318 $select->joinLeft(
00319 array('pw' => $this->getTable('catalog/product_website')),
00320 'e.entity_id=pw.product_id AND pw.website_id=' . $website->getId(),
00321 array('pw.website_id')
00322 );
00323
00324 $store = $website->getDefaultStore();
00325
00326
00327 $status = $this->_getAttribute('status');
00328 if ($status->isScopeGlobal()) {
00329 $select->join(
00330 array('t_status' => $status->getBackend()->getTable()),
00331 'e.entity_id=t_status.entity_id'
00332 . ' AND t_status.attribute_id=' . $status->getAttributeId()
00333 . ' AND t_status.store_id=0',
00334 array('status' => 't_status.value'));
00335 }
00336 else {
00337 $statusTable = $status->getBackend()->getTable();
00338 $select->join(
00339 array('t1_status' => $statusTable),
00340 'e.entity_id=t1_status.entity_id'
00341 . ' AND t1_status.attribute_id=' . $status->getAttributeId()
00342 . ' AND t1_status.store_id=0',
00343 array('status' => 'IFNULL(t2_status.value, t1_status.value)'))
00344 ->joinLeft(
00345 array('t2_status' => $statusTable),
00346 't1_status.entity_id = t2_status.entity_id'
00347 . ' AND t1_status.attribute_id = t2_status.attribute_id'
00348 . ' AND t2_status.store_id=' . $store->getId(),
00349 array());
00350 }
00351
00352 Mage::dispatchEvent('catalog_product_prepare_index_select', array(
00353 'website' => $website,
00354 'select' => $select
00355 ));
00356
00357 $query = $this->_getReadAdapter()->query($select);
00358 while ($row = $query->fetch()) {
00359 $salable = isset($row['salable']) ? $row['salable'] : true;
00360 $website = $row['website_id'] > 0 ? true : false;
00361 $status = $row['status'];
00362
00363 $productsData[$row['entity_id']] = $salable && $status && $website;
00364 }
00365
00366 return $productsData;
00367 }
00368
00369
00370
00371
00372
00373
00374
00375
00376 public function getProductsPriceFromIndex($productIds)
00377 {
00378 $index = array();
00379 $price = $this->_getAttribute('price');
00380 $select = $this->_getReadAdapter()->select()
00381 ->from(
00382 array('price_index' => $this->getTable('catalogindex/price')),
00383 array('entity_id', 'customer_group_id', 'website_id', 'value'))
00384 ->where('entity_id IN(?)', $productIds)
00385 ->where('attribute_id=?', $price->getAttributeId());
00386 $query = $this->_getReadAdapter()->query($select);
00387 while ($row = $query->fetch()) {
00388 $indexKey = join('-', array(
00389 $row['entity_id'],
00390 $row['website_id'],
00391 $row['customer_group_id']
00392 ));
00393 $index[$indexKey] = $row['value'];
00394 }
00395 return $index;
00396 }
00397
00398
00399
00400
00401
00402
00403
00404
00405 public function getProductsPriceData($products, Mage_Core_Model_Website $website)
00406 {
00407 $productsData = array();
00408 $select = $this->_getReadAdapter()->select()
00409 ->from(array('e' => $this->getTable('catalog/product')), 'entity_id')
00410 ->where('e.entity_id IN(?)', $products);
00411
00412 $this->_addAttributeDataToSelect($select, 'price', $website);
00413 $this->_addAttributeDataToSelect($select, 'special_price', $website);
00414 $this->_addAttributeDataToSelect($select, 'special_from_date', $website);
00415 $this->_addAttributeDataToSelect($select, 'special_to_date', $website);
00416
00417 $query = $this->_getReadAdapter()->query($select);
00418 while ($row = $query->fetch()) {
00419 $productsData[$row['entity_id']] = array(
00420 'price' => $row['price'],
00421 'special_price' => $row['special_price'],
00422 'special_from_date' => $row['special_from_date'],
00423 'special_to_date' => $row['special_to_date']
00424 );
00425 }
00426
00427 return $productsData;
00428 }
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438 protected function _addAttributeDataToSelect(Varien_Db_Select $select, $attributeCode, Mage_Core_Model_Website $website)
00439 {
00440 $attribute = $this->_getAttribute($attributeCode);
00441 $store = $website->getDefaultStore();
00442 if ($attribute->isScopeGlobal()) {
00443 $table = 't_' . $attribute->getAttributeCode();
00444 $select->joinLeft(
00445 array($table => $attribute->getBackend()->getTable()),
00446 'e.entity_id='.$table.'.entity_id'
00447 . ' AND '.$table.'.attribute_id=' . $attribute->getAttributeId()
00448 . ' AND '.$table.'.store_id=0',
00449 array($attribute->getAttributeCode() => $table . '.value'));
00450 }
00451 else {
00452 $tableName = $attribute->getBackend()->getTable();
00453 $tableGlobal = 't1_' . $attribute->getAttributeCode();
00454 $tableStore = 't2_' . $attribute->getAttributeCode();
00455
00456 $select->joinLeft(
00457 array($tableGlobal => $tableName),
00458 'e.entity_id='.$tableGlobal.'.entity_id'
00459 . ' AND '.$tableGlobal.'.attribute_id=' . $attribute->getAttributeId()
00460 . ' AND '.$tableGlobal.'.store_id=0',
00461 array($attribute->getAttributeCode() => 'IFNULL('.$tableStore.'.value, '.$tableGlobal.'.value)'))
00462 ->joinLeft(
00463 array($tableStore => $tableName),
00464 $tableGlobal.'.entity_id = '.$tableStore.'.entity_id'
00465 . ' AND '.$tableGlobal.'.attribute_id = '.$tableStore.'.attribute_id'
00466 . ' AND '.$tableStore.'.store_id=' . $store->getId(),
00467 array());
00468 }
00469 return $this;
00470 }
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481 protected function _getBasePrice($productId, array $priceData, $website, $customerGroup)
00482 {
00483 $store = $website->getDefaultStore();
00484 $storeTimeStamp = Mage::app()->getLocale()->storeTimeStamp($store);
00485 $finalPrice = $this->_calculateSpecialPrice($priceData['price'], $priceData, $website);
00486
00487 $rulePrice = Mage::getResourceModel('catalogrule/rule')
00488 ->getRulePrice($storeTimeStamp, $website->getId(), $customerGroup->getId(), $productId);
00489
00490 if ($rulePrice !== null && $rulePrice !== false) {
00491 $finalPrice = min($finalPrice, $rulePrice);
00492 }
00493
00494 return $finalPrice;
00495 }
00496
00497
00498
00499
00500
00501
00502
00503
00504 public function getCustomOptions($productId, Mage_Core_Model_Website $website)
00505 {
00506 $options = array();
00507 $store = $website->getDefaultStore();
00508 $price = $this->_getAttribute('price');
00509
00510 $select = $this->getReadConnection()->select()
00511 ->from(
00512 array('option_table' => $this->getTable('catalog/product_option')),
00513 array('option_id', 'is_require', 'type'))
00514 ->where('option_table.product_id=?', $productId);
00515
00516 if ($price->isScopeGlobal()) {
00517 $select->join(
00518 array('price_table' => $this->getTable('catalog/product_option_price')),
00519 'option_table.option_id=price_table.option_id'
00520 . ' AND price_table.store_id=0',
00521 array('value_id' => 'option_price_id', 'price', 'price_type')
00522 );
00523 }
00524 else {
00525 $select
00526 ->join(
00527 array('price_global_table' => $this->getTable('catalog/product_option_price')),
00528 'option_table.option_id=price_global_table.option_id'
00529 . ' AND price_global_table.store_id=0',
00530 array(
00531 'value_id' => 'IFNULL(price_store_table.option_price_id, price_global_table.option_price_id)',
00532 'price' => 'IFNULL(price_store_table.price, price_global_table.price)',
00533 'price_type' => 'IFNULL(price_store_table.price_type, price_global_table.price_type)'
00534 ))
00535 ->joinLeft(
00536 array('price_store_table' => $this->getTable('catalog/product_option_price')),
00537 'option_table.option_id=price_store_table.option_id'
00538 . ' AND price_store_table.store_id=' . $store->getId(),
00539 array());
00540 }
00541
00542 $query = $this->_getReadAdapter()->query($select);
00543 while ($row = $query->fetch()) {
00544 if (!isset($options[$row['option_id']])) {
00545 $options[$row['option_id']] = array(
00546 'option_id' => $row['option_id'],
00547 'is_require' => $row['is_require'],
00548 'type' => $row['type'],
00549 'values' => array()
00550 );
00551 }
00552 $options[$row['option_id']]['values'][$row['value_id']] = array(
00553 'price_type' => $row['price_type'],
00554 'price_value' => $row['price']
00555 );
00556 }
00557
00558 $select = $this->getReadConnection()->select()
00559 ->from(
00560 array('option_table' => $this->getTable('catalog/product_option')),
00561 array('option_id', 'is_require', 'type'))
00562 ->join(
00563 array('type_table' => $this->getTable('catalog/product_option_type_value')),
00564 'option_table.option_id=type_table.option_id',
00565 array()
00566 )
00567 ->where('option_table.product_id=?', $productId);
00568
00569 if ($price->isScopeGlobal()) {
00570 $select->join(
00571 array('price_table' => $this->getTable('catalog/product_option_type_price')),
00572 'type_table.option_type_id=price_table.option_type_id'
00573 . ' AND price_table.store_id=0',
00574 array('value_id' => 'option_type_id', 'price', 'price_type')
00575 );
00576 }
00577 else {
00578 $select
00579 ->join(
00580 array('price_global_table' => $this->getTable('catalog/product_option_type_price')),
00581 'type_table.option_type_id=price_global_table.option_type_id'
00582 . ' AND price_global_table.store_id=0',
00583 array(
00584 'value_id' => 'IFNULL(price_store_table.option_type_id, price_global_table.option_type_id)',
00585 'price' => 'IFNULL(price_store_table.price, price_global_table.price)',
00586 'price_type' => 'IFNULL(price_store_table.price_type, price_global_table.price_type)'
00587 ))
00588 ->joinLeft(
00589 array('price_store_table' => $this->getTable('catalog/product_option_type_price')),
00590 'type_table.option_type_id=price_store_table.option_type_id'
00591 . ' AND price_store_table.store_id=' . $store->getId(),
00592 array());
00593 }
00594
00595 $query = $this->_getReadAdapter()->query($select);
00596 while ($row = $query->fetch()) {
00597 if (!isset($options[$row['option_id']])) {
00598 $options[$row['option_id']] = array(
00599 'option_id' => $row['option_id'],
00600 'is_require' => $row['is_require'],
00601 'type' => $row['type'],
00602 'values' => array()
00603 );
00604 }
00605 $options[$row['option_id']]['values'][$row['value_id']] = array(
00606 'price_type' => $row['price_type'],
00607 'price_value' => $row['price']
00608 );
00609 }
00610
00611 return $options;
00612 }
00613
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623
00624 public function _calculateCustomOptions(array $options, $basePrice, $minPrice, $maxPrice)
00625 {
00626 foreach ($options as $option) {
00627 $optionPrices = array();
00628 foreach ($option['values'] as $value) {
00629 if ($value['price_type'] == 'percent') {
00630 $valuePrice = $basePrice * $value['price_value'] / 100;;
00631 }
00632 else {
00633 $valuePrice = $value['price_value'];
00634 }
00635 $optionPrices[] = $valuePrice;
00636 }
00637 if ($option['is_require']) {
00638 $minPrice += min($optionPrices);
00639 }
00640 $multiTypes = array(
00641 Mage_Catalog_Model_Product_Option::OPTION_TYPE_DROP_DOWN,
00642 Mage_Catalog_Model_Product_Option::OPTION_TYPE_CHECKBOX,
00643 Mage_Catalog_Model_Product_Option::OPTION_TYPE_MULTIPLE
00644 );
00645 if ($optionPrices) {
00646 if (in_array($option['type'], $multiTypes)) {
00647 $maxPrice += array_sum($optionPrices);
00648 }
00649 else {
00650 $maxPrice += max($optionPrices);
00651 }
00652 }
00653 }
00654
00655 return array($minPrice, $maxPrice);
00656 }
00657
00658
00659
00660
00661
00662
00663
00664
00665
00666
00667
00668
00669
00670
00671
00672
00673 public function _calculateBundleSelections(array $options, array $salableStatus,
00674 $productId, $priceType, $basePrice, $priceData, $priceIndex, $website, $group)
00675 {
00676 $minPrice = $maxPrice = $basePrice;
00677
00678 foreach ($options as $option) {
00679 $optionPrices = array();
00680 foreach ($option['selections'] as $selection) {
00681 if (!$selection['product_id']) {
00682 continue;
00683 }
00684
00685 if (!$salableStatus[$selection['product_id']]) {
00686 continue;
00687 }
00688
00689 if ($priceType == Mage_Bundle_Model_Product_Price::PRICE_TYPE_FIXED) {
00690 $basePrice = $this->_getBasePrice($productId, $priceData, $website, $group);
00691 }
00692
00693
00694 if ($priceType == Mage_Bundle_Model_Product_Price::PRICE_TYPE_DYNAMIC) {
00695 $priceIndexKey = join('-', array(
00696 $selection['product_id'],
00697 $website->getId(),
00698 $group->getId()
00699 ));
00700
00701 $selectionPrice = isset($priceIndex[$priceIndexKey]) ? $priceIndex[$priceIndexKey] : 0;
00702 $selectionPrice = $this->_calculateSpecialPrice($selectionPrice, $priceData, $website);
00703 }
00704 else {
00705 if ($selection['price_type']) {
00706 $selectionPrice = $basePrice * $selection['price_value'] / 100;
00707 }
00708 else {
00709 $selectionPrice = $this->_calculateSpecialPrice($selection['price_value'], $priceData, $website);
00710 }
00711 }
00712
00713
00714 if ($selection['can_change_qty'] && $option['type'] != 'multi' && $option['type'] != 'checkbox') {
00715 $qty = 1;
00716 } else {
00717 $qty = $selection['qty'];
00718 }
00719
00720 $selectionPrice = $selectionPrice * $qty;
00721 $optionPrices[$selection['selection_id']] = $selectionPrice;
00722 }
00723
00724 if ($optionPrices) {
00725 if ($option['required']) {
00726 $minPrice += min($optionPrices);
00727 }
00728 if (in_array($option['type'], array('multi', 'checkbox'))) {
00729 $maxPrice += array_sum($optionPrices);
00730 }
00731 else {
00732 $maxPrice += max($optionPrices);
00733 }
00734 }
00735 }
00736 return array($minPrice, $maxPrice);
00737 }
00738
00739
00740
00741
00742
00743
00744
00745
00746
00747 public function _calculateSpecialPrice($finalPrice, array $priceData, Mage_Core_Model_Website $website)
00748 {
00749 $store = $website->getDefaultStore();
00750 $specialPrice = $priceData['special_price'];
00751
00752 if (!is_null($specialPrice) && $specialPrice != false) {
00753 if (Mage::app()->getLocale()->IsStoreDateInInterval($store, $priceData['special_from_date'], $priceData['special_to_date'])) {
00754 $specialPrice = ($finalPrice * $specialPrice) / 100;
00755 $finalPrice = min($finalPrice, $specialPrice);
00756 }
00757 }
00758
00759 return $finalPrice;
00760 }
00761
00762
00763
00764
00765
00766
00767
00768
00769
00770 public function loadPriceIndex($productIds, $websiteId, $groupId)
00771 {
00772 $prices = array();
00773 $select = $this->_getReadAdapter()->select()
00774 ->from(
00775 array('pi' => $this->getMainTable()),
00776 array('entity_id', 'min_price', 'max_price'))
00777 ->where('entity_id IN(?)', $productIds)
00778 ->where('website_id=?', $websiteId)
00779 ->where('customer_group_id=?', $groupId);
00780 $query = $this->_getReadAdapter()->query($select);
00781 while ($row = $query->fetch()) {
00782 $prices[$row['entity_id']] = array(
00783 'min_price' => $row['min_price'],
00784 'max_price' => $row['max_price']
00785 );
00786 }
00787
00788 return $prices;
00789 }
00790 }