// Merging multishipping branche on 1.5

This commit is contained in:
mDeflotte
2011-11-18 11:13:31 +00:00
parent bc06976a52
commit 0df1a7e2eb
41 changed files with 2870 additions and 889 deletions
+23 -3
View File
@@ -250,13 +250,33 @@ class StockAvailableCore extends ObjectModel
/**
* Upgrades total_quantity_available after having saved
* @see ObjectModel::save()
* @see ObjectModel::add()
*/
public function save($null_values = false, $autodate = true)
public function add($autodate = true, $null_values = false)
{
if (!parent::save($null_values, $autodate))
if (!parent::add($autodate, $null_values))
return false;
$this->afterSave();
}
/**
* Upgrades total_quantity_available after having update
* @see ObjectModel::update()
*/
public function update($null_values = false)
{
if (!parent::update($null_values))
return false;
$this->afterSave();
}
/**
* Upgrades total_quantity_available after having saved
* @see StockAvailableCore::update()
* @see StockAvailableCore::add()
*/
public function afterSave()
{
if ($this->id_product_attribute == 0)
return true;
+24
View File
@@ -267,6 +267,30 @@ class WarehouseCore extends ObjectModel
return (Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query));
}
/**
* For a given {product, product attribute} gets warehouse list
*
* @param int $id_product
* @param int $id_product_attribute
* @param int $id_shop
* @return string
*/
public static function getProductWarehouseList($id_product, $id_product_attribute, $id_shop = null)
{
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');
$query->innerJoin('warehouse_shop ws ON (ws.id_warehouse = wpl.id_warehouse AND id_shop = '.(int)$id_shop.')');
$query->where('id_product = '.(int)$id_product);
$query->where('id_product_attribute = '.(int)$id_product_attribute);
$query->groupBy('wpl.id_warehouse');
return (Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query));
}
/**
* Gets available warehouses