<?php
if (isset($product)) {
    $translation = $product['Translation'];
    $productImg = explode(';', $product['product_img']);
    $productImg = (count($productImg) > 0 ? $productImg[0] : false);
        echo '<div class="catalog_category_child_item">';
        echo '<' . ($product['is_detail'] ? 'a' : 'span') . ' href="' . url_for("@product_show?alias=" . $product['alias']) . '" class="anb">';
        if($productImg){
            echo '<img src="/i/n.gif" style="background-image: url(/u/i/' . Page::replaceImageSize($productImg, 'S') . ');" />';
        }else
        {
            $offerImg = '';
            $q = Doctrine::getTable('Product')->findOneById($product['id'])->getOffer();
            foreach ($q as $offer) {
                if (strlen($offer->getImg()) > 3)
                $offerImg = $offer->getImg();
                break;
            }
            if (strlen($offerImg) > 3 )
            {
                echo '<img src="/i/n.gif" style="background-image: url(/u/i/' . $offerImg . '); background-size: cover" />';
            }else
            {
                echo '<img src="/i/n.gif" style="background-image: url(/i/no_photo.png);" />';
            }

        }
        echo '<span class="green_link">' . $translation[$sf_user->getCulture()]['title'] . '</span>';
        echo '</' . ($product['is_detail'] ? 'a' : 'span') . '>';
        echo '<i class="br20"></i>';
        echo '</div>';
}
?>