resolving the inventory upon activation

local types = require('openmw.types')
local I = require('openmw.interfaces')
local world = require('openmw.world')
local async = require('openmw.async')

   I.Activation.addHandlerForType( types.Container, -- or addHandlerForObject if you need it only for one specific container
    async:callback(function(container, actor)  

        if types.Container.records[container].id == "com_basket_01_ingredien" then

          types.Container.content(container):resolve()

          local items = types.Container.content( container ):getAll(types.Ingredient)
    
            for a, _ in pairs(items) do
              print(items[a].id)
              items[a]:moveInto( actor )  
            end
            
          container:remove() -- removes the container from game
          
          return false -- disable standard activation
    end
  end))

for harvesting every plant in current cell upon activation

basically this part

															      -- this needs id
      local plants = world.getCellById(actor.cell.id):getAll(types.Container)      
        for a, _ in pairs(plants) do
                    
                    -- plants        
          if types.Container.record(plants[a].recordId).isOrganic == true then 
          
              -- IMPORTANT: to get leveled items
          types.Container.content(plants[a]):resolve() 
          
                       -- what type to get, can be conditioned for item
          local items = types.Container.content( plants[a] ):getAll(types.Ingredient)
    
            for c, _ in pairs(items) do -- loop over type
                          
              print( "from", plants[a].recordId, items[c].count, "of", items[c].recordId)
              items[c]:moveInto( actor )  -- move to inventory
            end
            

full script

local types = require('openmw.types')
local I = require('openmw.interfaces')
local world = require('openmw.world')
local core = require('openmw.core')

   I.Activation.addHandlerForType( types.Container, 
    async:callback(function(container, actor)  

     --if types.Container.records[container].id == "com_basket_01_ingredien" then
        
      local plants = world.getCellById(actor.cell.id):getAll(types.Container)      
        for a, _ in pairs(plants) do
        
          if types.Container.record(plants[a].recordId).isOrganic == true then 
         
          types.Container.content(plants[a]):resolve()
          
          local items = types.Container.content( plants[a] ):getAll(types.Ingredient)
    
            for c, _ in pairs(items) do
              print( "from", plants[a].recordId, items[c].count, "of", items[c].recordId)
              items[c]:moveInto( actor )  
            end
          --container:remove()
          end
        end
        return false
    --end
  end))