Hi! under controllers > admin, in products.php, add_adjustment function, i’d like to add PRODUCT NAME in the alert message in subtraction when i add a new quantity adjustment… can you give me a tip?? Thank you
- MSAnswered
Hello,
I didn’t understand what are you trying to achieve 😦 May be a screenshot could help.
- SAnswered
Hi thank you for your reply.
When i’m saving a new quantity adjustment, if some item is over the quantity available in the warehouse, appears an alert message in the top of the page. I’d like to have the item name in this message.
Ty in advance
- MSAnswered
Hello,
The alert count is for all warehouses. If you need to check for a single warehouse, you will need to select the warehouse on the alert page.
Thank you
- SAnswered
Thank you again for your reply.
First af all sorry for my bad english.
i try to be more clear with my request: in APP/CONTROLLERS/ADMIN/PRODUCTS.PHP
in this code:
if (!$this->Settings->overselling && $type == 'subtraction' && !$count_id) { if ($variant) { if($op_wh_qty = $this->products_model->getProductWarehouseOptionQty($variant, $warehouse_id)) { if ($op_wh_qty->quantity < $quantity) { $this->session->set_flashdata('error', lang('warehouse_option_qty_is_less_than_damage')); redirect($_SERVER["HTTP_REFERER"]); } } else { $this->session->set_flashdata('error', lang('warehouse_option_qty_is_less_than_damage')); redirect($_SERVER["HTTP_REFERER"]); } } if($wh_qty = $this->products_model->getProductQuantity($product_id, $warehouse_id)) { if ($wh_qty['quantity'] < $quantity) { $this->session->set_flashdata('error', lang('warehouse_qty_is_less_than_damage')); redirect($_SERVER["HTTP_REFERER"]); } } else { $this->session->set_flashdata('error', lang('warehouse_qty_is_less_than_damage')); redirect($_SERVER["HTTP_REFERER"]); } }
i’d like to add the ITEM NAME in the warehouse_qty_is_less_than_damage alert… how i can reach the ITEM NAME to add to the message?
thank you in advance
Attachments - MSAnswered
Hello,
Are you saying that you want to add product name in error message? If yes then you will need to get the product as
$product = $this->site->getProductByID($product_id);
Once you have products then you can display name as
$this->session->set_flashdata('error', $product->name . ' - ' . lang('warehouse_qty_is_less_than_damage'));
For more fine controlled message, you will need to use %s in the translation string and then sprintf() to add product name.
Please be informed that we don’t offer support for modifications or modified versions. You are allowed to modify the item code at your own risk as per license.
Thank you
- SAnswered
Thank you!
Maybe there is some syntax error in your suggestion… I change as your tip but now page not load…
$product_id = $_POST[‘product_id’][$r]; $productx = $this->site->getProductByID($product_id); $type = $_POST[‘type’][$r]; $quantity = $_POST[‘quantity’][$r]; $serial = $_POST[‘serial’][$r]; $variant = isset($_POST[‘variant’][$r]) && !empty($_POST[‘variant’][$r]) ? $_POST[‘variant’][$r] : NULL;
if (!$this->Settings->overselling && $type == 'subtraction' && !$count_id) { if ($variant) { if($op_wh_qty = $this->products_model->getProductWarehouseOptionQty($variant, $warehouse_id)) { if ($op_wh_qty->quantity < $quantity) { $this->session->set_flashdata('error', lang('warehouse_option_qty_is_less_than_damage').' - '.$productx->name); redirect($_SERVER["HTTP_REFERER"]); } } else { $this->session->set_flashdata('error', lang('warehouse_option_qty_is_less_than_damage').' - '.$productx->name); redirect($_SERVER["HTTP_REFERER"]); } } if($wh_qty = $this->products_model->getProductQuantity($product_id, $warehouse_id)) { if ($wh_qty['quantity'] < $quantity) { $this->session->set_flashdata('error', lang('warehouse_qty_is_less_than_damage').' - '.$productx->name); redirect($_SERVER["HTTP_REFERER"]); } } else { $this->session->set_flashdata('error', lang('warehouse_qty_is_less_than_damage').' - '.$productx->name); redirect($_SERVER["HTTP_REFERER"]); } }
Thank you again!
- SAnswered
My Fault… It works! Thank you so much
- Login to Reply