Exemplo n.º 1
0
	h4 {
		text-overflow: ellipsis;
		white-space: nowrap;
		overflow: hidden;
		display: block;
	}
</style>

<div class="container">
	<div class="row">
		<div class="col-md-8">
			<h2>Téléphones</h2>
			<div class="row">
				<?php 
foreach (Phone::homePhones() as $phone) {
    if (Promotion::getPromotionByPhoneId($phone->id)) {
        $phone->promotionPrice = $phone->price - Promotion::getPromotionByPhoneId($phone->id)->percent * 0.01 * $phone->price;
    }
    echo '<div class="col-md-4 col-sm-6 col-xs-12" style="text-align: center">';
    echo '<div style="border: 1px solid #ededed; padding: 30px; margin: 20px 0;">';
    echo '<a href="index.php?page=product&id=' . $phone->id . '">';
    echo '<img src="' . Phone::getPhoneThumbnail($phone->id) . '" alt="' . $phone->name . '" style="width: 100px;">';
    echo '<h4>' . $phone->name . '</h4>';
    echo '</a>';
    if (isset($phone->promotionPrice)) {
        echo '<span class="badge old-price" style="background-color: transparent; color: #777;">' . number_format($phone->price, 2, ',', ' ') . ' &euro;</span> <span class="badge" style="background: #e74c3c;">' . number_format($phone->promotionPrice, 2, ',', ' ') . ' &euro;</span>';
    } else {
        echo '<span class="badge">' . number_format($phone->price, 2, ',', ' ') . ' &euro;</span>';
    }
    echo '</div>';