public function run() { if ($this->user->can(User::PERMISSION_WISH_LIST_ADD)) { $params = ['data-product-id' => $this->product->id, 'data-reload' => $this->reload ? 1 : $this->reload]; if (Wishlist::find()->where(['product_id' => $this->product->id, 'user_id' => $this->user->id])->exists()) { echo Html::a('', '#', ArrayHelper::merge(['class' => 'catalog-bookmark active'], $params)); } else { echo Html::a('', '#', ArrayHelper::merge(['class' => 'catalog-bookmark'], $params)); } } }
/** * @inheritdoc */ protected function renderPageButtons() { $prevButtonHtml = ''; $nextButtonHtml = ''; $pageCount = $this->pagination->getPageCount(); if ($pageCount < 2 && $this->hideOnSinglePage) { return ''; } $buttons = []; $currentPage = $this->pagination->getPage(); // first page $firstPageLabel = $this->firstPageLabel === true ? '1' : $this->firstPageLabel; if ($firstPageLabel !== false && $currentPage > 1) { $buttons[] = $this->renderPageButton($firstPageLabel, 0, $this->firstPageCssClass, $currentPage <= 0, false) . $this->firstPagePostfix; } // prev page if ($this->prevPageLabel !== false) { if (($page = $currentPage - 1) < 0) { $page = 0; } $prevButtonHtml = Html::a($this->prevPageLabel, $this->pagination->createUrl($page), ['class' => $this->prevPageCssClass]); } // internal pages list($beginPage, $endPage) = $this->getPageRange(); for ($i = $beginPage; $i <= $endPage; ++$i) { $buttons[] = $this->renderPageButton($i + 1, $i, null, false, $i == $currentPage); } // next page if ($this->nextPageLabel !== false) { if (($page = $currentPage + 1) >= $pageCount - 1) { $page = $pageCount - 1; } $nextButtonHtml = Html::a($this->nextPageLabel, $this->pagination->createUrl($page), ['class' => $this->nextPageCssClass]); } // last page $lastPageLabel = $this->lastPageLabel === true ? $pageCount : $this->lastPageLabel; if ($lastPageLabel !== false && $page + 1 !== $pageCount) { $buttons[] = $this->firstPagePostfix . $this->renderPageButton($lastPageLabel, $pageCount - 1, $this->lastPageCssClass, $currentPage >= $pageCount - 1, false); } return $prevButtonHtml . Html::tag('ul', implode("\n", $buttons), $this->options) . $nextButtonHtml; }
<?php use common\components\Html; /* @var $this yii\web\View */ /* @var $products \common\models\Product[] */ /* @var $widget \frontend\widgets\ProductsList */ ?> <ul class="watched-list"> <?php foreach ($products as $product) { ?> <li> <span class="watched-img"><?php echo Html::a(Html::img($product->getMainImagePath()), $product->getRoute()); ?> </span> <span class="watched-cont"> <a href="<?php echo $product->getRoute(); ?> "><?php echo $product->title; ?> </a> <strong>€ 350.00</strong> </span> </li> <?php } ?>