Created
October 28, 2016 14:00
-
-
Save elmarputz/2161ab2dfac71d7d9a59af6bbc2b472e to your computer and use it in GitHub Desktop.
mbi booklist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<table class="table"> | |
<thead> | |
<tr> | |
<th> | |
Title | |
</th> | |
<th> | |
Author | |
</th> | |
<th> | |
Price | |
</th> | |
<th> | |
<span class="glyphicon glyphicon-shopping-cart" aria-hidden="true"></span> | |
</th> | |
</tr> | |
</thead> | |
<tbody> | |
<?php | |
foreach ($books as $book): | |
$inCart = ShoppingCart::contains($book->getId()); | |
?> | |
<tr> | |
<td><strong> | |
<?php echo Util::escape($book->getTitle()); ?> | |
</strong> | |
</td> | |
<td> | |
<?php echo Util::escape($book->getAuthor()); ?> | |
</td> | |
<td> | |
<?php echo Util::escape($book->getPrice()); ?> | |
</td> | |
<td class="add-remove"> | |
<?php if ($inCart): ?> | |
<form method="post" action="<?php echo Util::action('removeFromCart', array('bookId' => $book->getId())); ?>"> | |
<input type="submit" role="button" class="btn btn-default btn-xs btn-info" value="-" /> | |
</form> | |
<?php else: ?> | |
<form method="post" action="<?php echo Util::action('addToCart', array('bookId' => $book->getId())); ?>"> | |
<input type="submit" role="button" class="btn btn-default btn-xs btn-success" value="+" /> | |
</form> | |
<?php endif; ?> | |
</td> | |
</tr> | |
<?php endforeach; ?> | |
</tbody> | |
</table> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment