<?php foreach ($model as $product) : ?>
<div class="main_block">
<?php if ($product['hit']) : ?>
<div class="hit_product label label-success">Хит</div>
<?php endif; ?>
<?php if ($product['new']) : ?>
<div class="new_product label label-primary">Новинка</div>
<?php endif; ?>
<?php if ($product['sale']) : ?>
<div class="sale_product label label-danger">Распродажа</div>
<?php endif; ?>
<div class="image_block">
<?= Html::img('/web/uploads/products/' . Product::getImageName($product['img_id']), ['width' => '105', 'height' => '150']) ?>
</div>
<div class="title_block"><h1><?= $product['title'] ?></h1></div>
<div class="category_block"><?= Category::getTitleCategory($product['category_id']) ?></div>
<div class="rating_block">*****</div>
<div class="price_block"><?= $product['price'] ?> грн.</div>
<div class="btn_buy_block"><a href="<?= Url::to(['product/index', 'id' => $product['id']]) ?>">Купить</a>
</div>
</div>
<?php endforeach; ?>
public function actionSortItemCategory()
{
$id = (int)Yii::$app->request->post('id');
$cat_id = $_POST['cat_id'];
if ($id == 1) {
$model = Product::find()
->asArray()
->where(['category_id' => $cat_id])
->andWhere(['status' => Product::STATUS_PRODUCT_ON])
->andWhere('price')
->orderBy(['price' => SORT_ASC]);
}
if ($objectFile->save(false)) {
$this->image->saveAs('uploads/products' . DIRECTORY_SEPARATOR . $objectFile->name);
$this->img_id = $objectFile->id;
$this->save();
}
move_uploaded_file(@web/uploads/product/726381f0af494d6692ef0d3e6d01d414.jpg): failed to open stream: No such file or directory
вот такой путь, тот выше не правильный move_uploaded_file(@web/upload/company/ad0e7643312a50ba3a8dcbfb8bf98b5f.jpg): failed to open stream: No such file or directory
public function actionCity($q = null)
{
$query = new Query();
$query->select('city_name')
->from('profile')
->where('city_name LIKE "%' . $q . '%"')
->groupBy('city_name')
->orderBy('city_name');
$command = $query->createCommand();
$data = $command->queryAll();
$out = [];
foreach ($data as $d) {
$out[] = ['value' => $d['city_name']];
}
echo Json::encode($out);
}
Typeahead::widget([
'name' => 'Search[city]',
'options' => ['placeholder' => 'Все города Украины ...'],
'pluginOptions' => ['highlight' => true],
'class' => 'search-input-city',
'dataset' => [
[
'datumTokenizer' => "Bloodhound.tokenizers.obj.whitespace('value')",
'display' => 'value',
//'prefetch' => $asset->baseUrl . '/samples/countries.json',
'remote' => [
'url' => Url::to(['search/city']) . '?q=%QUERY',
'wildcard' => '%QUERY'
]
]
]
]);