Chapter 5: Building a Shopping Cart
138
anchor(‘welcome/cart/’.$list[‘id’],’add to cart’).
“ < /p > < br style=’clear:both’/ > ”;
}
}else{
echo “ < p > Sorry, no records were found to match your search term. < /p > ”;
}
? >
< /div >
Do the same thing on the category view (/system/application/views/category.php), adding an
anchor() after the description text.
< div id=’pleft’ >
< ?php
echo “ < h2 > ”.$category[‘name’].” < /h2 > \n”;
echo “ < p > ”.$category[‘shortdesc’]. “ < /p > \n”;
foreach ($listing as $key = > $list){
echo “ < img src=’”.$list[‘thumbnail’].”’ border=’0’ align=’left’/ > \n”;
echo “ < h4 > ”;
switch($level){
case “1”:
echo anchor(‘welcome/cat/’.$list[‘id’],$list[‘name’]);
break;
case “2”:
echo anchor(‘welcome/product/’.$list[‘id’],$list[‘name’]);
break;
}
echo “ < /h4 > \n”;
echo “ < p > ”.$list[‘shortdesc’].
“ < br/ > ”. anchor(‘welcome/cart/’.$list[‘id’],’add to cart’).
“ < /p > < br style=’clear:both’/ > ”;
}
? >
< /div >
Cleaning up Thumbnail and Text Positioning
The last bit of cleanup you ’ re going to do involves how the thumbnails and text lay out on the home,
category, product, and search views. This will involve quite a bit of nudging in both CSS and the views.
The first step is adjusting the CSS rule for H4s, which is the header level you ’ ve assigned for thumbnails.
Simply zero out the top and bottom margins.
h4{
margin-top:0px;
margin-bottom:0px;
font-size:.8em;
color:#14b8b8;
}