Skip to content

Can't get pull operations quite right #2070

Discussion options

You must be logged in to vote

I was able to fix it by adding the variable name to it and also because i am removing an index, going in reverse like so:

                  for ($i=count($userCartBis['items']) - 1; $i >= 0; $i--) { 
			
			//for now remove each element from the cart and put it in the orders section, if it's active
			if ($userCartBis['items'][$i]['status'] == 'active') {
				//this one we can process
				
				//add it to the orders table
				$updateOrder = $order
				->push(
					'products',
					[
						'location' 	=> $userCartBis['items'][$i]['location'],
						'quantity' 	=> $userCartBis['items'][$i]['quantity'],
						'price' 	=> $userCartBis['items'][$i]['price'],
						'product' 	=> $userCartBis['i…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by divine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2070 on September 02, 2020 05:32.