<?php
/**
 * Created by PhpStorm.
 * User: yakov
 * Date: 27.03.18
 * Time: 16:09
 */
if ($callback->getOfferId() != null) {
    $q = Doctrine_Query::create()
        ->select('p.*, o.*, ot.*')
        ->from('Product p')
        ->leftJoin('p.Offer o WITH o.product_id = p.id')
        ->where('o.id = ?', $callback->getOfferId())
        ->leftJoin('o.Translation ot WITH ot.lang = \'ru\'')
        ->fetchArray();

    echo '<a class="blank_product" href="/ru/product/' . $q[0]['alias'] . '/">' . $q[0]['Offer'][0]['Translation']['ru']['title'] . '</a>';
}
