// AdminStockInstantStateController updated
This commit is contained in:
1 parent
1c2c377e6e
commit
21f1debc96
3 files changed
+154
-195
No files matched your search
@@ -1,15 +1,17 @@
|
|||||||
{extends file="helper/list/list_header.tpl"}
|
{extends file="helper/list/list_header.tpl"}
|
||||||
{block name=leadin}
|
{block name=leadin}
|
||||||
{if count($list_warehouses) > 1}
|
<form id="stock_instant_state" type="get">
|
||||||
<form type="get">
|
<input type="hidden" name="controller" value="AdminStockInstantState" />
|
||||||
<label for="wareouse">{l s="Select a warehouse:"}</label>
|
<input type="hidden" name="token" value="{$token}" />
|
||||||
<input type="hidden" name="controller" value="AdminStockInstantState" />
|
{if count($stock_instant_state_warehouses) > 1}
|
||||||
<input type="hidden" name="token" value="{$token}" />
|
<div id="stock_instant_state_form_warehouse">
|
||||||
<select name="warehouse" onchange="$(this).parent().submit();">
|
<label for="instant_state_warehouse">{l s="Select a warehouse:"}</label>
|
||||||
{foreach $list_warehouses as $warehouse}
|
<select name="instant_state_warehouse" onChange="$(this).parent().parent().submit();">
|
||||||
<option {if $warehouse.id_warehouse == $current_warehouse}selected="selected"{/if} value="{$warehouse.id_warehouse}">{$warehouse.name}</option>
|
{foreach from=$stock_instant_state_warehouses key=k item=i}
|
||||||
|
<option {if $i.id_warehouse == $stock_instant_state_cur_warehouse} selected="selected"{/if} value="{$i.id_warehouse}">{$i.name}</option>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</select>
|
</select>
|
||||||
</form>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
{/block}
|
</form>
|
||||||
|
{/block}
|
||||||
@@ -71,6 +71,7 @@ class AdminStockCoverControllerCore extends AdminController
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// pre-defines coverage periods
|
||||||
$this->stock_cover_periods = array(
|
$this->stock_cover_periods = array(
|
||||||
$this->l('One week') => 7,
|
$this->l('One week') => 7,
|
||||||
$this->l('Two weeks') => 14,
|
$this->l('Two weeks') => 14,
|
||||||
@@ -80,7 +81,9 @@ class AdminStockCoverControllerCore extends AdminController
|
|||||||
$this->l('One year') => 365
|
$this->l('One year') => 365
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// gets the list of warehouses available
|
||||||
$this->stock_cover_warehouses = Warehouse::getWarehouseList(true);
|
$this->stock_cover_warehouses = Warehouse::getWarehouseList(true);
|
||||||
|
// gets the final list of warehouses
|
||||||
array_unshift($this->stock_cover_warehouses, array('id_warehouse' => -1, 'name' => $this->l('All Warehouses')));
|
array_unshift($this->stock_cover_warehouses, array('id_warehouse' => -1, 'name' => $this->l('All Warehouses')));
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@@ -92,7 +95,7 @@ class AdminStockCoverControllerCore extends AdminController
|
|||||||
*/
|
*/
|
||||||
public function ajaxProcess()
|
public function ajaxProcess()
|
||||||
{
|
{
|
||||||
if (Tools::isSubmit('id'))
|
if (Tools::isSubmit('id')) // if a product id is submit
|
||||||
{
|
{
|
||||||
$this->lang = false;
|
$this->lang = false;
|
||||||
$lang_id = (int)$this->context->language->id;
|
$lang_id = (int)$this->context->language->id;
|
||||||
@@ -225,12 +228,9 @@ class AdminStockCoverControllerCore extends AdminController
|
|||||||
|
|
||||||
if ($warehouse == 0)
|
if ($warehouse == 0)
|
||||||
{
|
{
|
||||||
$warehouse = -1;
|
$warehouse = -1; // all warehouses
|
||||||
if ((int)Tools::getValue('coverage_warehouse'))
|
if ((int)Tools::getValue('coverage_warehouse'))
|
||||||
$warehouse = (int)Tools::getValue('coverage_warehouse');
|
$warehouse = (int)Tools::getValue('coverage_warehouse');
|
||||||
else if ((int)$this->context->cookie->warehouse)
|
|
||||||
$warehouse = (int)$this->context->cookie->warehouse;
|
|
||||||
$this->context->cookie->warehouse = $warehouse;
|
|
||||||
}
|
}
|
||||||
return $warehouse;
|
return $warehouse;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,239 +30,196 @@
|
|||||||
*/
|
*/
|
||||||
class AdminStockInstantStateControllerCore extends AdminController
|
class AdminStockInstantStateControllerCore extends AdminController
|
||||||
{
|
{
|
||||||
private $_default_order_by = 'id_product';
|
private $stock_instant_state_warehouses = array();
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->context = Context::getContext();
|
$this->context = Context::getContext();
|
||||||
$this->table = 'stock';
|
$this->table = 'product';
|
||||||
$this->lang = false;
|
$this->className = 'Product';
|
||||||
|
$this->lang = true;
|
||||||
|
|
||||||
$this->fieldsDisplay = array(
|
$this->fieldsDisplay = array(
|
||||||
'ean13' => array(
|
|
||||||
'title' => $this->l('EAN13'),
|
|
||||||
'width' => 100
|
|
||||||
),
|
|
||||||
'reference' => array(
|
'reference' => array(
|
||||||
'title' => $this->l('Reference'),
|
'title' => $this->l('Reference'),
|
||||||
'width' => 250,
|
'align' => 'center',
|
||||||
'filter_key' => 'p!reference'
|
'width' => 200,
|
||||||
),
|
),
|
||||||
'designation' => array(
|
'ean13' => array(
|
||||||
'title' => $this->l('Product name'),
|
'title' => $this->l('EAN13'),
|
||||||
'filter_key' => 'designation',
|
|
||||||
'havingFilter' => true
|
|
||||||
),
|
|
||||||
'price_te' => array(
|
|
||||||
'title' => $this->l('Price'),
|
|
||||||
'align' => 'center',
|
'align' => 'center',
|
||||||
'width' => 100,
|
'width' => 100,
|
||||||
'havingFilter' => true
|
),
|
||||||
|
'name' => array(
|
||||||
|
'title' => $this->l('Name'),
|
||||||
|
'filter_key' => 'b!name'
|
||||||
|
),
|
||||||
|
'price_te' => array(
|
||||||
|
'title' => $this->l('Price (te)'),
|
||||||
|
'width' => 150,
|
||||||
|
'orderby' => false,
|
||||||
|
'search' => false
|
||||||
),
|
),
|
||||||
'physical_quantity' => array(
|
'physical_quantity' => array(
|
||||||
'title' => $this->l('Physical quantity'),
|
'title' => $this->l('Physical quantity'),
|
||||||
'align' => 'center',
|
|
||||||
'width' => 80,
|
'width' => 80,
|
||||||
'havingFilter' => true
|
'orderby' => false,
|
||||||
|
'search' => false
|
||||||
),
|
),
|
||||||
'usable_quantity' => array(
|
'usable_quantity' => array(
|
||||||
'title' => $this->l('Usable quantity'),
|
'title' => $this->l('Usable quantity'),
|
||||||
'align' => 'center',
|
|
||||||
'width' => 80,
|
'width' => 80,
|
||||||
'havingFilter' => true
|
'orderby' => false,
|
||||||
|
'search' => false
|
||||||
),
|
),
|
||||||
'real_quantity' => array(
|
'real_quantity' => array(
|
||||||
'title' => $this->l('Real quantity'),
|
'title' => $this->l('Real quantity'),
|
||||||
'align' => 'center',
|
|
||||||
'width' => 80,
|
'width' => 80,
|
||||||
'filter' => false,
|
'orderby' => false,
|
||||||
'search' => false,
|
'search' => false
|
||||||
'orderby' => false
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$this->stock_instant_state_warehouses = Warehouse::getWarehouseList(true);
|
||||||
|
array_unshift($this->stock_instant_state_warehouses, array('id_warehouse' => -1, 'name' => $this->l('All Warehouses')));
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method called when an ajax request is made
|
||||||
|
* @see AdminController::postProcess()
|
||||||
|
*/
|
||||||
|
public function ajaxProcess()
|
||||||
|
{
|
||||||
|
if (Tools::isSubmit('id')) // if a product id is submit
|
||||||
|
{
|
||||||
|
$this->lang = false;
|
||||||
|
$lang_id = (int)$this->context->language->id;
|
||||||
|
$id_product = (int)Tools::getValue('id');
|
||||||
|
$warehouse = (Tools::getValue('warehouse') ? (int)Tools::getValue('warehouse') : -1);
|
||||||
|
|
||||||
|
$query = '
|
||||||
|
SELECT a.id_product_attribute as id, a.id_product, a.reference, a.ean13,
|
||||||
|
IFNULL(CONCAT(pl.name, \' : \', GROUP_CONCAT(agl.`name`, \' - \', al.name SEPARATOR \', \')),pl.name) as name,
|
||||||
|
IFNULL(s.physical_quantity, 0) as physical_quantity,
|
||||||
|
IFNULL(s.usable_quantity, 0) as usable_quantity,
|
||||||
|
s.price_te
|
||||||
|
FROM '._DB_PREFIX_.'product_attribute a
|
||||||
|
INNER JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = a.id_product AND pl.id_lang = '.$lang_id.')
|
||||||
|
LEFT JOIN '._DB_PREFIX_.'product_attribute_combination pac ON (pac.id_product_attribute = a.id_product_attribute)
|
||||||
|
LEFT JOIN '._DB_PREFIX_.'attribute atr ON (atr.id_attribute = pac.id_attribute)
|
||||||
|
LEFT JOIN '._DB_PREFIX_.'attribute_lang al ON (al.id_attribute = atr.id_attribute AND al.id_lang = '.$lang_id.')
|
||||||
|
LEFT JOIN '._DB_PREFIX_.'attribute_group_lang agl ON (agl.id_attribute_group = atr.id_attribute_group AND agl.id_lang = '.$lang_id.')
|
||||||
|
INNER JOIN '._DB_PREFIX_.'stock s ON (a.id_product_attribute = s.id_product_attribute)
|
||||||
|
WHERE a.id_product = '.$id_product.
|
||||||
|
($warehouse != -1 ? ' AND s.id_warehouse = '.(int)$warehouse : ' ').'
|
||||||
|
GROUP BY a.id_product_attribute';
|
||||||
|
|
||||||
|
// gets stock manager
|
||||||
|
$manager = StockManagerFactory::getManager();
|
||||||
|
|
||||||
|
// queries
|
||||||
|
$datas = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
|
||||||
|
foreach ($datas as &$data) // retrieves real quantity for each product
|
||||||
|
{
|
||||||
|
$data['real_quantity'] = $manager->getProductRealQuantities($data['id_product'],
|
||||||
|
$data['id'],
|
||||||
|
($warehouse == -1 ? null : array($warehouse)), // all or selected warehouse(s)
|
||||||
|
true);
|
||||||
|
}
|
||||||
|
echo Tools::jsonEncode(array('data'=> $datas, 'fields_display' => $this->fieldsDisplay));
|
||||||
|
}
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AdminController::initList() override
|
* AdminController::initList() override
|
||||||
* @see AdminController::initList()
|
* @see AdminController::initList()
|
||||||
*/
|
*/
|
||||||
public function initList()
|
public function initList()
|
||||||
{
|
{
|
||||||
$this->displayInformation($this->l('This interface allows you to display detailed informations on your stock, per warehouse.').'<br />');
|
// query
|
||||||
|
$this->_select = '
|
||||||
|
a.id_product as id,
|
||||||
|
COUNT(pa.id_product_attribute) as variations,
|
||||||
|
s.physical_quantity as physical_quantity,
|
||||||
|
s.usable_quantity as usable_quantity,
|
||||||
|
s.price_te as price_te';
|
||||||
|
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (pa.id_product = a.id_product)
|
||||||
|
INNER JOIN `'._DB_PREFIX_.'stock` s ON (s.id_product = a.id_product)';
|
||||||
|
if ($this->getCurrentCoverageWarehouse() != -1)
|
||||||
|
$this->_where .= ' AND s.id_warehouse = '.$this->getCurrentCoverageWarehouse();
|
||||||
|
|
||||||
|
// toolbar btn
|
||||||
$this->toolbar_btn = array();
|
$this->toolbar_btn = array();
|
||||||
|
// disables link
|
||||||
$this->addRowAction('details');
|
|
||||||
|
|
||||||
// disables link on list rows
|
|
||||||
$this->list_no_link = true;
|
$this->list_no_link = true;
|
||||||
|
// adds action
|
||||||
|
$this->addRowAction('details');
|
||||||
|
// smarty
|
||||||
|
$this->tpl_list_vars['stock_instant_state_warehouses'] = $this->stock_instant_state_warehouses;
|
||||||
|
$this->tpl_list_vars['stock_instant_state_cur_warehouse'] = $this->getCurrentCoverageWarehouse();
|
||||||
|
// adds ajax params
|
||||||
|
$this->ajax_params = array('warehouse' => $this->getCurrentCoverageWarehouse());
|
||||||
|
|
||||||
$this->tpl_list_vars['list_warehouses'] = Warehouse::getWarehouseList(true);
|
// displays help information
|
||||||
$this->tpl_list_vars['current_warehouse'] = $this->getCurrentWarehouseId();
|
$this->displayInformation($this->l('This interface allows you to display detailed informations on your stock, per warehouse.'));
|
||||||
|
|
||||||
return parent::initList();
|
return parent::initList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Method call when ajax request is made with the details row action
|
|
||||||
* @see AdminController::postProcess()
|
|
||||||
*/
|
|
||||||
public function ajaxProcess()
|
|
||||||
{
|
|
||||||
// gets current lang id
|
|
||||||
$lang_id = (int)$this->context->language->id;
|
|
||||||
|
|
||||||
$query = '
|
|
||||||
SELECT physical_quantity, usable_quantity, s.price_te
|
|
||||||
FROM '._DB_PREFIX_.'stock s
|
|
||||||
INNER JOIN '._DB_PREFIX_.'product p
|
|
||||||
ON (p.id_product = s.id_product)
|
|
||||||
INNER JOIN '._DB_PREFIX_.'product_lang pl
|
|
||||||
ON (pl.id_product = p.id_product AND pl.id_lang = '.$lang_id.')
|
|
||||||
LEFT JOIN '._DB_PREFIX_.'product_attribute_combination pac
|
|
||||||
ON (pac.id_product_attribute = s.id_product_attribute)
|
|
||||||
LEFT JOIN '._DB_PREFIX_.'attribute a
|
|
||||||
ON (a.id_attribute = pac.id_attribute)
|
|
||||||
LEFT JOIN '._DB_PREFIX_.'attribute_lang al
|
|
||||||
ON (al.id_attribute = a.id_attribute AND al.id_lang = '.$lang_id.')
|
|
||||||
LEFT JOIN '._DB_PREFIX_.'attribute_group_lang agl
|
|
||||||
ON (agl.id_attribute_group = a.id_attribute_group AND agl.id_lang = '.$lang_id.')
|
|
||||||
WHERE s.id_product = (SELECT id_product FROM '._DB_PREFIX_.'stock WHERE id_stock = '.(int)Tools::getValue('id').')
|
|
||||||
AND s.id_product_attribute = (SELECT id_product_attribute FROM '._DB_PREFIX_.'stock WHERE id_stock = '.(int)Tools::getValue('id').')
|
|
||||||
AND s.id_warehouse = (SELECT id_warehouse FROM '._DB_PREFIX_.'stock WHERE id_stock = '.(int)Tools::getValue('id').')
|
|
||||||
GROUP BY id_stock';
|
|
||||||
|
|
||||||
$data = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
|
|
||||||
|
|
||||||
foreach ($data as &$row)
|
|
||||||
$row['price_te'] = Tools::displayPrice($row['price_te'], $this->getCurrency());
|
|
||||||
|
|
||||||
echo Tools::jsonEncode(array(
|
|
||||||
'data'=> $data,
|
|
||||||
'fields_display' => $this->fieldsDisplay,
|
|
||||||
));
|
|
||||||
|
|
||||||
die();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getCurrentWarehouseId()
|
|
||||||
{
|
|
||||||
static $warehouse = 0;
|
|
||||||
if ($warehouse == 0)
|
|
||||||
{
|
|
||||||
$warehouse = 1;
|
|
||||||
if ((int)Tools::getValue('warehouse'))
|
|
||||||
$warehouse = (int)Tools::getValue('warehouse');
|
|
||||||
else if ((int)$this->context->cookie->warehouse && (int)$this->context->cookie->warehouse != -1)
|
|
||||||
$warehouse = (int)$this->context->cookie->warehouse;
|
|
||||||
$this->context->cookie->warehouse = $warehouse;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $warehouse;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getCurrency()
|
|
||||||
{
|
|
||||||
static $currency = null;
|
|
||||||
if (is_null($currency))
|
|
||||||
{
|
|
||||||
$warehouse = new Warehouse($this->getCurrentWarehouseId());
|
|
||||||
$currency = new Currency($warehouse->id_currency);
|
|
||||||
}
|
|
||||||
return $currency;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AdminController::getList() override
|
* AdminController::getList() override
|
||||||
* @see AdminController::getList()
|
* @see AdminController::getList()
|
||||||
*/
|
*/
|
||||||
public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
|
public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
|
||||||
{
|
{
|
||||||
$id_lang = (int)$id_lang;
|
parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
|
||||||
|
|
||||||
// Manage default params values
|
$nb_items = count($this->_list);
|
||||||
if (empty($limit))
|
for ($i = 0; $i < $nb_items; ++$i)
|
||||||
{
|
{
|
||||||
if (!isset($this->context->cookie->{$this->table.'_pagination'}))
|
$item = &$this->_list[$i];
|
||||||
$limit = $this->_pagination[1];
|
if ((int)$item['variations'] <= 0) // if this product does not have combinations
|
||||||
else
|
{
|
||||||
$limit = $this->context->cookie->{$this->table.'_pagination'};
|
// removes 'details' action on products without attributes
|
||||||
}
|
$this->addRowActionSkipList('details', array($item['id']));
|
||||||
|
|
||||||
$limit = (int)Tools::getValue('pagination', $limit);
|
// gets stock manager
|
||||||
$this->context->cookie->{$this->table.'_pagination'} = $limit;
|
$manager = StockManagerFactory::getManager();
|
||||||
|
|
||||||
if (!Validate::isTableOrIdentifier($this->table))
|
// gets real_quantity depending on the warehouse
|
||||||
die (Tools::displayError('Table name is invalid:').' "'.$this->table.'"');
|
$item['real_quantity'] = $manager->getProductRealQuantities($item['id'],
|
||||||
|
0,
|
||||||
if (empty($order_by))
|
($this->getCurrentCoverageWarehouse() == -1 ? null : array($this->getCurrentCoverageWarehouse())),
|
||||||
$order_by = $this->context->cookie->__get($this->table.'Orderby') ? $this->context->cookie->__get($this->table.'Orderby') : $this->_default_order_by;
|
true);
|
||||||
|
}
|
||||||
if (empty($order_way))
|
else // else, this product does have combinations, hence we do not display informations
|
||||||
$order_way = $this->context->cookie->__get($this->table.'Orderway') ? $this->context->cookie->__get($this->table.'Orderway') : 'ASC';
|
{
|
||||||
|
$item['price_te'] = '--';
|
||||||
$query = 'SELECT SQL_CALC_FOUND_ROWS
|
$item['physical_quantity'] = '--';
|
||||||
id_stock,
|
$item['usable_quantity'] = '--';
|
||||||
id_product,
|
$item['real_quantity'] = '--';
|
||||||
id_product_attribute,
|
}
|
||||||
designation,
|
|
||||||
IF((count(id_stock)=1), s.price_te, \'--\') as price_te,
|
|
||||||
SUM(physical_quantity) physical_quantity,
|
|
||||||
SUM(usable_quantity) usable_quantity,
|
|
||||||
ean13,
|
|
||||||
reference,
|
|
||||||
IF((count(id_stock)=1), 0, 1) as need_details
|
|
||||||
FROM (SELECT
|
|
||||||
IFNULL(CONCAT(pl.name, \' : \', GROUP_CONCAT(agl.`name`, \' - \', al.name SEPARATOR \', \')), pl.name) as designation,
|
|
||||||
id_stock, p.id_product, s.id_product_attribute, ean13, p.reference,
|
|
||||||
s.price_te,
|
|
||||||
physical_quantity,
|
|
||||||
usable_quantity
|
|
||||||
FROM '._DB_PREFIX_.'stock s
|
|
||||||
INNER JOIN '._DB_PREFIX_.'product p
|
|
||||||
ON (p.id_product = s.id_product)
|
|
||||||
INNER JOIN '._DB_PREFIX_.'product_lang pl
|
|
||||||
ON (pl.id_product = p.id_product AND pl.id_lang = '.$id_lang.')
|
|
||||||
LEFT JOIN '._DB_PREFIX_.'product_attribute_combination pac
|
|
||||||
ON (pac.id_product_attribute = s.id_product_attribute)
|
|
||||||
LEFT JOIN '._DB_PREFIX_.'attribute a
|
|
||||||
ON (a.id_attribute = pac.id_attribute)
|
|
||||||
LEFT JOIN '._DB_PREFIX_.'attribute_lang al
|
|
||||||
ON (al.id_attribute = a.id_attribute AND al.id_lang = '.$id_lang.')
|
|
||||||
LEFT JOIN '._DB_PREFIX_.'attribute_group_lang agl
|
|
||||||
ON (agl.id_attribute_group = a.id_attribute_group AND agl.id_lang = '.$id_lang.')
|
|
||||||
WHERE id_warehouse = '.$this->getCurrentWarehouseId().' '.(isset($this->_where) ? $this->_where.' ' : '').
|
|
||||||
($this->deleted ? 'AND a.`deleted` = 0 ' : '').
|
|
||||||
(isset($this->_filter) ? $this->_filter : '').'
|
|
||||||
GROUP BY id_stock
|
|
||||||
'.((isset($this->_filterHaving) || isset($this->_having)) ? 'HAVING ' : '').
|
|
||||||
(isset($this->_filterHaving) ? ltrim($this->_filterHaving, ' AND ') : '').
|
|
||||||
(isset($this->_having) ? $this->_having.' ' : '').'
|
|
||||||
) s
|
|
||||||
GROUP BY id_product_attribute, id_product
|
|
||||||
ORDER BY `'.pSQL($order_by).'` '.pSQL($order_way).'
|
|
||||||
LIMIT '.(int)$start.','.(int)$limit;
|
|
||||||
|
|
||||||
$this->_list = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
|
|
||||||
$this->_listTotal = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT FOUND_ROWS()');
|
|
||||||
|
|
||||||
$manager = StockManagerFactory::getManager();
|
|
||||||
|
|
||||||
foreach ($this->_list as &$row)
|
|
||||||
{
|
|
||||||
if (is_numeric($row['price_te']))
|
|
||||||
$row['price_te'] = Tools::displayPrice($row['price_te'], $this->getCurrency());
|
|
||||||
if (!$row['need_details'])
|
|
||||||
$this->addRowActionSkipList('details', $row['id_stock']);
|
|
||||||
$row['real_quantity'] = $manager->getProductRealQuantities(
|
|
||||||
$row['id_product'],
|
|
||||||
$row['id_product_attribute'],
|
|
||||||
array($this->getCurrentWarehouseId()),
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the current warehouse used
|
||||||
|
*
|
||||||
|
* @return int id_warehouse
|
||||||
|
*/
|
||||||
|
private function getCurrentCoverageWarehouse()
|
||||||
|
{
|
||||||
|
static $warehouse = 0;
|
||||||
|
|
||||||
|
if ($warehouse == 0)
|
||||||
|
{
|
||||||
|
$warehouse = -1; // all warehouses
|
||||||
|
if ((int)Tools::getValue('instant_state_warehouse'))
|
||||||
|
$warehouse = (int)Tools::getValue('instant_state_warehouse');
|
||||||
|
}
|
||||||
|
return $warehouse;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user