Example #1
0
/* @var $product Product */
$linkTypes = ProductLinkType::getFormattedList();
?>


<div class="row">
    <div class="col-sm-12">
        <h3><?php 
echo Yii::t('StoreModule.store', 'Products related with "{name}"', ['{name}' => $product->name]);
?>
</h3>
        <?php 
$linked = new ProductLink('search');
$linked->setAttributes(Yii::app()->getRequest()->getParam('ProductLink'));
$linked->product_id = $product->id;
$this->widget('yupe\\widgets\\CustomGridView', ['id' => 'linked-product-grid', 'type' => 'condensed', 'dataProvider' => $linked->search(), 'filter' => $linked, 'actionsButtons' => false, 'bulkActions' => [false], 'ajaxUrl' => ['/store/productBackend/update', 'id' => $product->id], 'columns' => [['type' => 'raw', 'value' => function ($data) {
    return CHtml::link(CHtml::image($data->linkedProduct->getImageUrl(40, 40), "", ["class" => "img-thumbnail"]), ["/store/productBackend/update", "id" => $data->linkedProduct->id]);
}], ['header' => Yii::t('StoreModule.store', 'Name'), 'type' => 'raw', 'value' => function ($data) {
    return CHtml::link($data->linkedProduct->name, ["/store/productBackend/update", "id" => $data->linkedProduct->id]);
}], ['header' => Yii::t('StoreModule.store', 'SKU'), 'type' => 'raw', 'value' => function ($data) {
    return CHtml::link($data->linkedProduct->sku, ["/store/productBackend/update", "id" => $data->linkedProduct->id]);
}], ['header' => Yii::t('StoreModule.store', 'Price'), 'type' => 'raw', 'value' => function ($data) {
    return $data->linkedProduct->price;
}], ['class' => 'yupe\\widgets\\EditableStatusColumn', 'name' => 'type_id', 'url' => $this->createUrl('/store/linkBackend/inline'), 'source' => $linkTypes, 'options' => []], ['class' => 'yupe\\widgets\\CustomButtonColumn', 'template' => '{delete}', 'buttons' => ['delete' => ['url' => function ($data) {
    return Yii::app()->createUrl('/store/linkBackend/delete', ['id' => $data->id]);
}]]]]]);
?>
    </div>
</div>