Skip to content

Commit 5f1e48e

Browse files
committed
removed no longer necessary query components for stock status indexes
1 parent 9ef4afb commit 5f1e48e

File tree

11 files changed

+0
-452
lines changed

11 files changed

+0
-452
lines changed

app/code/community/Demac/MultiLocationInventory/Helper/Indexer.php

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -5,74 +5,6 @@
55
*/
66
class Demac_MultiLocationInventory_Helper_Indexer extends Mage_Core_Helper_Abstract
77
{
8-
/**
9-
* Get stock status select queries.
10-
*
11-
* @param bool|array $productIds
12-
* @param bool $union Determines if we should return one query string using UNION or multiple queries in an array.
13-
*
14-
* @return array|string
15-
*/
16-
public function getAllStockStatusIndexSelects($productIds = false, $union = true)
17-
{
18-
$stockStatusIndexSelect = array();
19-
foreach ($this->getAllStockStatusIndexes() as $indexerModel) {
20-
$stockStatusIndexSelect[] = $indexerModel->getStockStatusIndexSelectQuery($productIds);
21-
$stockStatusIndexSelect[] = $indexerModel->getGlobalStockStatusIndexSelectQuery($productIds);
22-
}
23-
24-
if($union) {
25-
return implode(' UNION ', $stockStatusIndexSelect);
26-
} else {
27-
return $stockStatusIndexSelect;
28-
}
29-
}
30-
31-
/**
32-
* Get all stock status indexes from config
33-
*
34-
* @return array|string
35-
*/
36-
public function getAllStockStatusIndexes()
37-
{
38-
$indexesConfig = Mage::getConfig()->getNode('global/mli_index_types')->asArray();
39-
foreach ($indexesConfig as &$indexerModel) {
40-
$indexerModel = Mage::getModel($indexerModel);
41-
if(!$indexerModel instanceof Demac_MultiLocationInventory_Model_Stock_Status_Index_Interface) {
42-
Mage::throwException('Invalid Indexer Model ' . get_class($indexes) . ', does not implement Demac_MultiLocationInventory_Model_Stock_Status_Index_Interface. ');
43-
}
44-
}
45-
46-
return $indexesConfig;
47-
}
48-
49-
/**
50-
* A generic update query for inserting into the stock status index based on a provided select query.
51-
*
52-
* The select query should return data in the same format as the
53-
*
54-
* @param string $selectQuery
55-
*
56-
* @return string
57-
*/
58-
public function getUpdateStockStatusIndexQuery($selectQuery)
59-
{
60-
$stockStatusIndexTable = Mage::getModel('core/resource')->getTableName('demac_multilocationinventory/stock_status_index');
61-
62-
return
63-
'UPDATE ' . $stockStatusIndexTable . ' dest,'
64-
. ' ('
65-
. $selectQuery
66-
. ' ) src'
67-
. ' SET'
68-
. ' dest.qty = src.qty,'
69-
. ' dest.is_in_stock = src.is_in_stock,'
70-
. ' dest.backorders = src.backorders,'
71-
. ' dest.manage_stock = src.manage_stock'
72-
. ' WHERE'
73-
. ' dest.store_id = src.store_id'
74-
. ' AND dest.product_id = src.product_id;';
75-
}
768

779

7810
/**

app/code/community/Demac/MultiLocationInventory/Model/Resource/Stock/Status/Index.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,6 @@ protected function _construct()
1313
$this->_init('demac_multilocationinventory/stock_status_index', 'product_id');
1414
}
1515

16-
/**
17-
* Update multi location inventory stock status index.
18-
*
19-
* @param bool|array $productIds
20-
*/
21-
public function updateStockStatusIndex($productIds = false)
22-
{
23-
$query = Mage::helper('demac_multilocationinventory/indexer')->getAllStockStatusIndexSelects($productIds);
24-
$update = Mage::helper('demac_multilocationinventory/indexer')->getUpdateStockStatusIndexQuery($query);
25-
$this->_getWriteAdapter()->query($update);
26-
}
27-
2816
/**
2917
* Update core stock status.
3018
*

app/code/community/Demac/MultiLocationInventory/Model/Stock/Status/Index.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ public function reindex($productIds = false)
4343
$write->exec('CALL DEMAC_MLI_REINDEX_ALL()');
4444
}
4545

46-
//Update multi location inventory stock status index table
47-
$this->getResource()->updateStockStatusIndex($productIds);
48-
4946
//Update core stock status table.
5047
$this->getResource()->updateCoreStockStatus($productIds);
5148

app/code/community/Demac/MultiLocationInventory/Model/Stock/Status/Index/Configurable.php

Lines changed: 0 additions & 10 deletions
This file was deleted.

app/code/community/Demac/MultiLocationInventory/Model/Stock/Status/Index/Downloadable.php

Lines changed: 0 additions & 11 deletions
This file was deleted.

app/code/community/Demac/MultiLocationInventory/Model/Stock/Status/Index/Grouped.php

Lines changed: 0 additions & 75 deletions
This file was deleted.

app/code/community/Demac/MultiLocationInventory/Model/Stock/Status/Index/Interface.php

Lines changed: 0 additions & 25 deletions
This file was deleted.

app/code/community/Demac/MultiLocationInventory/Model/Stock/Status/Index/Query.php

Lines changed: 0 additions & 154 deletions
This file was deleted.

0 commit comments

Comments
 (0)