It seems that $this->cart->total_items()
returns something different from the total items in the $item
and $qty
arrays. Later on, you are using this result to iterate these arrays, and the loop variable ($i
) exceeds the arrays' boundaries.
Change your loop to:
for($i=0;$i < count($item);$i++)
You can choose count($qty)
if you prefer, provided that the two arrays contain the same number of elements (which has to be true anyway, in order for the whole algorithm to work).