$ipaddress = $_SERVER['REMOTE_ADDR']; else $ipaddress = '127.0.0.1'; } return self::$ipaddress; } public static function getClientInfoLocation() { if (self::$clientInfoLocation == null) { self::$clientInfoLocation = (unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . self::get_client_ip()))); } return self::$clientInfoLocation; } public static function getClientCityCode() { $dt = self::getClientInfoLocation(); return strtolower($dt['geoplugin_city']); }
} return self::$ipaddress; } public static function getClientInfoLocation() { if (self::$clientInfoLocation == null) { self::$clientInfoLocation = (unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . self::get_client_ip()))); } return self::$clientInfoLocation; } public static function getClientCityCode() { $dt = self::getClientInfoLocation();
self::$clientInfoLocation = (unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . self::get_client_ip()))); } return self::$clientInfoLocation; } public static function getClientCityCode() { $dt = self::getClientInfoLocation(); return strtolower($dt['geoplugin_city']); } public static function getCity($code) { $city = City::find()->where(['code' => $code])->one(); if (empty($city)) {
} public function getCity_id() { $cookies = Yii::$app->request->cookies; if (!$cookies->has('delivery_city_id')) { $geolocation = Geolocation::getClientCityCode(); $city = Geolocation::getCity($geolocation); return $city; } return $cookies->getValue('delivery_city_id'); }
*/ public function __get($name) { $getter = 'get' . $name; if (method_exists($this, $getter)) { // read property, e.g. getName() return $this->$getter(); } // behavior property $this->ensureBehaviors(); foreach ($this->_behaviors as $behavior) { if ($behavior->canGetProperty($name)) {
{ return static::find() ->distinct() ->andWhere(['{{%product}}.[[is_active]]' => true]) ->innerJoinWith(['offers.pvOfferPrices', 'offers.pvOfferWarehouses.warehouse']) ->andWhere(['>', '{{%pv_offer_prices}}.[[value]]', 1]) ->andFilterWhere(['{{%warehouse}}.[[city_id]]' => Yii::$app->delivery->city_id]); } public static function findBest() { return static::getPublicQuery()->orderBy(['RAND(1)' => SORT_ASC])->withRemnant()->cache(300); }
{ return static::getPublicQuery()->orderBy(['RAND(1)' => SORT_ASC])->withRemnant()->cache(300); } public static function findFeatured() { return static::getPublicQuery()->orderBy(['RAND(2)' => SORT_ASC])->withRemnant()->cache(300); } public static function findViwed() { return static::getPublicQuery()->orderBy(['RAND(3)' => SORT_ASC])->withRemnant()->cache(300); }
<div class="box-swiper"> <div class="swiper-container swiper-tab-1"> <div class="swiper-wrapper pt-5"> <div class="swiper-slide"> <?= ListView::widget([ 'layout' => '{items}', 'dataProvider' => Product::findFeatured()->search(null, ['pagination' => ['pageSize' => 5]]), 'itemView' => '//partial/product-item', 'options' => ['class' => 'list-products-5'], 'itemOptions' => ['tag' => false], 'pager' => [ 'class' => LinkPager::class ],
{ $_obInitialLevel_ = ob_get_level(); ob_start(); ob_implicit_flush(false); extract($_params_, EXTR_OVERWRITE); try { require $_file_; return ob_get_clean(); } catch (\Exception $e) { while (ob_get_level() > $_obInitialLevel_) { if (!@ob_end_clean()) { ob_clean(); }
$this->renderers[$ext] = Yii::createObject($this->renderers[$ext]); } /* @var $renderer ViewRenderer */ $renderer = $this->renderers[$ext]; $output = $renderer->render($this, $viewFile, $params); } else { $output = $this->renderPhpFile($viewFile, $params); } $this->afterRender($viewFile, $params, $output); } array_pop($this->_viewFiles); $this->context = $oldContext;
* @throws InvalidCallException if the view cannot be resolved. * @see renderFile() */ public function render($view, $params = [], $context = null) { $viewFile = $this->findViewFile($view, $context); return $this->renderFile($viewFile, $params, $context); } /** * Finds the view file based on the given view name. * @param string $view the view name or the [path alias](guide:concept-aliases) of the view file. Please refer to [[render()]] * on how to specify this parameter.
//echo Product::getPublicQuery()->andWhere(['id' => 459])->createCommand()->rawSql; //exit; echo $this->render('partial/slider-block'); //echo $this->render('partial/brand-block'); echo $this->render('partial/category-block'); echo $this->render('partial/product-best-block'); //echo $this->render('partial/product-trend-block'); echo $this->render('//layouts/partial/ecom/ad1-block'); echo $this->render('partial/product-top-block'); echo $this->render('//layouts/partial/ecom/ad2-block'); //echo $this->render('partial/news-block');
{ $_obInitialLevel_ = ob_get_level(); ob_start(); ob_implicit_flush(false); extract($_params_, EXTR_OVERWRITE); try { require $_file_; return ob_get_clean(); } catch (\Exception $e) { while (ob_get_level() > $_obInitialLevel_) { if (!@ob_end_clean()) { ob_clean(); }
$this->renderers[$ext] = Yii::createObject($this->renderers[$ext]); } /* @var $renderer ViewRenderer */ $renderer = $this->renderers[$ext]; $output = $renderer->render($this, $viewFile, $params); } else { $output = $this->renderPhpFile($viewFile, $params); } $this->afterRender($viewFile, $params, $output); } array_pop($this->_viewFiles); $this->context = $oldContext;
* @throws InvalidCallException if the view cannot be resolved. * @see renderFile() */ public function render($view, $params = [], $context = null) { $viewFile = $this->findViewFile($view, $context); return $this->renderFile($viewFile, $params, $context); } /** * Finds the view file based on the given view name. * @param string $view the view name or the [path alias](guide:concept-aliases) of the view file. Please refer to [[render()]] * on how to specify this parameter.
* These parameters will not be available in the layout. * @return string the rendering result. * @throws InvalidArgumentException if the view file or the layout file does not exist. */ public function render($view, $params = []) { $content = $this->getView()->render($view, $params, $this); return $this->renderContent($content); } /** * Renders a static string by applying a layout. * @param string $content the static string being rendered
/** * Displays homepage. * * @return string */ public function actionIndex() { return $this->render('index'); } /** * Login action. * * @return Response|string
$args = $this->controller->bindActionParams($this, $params); Yii::debug('Running action: ' . get_class($this->controller) . '::' . $this->actionMethod . '()', __METHOD__); if (Yii::$app->requestedParams === null) { Yii::$app->requestedParams = $args; } return call_user_func_array([$this->controller, $this->actionMethod], $args); } }
} $result = null; if ($runAction && $this->beforeAction($action)) { // run the action $result = $action->runWithParams($params); $result = $this->afterAction($action, $result); // call afterAction on modules foreach ($modules as $module) { /* @var $module Module */
$parts = $this->createController($route); if (is_array($parts)) { /* @var $controller Controller */ list($controller, $actionID) = $parts; $oldController = Yii::$app->controller; Yii::$app->controller = $controller; $result = $controller->runAction($actionID, $params); if ($oldController !== null) { Yii::$app->controller = $oldController; } return $result; }
$params = $this->catchAll; unset($params[0]); } try { Yii::debug("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } $response = $this->getResponse(); if ($result !== null) {
{ try { $this->state = self::STATE_BEFORE_REQUEST; $this->trigger(self::EVENT_BEFORE_REQUEST); $this->state = self::STATE_HANDLING_REQUEST; $response = $this->handleRequest($this->getRequest()); $this->state = self::STATE_AFTER_REQUEST; $this->trigger(self::EVENT_AFTER_REQUEST); $this->state = self::STATE_SENDING_RESPONSE; $response->send();
require(__DIR__ . '/../vendor/autoload.php'); require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php'); $config = require(__DIR__ . '/../config/web.php'); (new yii\web\Application($config))->run();
$_GET = [ 'route' => 'product/category', 'path' => '87_103', ];