diff --git a/app/Traits/Import.php b/app/Traits/Import.php index da1719998..e04b113ec 100644 --- a/app/Traits/Import.php +++ b/app/Traits/Import.php @@ -323,8 +323,10 @@ trait Import return $contact->id; } - public function getItemIdFromName($row, $type = 'product') + public function getItemIdFromName($row, $type = null) { + $type = !empty($type) ? $type : (!empty($row['item_type']) ? $row['item_type'] : 'product'); + $item_id = Item::type($type)->where('name', $row['item_name'])->pluck('id')->first(); if (!empty($item_id)) {