// StockAvailable: updated synchronize() and updated its usage within the different stock controllers when necessary
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10331 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user