Fix wrong args
Source Link

Don't save the product, but only the attribute. This can be done like:

$product->getResource()->saveAttribute('sub_prod_qty'$product, $product'sub_prod_qty');

At the end of the loop unset the variables you are using. The GC should deal with them.

You can even avoid loading the product and you can even avoid loading the child products if you use SQL to sum up their qty and then fetch only the result.

Don't save the product, but only the attribute. This can be done like:

$product->getResource()->saveAttribute('sub_prod_qty', $product);

At the end of the loop unset the variables you are using. The GC should deal with them.

You can even avoid loading the product and you can even avoid loading the child products if you use SQL to sum up their qty and then fetch only the result.

Don't save the product, but only the attribute. This can be done like:

$product->getResource()->saveAttribute($product, 'sub_prod_qty');

At the end of the loop unset the variables you are using. The GC should deal with them.

You can even avoid loading the product and you can even avoid loading the child products if you use SQL to sum up their qty and then fetch only the result.

Source Link

Don't save the product, but only the attribute. This can be done like:

$product->getResource()->saveAttribute('sub_prod_qty', $product);

At the end of the loop unset the variables you are using. The GC should deal with them.

You can even avoid loading the product and you can even avoid loading the child products if you use SQL to sum up their qty and then fetch only the result.