_offer_id.php 560 Bytes
Newer Older
Яков's avatar
first  
Яков committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?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>';
}