Professional CodeIgniter

(singke) #1

Chapter 5: Building a Shopping Cart


141


? >
< /div >

< div id=’pright’ >
< ?php
foreach ($grouplist as $key = > $list){
echo “ < div class=’productlisting’ >
< img src=’”.$list[‘thumbnail’].”’ border=’0’ class=’thumbnail’ / > \n”;
echo “ < h4 > ”.$list[‘name’].” < /h4 > \n”;
echo anchor(‘welcome/product/’.$list[‘id’],’see details’). “ < br/ > \n”;
echo anchor(‘welcome/cart/’.$list[‘id’],’add to cart’). “\n < /div > ”;
}
? >
< /div >

Finally, here ’ s the search view:


< div id=’pleft’ >
< h2 > Search Results < /h2 >

< ?php
if (count($results)){
foreach ($results as $key = > $list){
echo “ < div class=’productlisting’ >
< img src=’”.$list[‘thumbnail’].”’ border=’0’ class=’thumbnail’ / > \n”;
echo “ < h4 > ”;
echo anchor(‘welcome/product/’.$list[‘id’],$list[‘name’]);
echo “ < /h4 > \n”;
echo $list[‘shortdesc’].” < br/ > ”.
anchor(‘welcome/cart/’.$list[‘id’],’add to cart’).” < /div > ”;
}
}else{
echo “ < p > Sorry, no records were found to match your search term. < /p > ”;
}
? >
< /div >

The home page of Claudia ’ s Kids should now look something like Figure 5 - 12.

Free download pdf