diff --git a/Plugin/Backend/Block/Widget/Grid/Massaction/Extended.php b/Plugin/Backend/Block/Widget/Grid/Massaction/Extended.php new file mode 100644 index 0000000..63a98d2 --- /dev/null +++ b/Plugin/Backend/Block/Widget/Grid/Massaction/Extended.php @@ -0,0 +1,23 @@ + mixed) $a + * @return array(string, array(string => mixed)) + */ + function beforeAddItem(Sb $sb, $id, array $a) { + if ('save' === $id && df_contains(dfa($a, 'url'), 'stockmanage/product/massUpdateProducts')) { + $a['fields'] = array_merge($a['fields'], ['cost', 'price']); + } + return [$id, $a]; + } +} \ No newline at end of file diff --git a/Plugin/Iksanika/Stockmanage/Block/Adminhtml/Product/Grid.php b/Plugin/Iksanika/Stockmanage/Block/Adminhtml/Product/Grid.php index 73cf132..e63d35b 100644 --- a/Plugin/Iksanika/Stockmanage/Block/Adminhtml/Product/Grid.php +++ b/Plugin/Iksanika/Stockmanage/Block/Adminhtml/Product/Grid.php @@ -1,6 +1,7 @@ string) $pd */ + $pd = ['class' => 'input-text admin__control-text', 'renderer' => Number::class]; + $data = $pd + $data; + $f('cost', $pd + [ 'column_css_class' => 'col-price' ,'currency_code' => df_currency_base_c(df_request('store', 0)) ,'header' => 'Cost' diff --git a/Plugin/Iksanika/Stockmanage/Controller/Adminhtml/Product/MassUpdateProducts.php b/Plugin/Iksanika/Stockmanage/Controller/Adminhtml/Product/MassUpdateProducts.php new file mode 100644 index 0000000..424adaf --- /dev/null +++ b/Plugin/Iksanika/Stockmanage/Controller/Adminhtml/Product/MassUpdateProducts.php @@ -0,0 +1,21 @@ + $id) { /** @var int $i */ /** @var int $id */ + $p = df_product_r()->getById($id, true, $storeId); /** @var P $p */ + $p->addData(['cost' => $cost[$i], 'price' => $price[$i]])->save(); + } + } +} \ No newline at end of file diff --git a/composer.json b/composer.json index 609e1ee..500c2be 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "p-pcs/core" - ,"version": "0.1.1" + ,"version": "0.1.2" ,"description": "A custom module for performance-pcs.com (Magento 2)" ,"type": "magento2-module" ,"homepage": "https://github.com/p-pcs/core" diff --git a/etc/adminhtml/di.xml b/etc/adminhtml/di.xml index e83149c..1d8fd8e 100644 --- a/etc/adminhtml/di.xml +++ b/etc/adminhtml/di.xml @@ -9,11 +9,31 @@ https://github.com/p-pcs/core/issues/12 2) "Remove the «Visibility» column from the Iksanika's Stock Inventory Manager's grid": https://github.com/p-pcs/core/issues/13 3) "Remove the «Type» column from the Iksanika's Stock Inventory Manager's grid": -https://github.com/p-pcs/core/issues/14 --> +https://github.com/p-pcs/core/issues/14 +4) "Make the «Cost» and «Price» columns of the the Iksanika's Stock Inventory Manager's grid editable": +https://github.com/p-pcs/core/issues/17 --> + + + + + + + + \ No newline at end of file