<?php
if (strlen($form->getObject()->getOfferId()) > 0)
{
    echo '<span class="inline-label"><label><b>Товар</b></label></span>';
    echo '<i class="br5"></i>';
    $q = Doctrine_Query::create()
        ->select('p.*, o.*, ot.*')
        ->from('Product p')
        ->leftJoin('p.Offer o WITH o.product_id = p.id')
        ->where('o.id = ?', $form->getObject()->getOfferId())
        ->leftJoin('o.Translation ot WITH ot.lang = \'ru\'')
        ->fetchArray();

    echo '<a href="/ru/product/' . $q[0]['alias'] . '/">' . $q[0]['Offer'][0]['Translation']['ru']['title'] . '</a>';
    //print_r($q);
}
?>
<script>
    $(document).ready(function () {
        $('.sf_admin_form_field_offer_id').hide();
    })
</script>
