I have two objects, the first one:
prods = [
        {
            'id':1,
            'category_ID' : 26,
            'name':'prod1',
            'descripcion' : 'sadasdsad',
        },
        {
            'id':2,
            'category_ID' : 26,
            'name':'prod2',
            'descripcion' : '21312d',
        },
        {
            'id':3,
            'category_ID' : 6,
            'name':'prod3',
            'descripcion' : 'ergrd',
        },
        {
            'id':4,
            'category_ID' : 12,
            'name':'prod4',
            'descripcion' : 'wwwwwwww',
        }
    ]
And the second one, with its elements ordered randomly
orders = [
        {
            'id':2,
            'category_ID' : 26,
            'name':'producto2',
            'descripcion' : '21312d',
            'units': 1,
            'isSelected' : 1
        },
        {
            'id':4,
            'category_ID' : 12,
            'name':'producto4',
            'descripcion' : 'wwwwwwww',
            'units': 21,
            'isSelected' : 1
        },
        {
            'id':1,
            'category_ID' : 26,
            'name':'producto1',
            'descripcion' : 'sadasdsad',
            'units': 34,
            'isSelected' : 1
        }
    ]
I'm trying to update the elements of the first object with the ones of the second matching id's and adding new propierties, so the result would be
prods = [
        {
            'id':1,
            'category_ID' : 26,
            'name':'prod1',
            'descripcion' : 'sadasdsad',
            'units': 34,
            'isSelected' : 1
        },
        {
            'id':2,
            'category_ID' : 26,
            'name':'prod2',
            'descripcion' : '21312d',
            'units': 1,
            'isSelected' : 1
        },
        {
            'id':3,
            'category_ID' : 6,
            'name':'prod3',
            'descripcion' : 'ergrd',
        },
        {
            'id':4,
            'category_ID' : 12,
            'name':'prod4',
            'descripcion' : 'wwwwwwww',
            'units': 21,
            'isSelected' : 1
        }
    ]
I'm getting dizzy in a sea of loops... with no result... any clues?
 
     
    