Professional CodeIgniter, Thomas Myer

Chapter 5: Building a Shopping Cart
137
Figure 5-11


Placing the Add to Cart Links

The next issue that needs addressing is adding " add to cart " links throughout the site. Currently, a
visitor can add a product to her cart on the home page and any product detail page. However, she can ' t
do that on a subcategory page or a search results page.

First, open the search view (/system/application/views/search.php), and add an anchor after the
description that allows the user to add the product to her cart (bold in the following code):
<
div id='pleft'
>
<
h2
>
Search Results
<
/h2
>
<
?php
if (count($results)){
foreach ($results as $key =
>
$list){
echo "
<
img src='".$list[`thumbnail']."' border='0' align='left'/
>
\n";
echo "
<
h4
>
";
echo anchor(`welcome/product/'.$list[`id'],$list[`name']);
echo "
<
/h4
>
\n";
echo "
<
p
>
".$list[`shortdesc']. "
<
br/
>
".
c05.indd 137
c05.indd 137
6/10/08 5:35:26 PM
6/10/08 5:35:26 PM


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

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