Rail Balco Posted October 11, 2017 Share Posted October 11, 2017 Hi! I want to add column to stock management table, that will show address in warehouse, so warehouse operator know where to go for this product. Do you have any idea how to do that? I did not find any tpl file that handles rendering of this table. Link to comment Share on other sites More sharing options...
Koen Amant Posted March 4, 2018 Share Posted March 4, 2018 Hi Copy controllers/admin/AdminStockManagementController.php to override/controllers/admin/ Change what is below in the file. public function __construct() { $this->bootstrap = true; $this->context = Context::getContext(); $this->table = 'product'; $this->list_id = 'product'; $this->className = 'Product'; $this->lang = true; $this->multishop_context = Shop::CONTEXT_ALL; $this->fields_list = array(); $this->fields_list['id_product'] = array( 'title' => $this->l('ID'), 'align' => 'center', 'class' => 'fixed-width-xs', 'type' => 'int' ); $this->fields_list['image'] = array( 'title' => $this->l('Image'), 'align' => 'center', 'image' => 'p', 'orderby' => false, 'filter' => false, 'search' => false ); $this->fields_list['name'] = array( 'title' => $this->l('Name'), 'filter_key' => 'b!name' ); $this->fields_list['manufacturer'] = array( 'title' => $this->l('Manufacturer'), 'align' => 'left', ); $this->fields_list['reference'] = array( 'title' => $this->l('Product reference'), 'filter_key' => 'a!reference' ); $this->fields_list['ean13'] = array( 'title' => $this->l('EAN-13 barcode'), 'filter_key' => 'a!ean13' ); $this->fields_list['physical_quantity'] = array( 'title' => $this->l('Physical quantity'), 'class' => 'fixed-width-xs', 'align' => 'center', 'orderby' => true, 'search' => false ); $this->fields_list['usable_quantity'] = array( 'title' => $this->l('Usable quantity'), 'class' => 'fixed-width-xs', 'align' => 'center', 'orderby' => true, 'search' => false, ); /** * AdminController::renderList() override * @see AdminController::renderList() */ public function renderList() { $id_product = (int)Tools::getValue('id_product'); if (!empty($id_product)) { $id_product_attribute = (int)Tools::getValue('id_product_attribute'); $this->previousManagementStock($id_product, $id_product_attribute); } else { // sets actions $this->addRowAction('details'); $this->addRowAction('addstock'); $this->addRowAction('prepareRemovestock'); if (count(Warehouse::getWarehouses(true)) > 1) { $this->addRowAction('prepareTransferstock'); } // no link on list rows $this->list_no_link = true; // inits toolbar $this->toolbar_btn = array(); $alias = 'sa'; $alias_image = 'image_shop'; // overrides query $this->_select = 'a.ean13 as ean13, a.upc as upc, a.reference as reference, (SELECT SUM(physical_quantity) FROM `'._DB_PREFIX_.'stock` WHERE id_product = a.id_product) as physical_quantity, (SELECT SUM(usable_quantity) FROM `'._DB_PREFIX_.'stock` WHERE id_product = a.id_product) as usable_quantity, a.id_product as id, COUNT(pa.id_product_attribute) as variations'; $this->_select .=', '.$alias_image.'.`id_image` AS `id_image`, ma.name AS manufacturer'; $id_shop = Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP? (int)$this->context->shop->id : 'a.id_shop_default'; $this->_join = 'LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (pa.id_product = a.id_product)'.Shop::addSqlAssociation('product_attribute', 'pa', false); $this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'image_shop` image_shop ON (image_shop.`id_product` = a.`id_product` AND image_shop.`cover` = 1 AND image_shop.id_shop = '.$id_shop.') LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_image` = image_shop.`id_image`) JOIN `'._DB_PREFIX_.'manufacturer` ma ON (a.id_manufacturer = ma.id_manufacturer)'; $this->_where = 'AND a.is_virtual = 0 AND a.advanced_stock_management = 1 '; $this->_group = 'GROUP BY a.id_product'; // displays informations $this->displayInformation($this->l('This interface allows you to manage product stock and their variations.').'<br />'); $this->displayInformation($this->l('Through this interface, you can increase and decrease product stock for an given warehouse.')); $this->displayInformation($this->l('Furthermore, you can move product quantities between warehouses, or within one warehouse.').'<br />'); $this->displayInformation($this->l('If you want to increase quantities of multiple products at once, you can use the "Supply orders" page under the "Stock" menu.').'<br />'); $this->displayInformation($this->l('Finally, you need to provide the quantity that you\'ll be adding: "Usable for sale" means that this quantity will be available in your shop(s), otherwise it will be considered reserved (i.e. for other purposes).')); } return parent::renderList(); } Link to comment Share on other sites More sharing options...
Estian Posted August 11, 2020 Share Posted August 11, 2020 On 3/4/2018 at 6:42 PM, Koen Amant said: Hi Copy controllers/admin/AdminStockManagementController.php to override/controllers/admin/ Change what is below in the file. public function __construct() { $this->bootstrap = true; $this->context = Context::getContext(); $this->table = 'product'; $this->list_id = 'product'; $this->className = 'Product'; $this->lang = true; $this->multishop_context = Shop::CONTEXT_ALL; $this->fields_list = array(); $this->fields_list['id_product'] = array( 'title' => $this->l('ID'), 'align' => 'center', 'class' => 'fixed-width-xs', 'type' => 'int' ); $this->fields_list['image'] = array( 'title' => $this->l('Image'), 'align' => 'center', 'image' => 'p', 'orderby' => false, 'filter' => false, 'search' => false ); $this->fields_list['name'] = array( 'title' => $this->l('Name'), 'filter_key' => 'b!name' ); $this->fields_list['manufacturer'] = array( 'title' => $this->l('Manufacturer'), 'align' => 'left', ); $this->fields_list['reference'] = array( 'title' => $this->l('Product reference'), 'filter_key' => 'a!reference' ); $this->fields_list['ean13'] = array( 'title' => $this->l('EAN-13 barcode'), 'filter_key' => 'a!ean13' ); $this->fields_list['physical_quantity'] = array( 'title' => $this->l('Physical quantity'), 'class' => 'fixed-width-xs', 'align' => 'center', 'orderby' => true, 'search' => false ); $this->fields_list['usable_quantity'] = array( 'title' => $this->l('Usable quantity'), 'class' => 'fixed-width-xs', 'align' => 'center', 'orderby' => true, 'search' => false, ); /** * AdminController::renderList() override * @see AdminController::renderList() */ public function renderList() { $id_product = (int)Tools::getValue('id_product'); if (!empty($id_product)) { $id_product_attribute = (int)Tools::getValue('id_product_attribute'); $this->previousManagementStock($id_product, $id_product_attribute); } else { // sets actions $this->addRowAction('details'); $this->addRowAction('addstock'); $this->addRowAction('prepareRemovestock'); if (count(Warehouse::getWarehouses(true)) > 1) { $this->addRowAction('prepareTransferstock'); } // no link on list rows $this->list_no_link = true; // inits toolbar $this->toolbar_btn = array(); $alias = 'sa'; $alias_image = 'image_shop'; // overrides query $this->_select = 'a.ean13 as ean13, a.upc as upc, a.reference as reference, (SELECT SUM(physical_quantity) FROM `'._DB_PREFIX_.'stock` WHERE id_product = a.id_product) as physical_quantity, (SELECT SUM(usable_quantity) FROM `'._DB_PREFIX_.'stock` WHERE id_product = a.id_product) as usable_quantity, a.id_product as id, COUNT(pa.id_product_attribute) as variations'; $this->_select .=', '.$alias_image.'.`id_image` AS `id_image`, ma.name AS manufacturer'; $id_shop = Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP? (int)$this->context->shop->id : 'a.id_shop_default'; $this->_join = 'LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (pa.id_product = a.id_product)'.Shop::addSqlAssociation('product_attribute', 'pa', false); $this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'image_shop` image_shop ON (image_shop.`id_product` = a.`id_product` AND image_shop.`cover` = 1 AND image_shop.id_shop = '.$id_shop.') LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_image` = image_shop.`id_image`) JOIN `'._DB_PREFIX_.'manufacturer` ma ON (a.id_manufacturer = ma.id_manufacturer)'; $this->_where = 'AND a.is_virtual = 0 AND a.advanced_stock_management = 1 '; $this->_group = 'GROUP BY a.id_product'; // displays informations $this->displayInformation($this->l('This interface allows you to manage product stock and their variations.').'<br />'); $this->displayInformation($this->l('Through this interface, you can increase and decrease product stock for an given warehouse.')); $this->displayInformation($this->l('Furthermore, you can move product quantities between warehouses, or within one warehouse.').'<br />'); $this->displayInformation($this->l('If you want to increase quantities of multiple products at once, you can use the "Supply orders" page under the "Stock" menu.').'<br />'); $this->displayInformation($this->l('Finally, you need to provide the quantity that you\'ll be adding: "Usable for sale" means that this quantity will be available in your shop(s), otherwise it will be considered reserved (i.e. for other purposes).')); } return parent::renderList(); } This file doesn't appear to exist in 1.7.6.5. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now