Jump to content
Killersites Forums

Recommended Posts

When i add an item to the shopping cart..the item does not show instead these is what i see :

 

View Store View Cart Clear Cart

Product Id Quantity Amount

$product_id $quantity $ amount

$product_id $quantity $ amount

$product_id $quantity $ amount

 

<?php
require_once '../functions/functions.php';

//call the shopping cart function
$shopping_cart = get_shopping_cart();

echo render_header();


$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
   //create a local variable called line Item counter
$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($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>
<?php
set_shopping_cart($shopping_cart);

echo render_footer();
?>




 

Thats my addToCart code. Every other thing worked perfectly well till here..(Lesson7)..Thanks

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...