Professional CodeIgniter, Thomas Myer

Chapter 10: Launch
296

As a quick reminder, here ' s the source code for the shoppingcart view:
<
h1
>
Shopping Cart
<
/h1
>
<
div id='pleft'
>
<
?php echo form_open(); ?
>
<
table border='1' cellspacing='0' cellpadding='5'
>
<
?php
$TOTALPRICE = $_SESSION[`totalprice'];
if (count($_SESSION[`cart'])){
foreach ($_SESSION[`cart'] as $PID =
>
$row){
$data = array(
`name' =
>
"li_id[$PID]",
`value'=
>
$row[`count'],
`id' =
>
"li_id_$PID",
`class' =
>
`process',
`size' =
>
5
);
echo "
<
tr valign='top'
>
\n";
echo "
<
td
>
". form_input($data)."
<
/td
>
\n";
echo "
<
td id='li_name_".$PID."'
>
". $row[`name']."
<
/td
>
\n";
echo "
<
td id='li_price_".$PID."'
>
". $row[`price']."
<
/td
>
\n";
echo "
<
td id='li_total_".$PID."'
>
".$row[`price'] * $row[`count']."
<
/td
>
\n";
echo "
<
td
>
<
a href='#' onclick='javascript:jsRemoveProduct($PID)'
>
delete
<
/a
>
<
/td
>
\n";
echo "
<
/tr
>
\n";
}
$total_data = array(`name' =
>
`total', `id'=
>
'total', `value' =
>
$TOTALPRICE);
echo "
<
tr valign='top'
>
\n";
echo "
<
td colspan='3'
>
&
nbsp;
<
/td
>
\n";
echo "
<
td colspan='2'
>
$TOTALPRICE ".form_hidden($total_data)."
<
/td
>
\n";
echo "
<
/tr
>
\n";
echo "
<
tr valign='top'
>
\n";
echo "
<
td colspan='3'
>
&
nbsp;
<
/td
>
\n";
echo "
<
td colspan='2'
>
<
input type='button' name='update' value='update'
onClick='javascript:jsUpdateCart()'/
>
<
/td
>
\n";
echo "
<
/tr
>
\n";
echo "
<
tr valign='top'
>
\n";
echo "
<
td colspan='3'
>
&
nbsp;
<
/td
>
\n";
echo "
<
td colspan='2'
>
".form_submit(`submit', `checkout')."
<
/td
>
\n";
echo "
<
/tr
>
\n";
}else{
//just in case!
echo "
<
tr
>
<
td
>
No items to show here!
<
/td
>
<
/tr
>
\n";
}//end outer if count
c10.indd 296
c10.indd 296
6/10/08 5:38:33 PM
6/10/08 5:38:33 PM


Другие страницы

 
Cкачать книги бесплатно без регистрации в электронном виде (pdf, chm, txt).Вы можете читать книги онлайн на нашем сайте литературного портала книг.Большая подборка учебников, пособий, интересных книг.Электронные книги на английском языке скачать бесплатно без смс.

OK

Loading...
...
Закрыть