Topic: problem - Shopping Cart tutorial, video 7
i'm working my way thru the shopping cart tutorial...in video 7, 12:13 minutes in...i've just completed the code for $quantity:
<?php
$product_id = $_REQUEST['id'];
if (product_exists($product_id)) {
$shopping_cart->AddItem($product_id);
}
?>
<table class="shoppingCart">
<tr>
<th>Product ID</th>
<th>Quantity</th>
<th>Amount</th>
</tr>
<?php
$line_item_counter = 1;
foreach($shopping_cart->GetItems() as $product_id) {
echo render_shopping_cart_row($shopping_cart, $product_id, $line_item_counter);
$line_item_counter++;
}
function render_shopping_cart_row(ShoppingCart $shopping_cart, $product_id, $line_item_counter) {
$quantity = $shopping_cart->GetItemQuantity($product_id);
$output = "
<tr>
<td>
$product_id
</td>
<td>
$quantity
</td>
<td>
$ amount
</td>
</tr>
";
return $output;
}
?>
</table><!--end shoppingCart-->
<?php set_shopping_cart($shopping_cart);
?>in the video, when he refreshes the page, the item quantity goes up 1 as expected...when i refresh my page, the item quantity goes up by 2 each time...not good... ![]()
i've compared my code with the code base and don't see an error...in my first attempt, i continued on with the videos, hoping the issue would resolve, but it didn't...so, i scrapped that code and started again from scratch, with the same result...checked the code again and i'm still not seeing an error...any thoughts as to what might be the cause?

