// StockAvailable: updated synchronize() and updated its usage within the different stock controllers when necessary

This commit is contained in:
bMancone
2011-11-21 11:01:33 +00:00
parent 9426e5d883
commit 3c1fa76032
8 changed files with 165 additions and 124 deletions
+22 -2
View File
@@ -267,7 +267,7 @@ class WarehouseCore extends ObjectModel
return (Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query));
}
/**
* For a given {product, product attribute} gets warehouse list
*
@@ -280,7 +280,7 @@ class WarehouseCore extends ObjectModel
{
if (is_null($id_shop))
$id_shop = Context::getContext()->shop->getID(true);
$query = new DbQuery();
$query->select('wpl.id_warehouse');
$query->from('warehouse_product_location wpl');
@@ -317,6 +317,26 @@ class WarehouseCore extends ObjectModel
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
}
/**
* Gets ids of warehouses, grouped by ids of shops
*
* @return array
*/
public static function getWarehousesGroupedByShops()
{
$ids_warehouse = array();
$query = new DbQuery();
$query->select('id_warehouse, id_shop');
$query->from('warehouse_shop');
$query->orderBy('id_shop');
// queries to get warehouse ids grouped by shops
foreach (Db::getInstance()->executeS($query) as $row)
$ids_warehouse[$row['id_shop']][] = $row['id_warehouse'];
return $ids_warehouse;
}
/**
* Gets the number of products in the current warehouse
*