Example #1
0
 private function getStores()
 {
     if (!empty($city = $this->getCityId())) {
         $store = TStore::find()->select('id')->asArray()->where('city_id = :city_id', [':city_id' => $city])->all();
     }
     return !empty($store) ? $store : false;
 }
Example #2
0
 public function getStorelist()
 {
     $stores = new TStore();
     $astores = $stores->find()->asArray()->all();
     $res = [];
     foreach ($astores as $a) {
         $res[$a['id']] = $a['name'];
     }
     return $res;
 }
Example #3
0
File: Run.php Project: kd-brinex/kd
 private function getCityId($options)
 {
     if (!empty($options['city_id'])) {
         $this->cityId = $options['city_id'];
         unset($options['city_id']);
     } else {
         if (!empty($options['store_id'])) {
             $this->cityId = TStore::find()->select('city_id')->where('id = :id', [':id' => $options['store_id']])->one()->city_id;
         } else {
             if (!empty($cookie = Yii::$app->request->cookies['city'])) {
                 $this->cityId = (int) $cookie->value;
             }
         }
     }
     return $this->cityId;
 }
Example #4
0
 public function searchCity()
 {
     $query = TStore::find()->groupBy('city_id');
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     return $dataProvider;
 }
Example #5
0
 /**
  * Функция определения city_id по StoreID - id магазина
  * @param $store_id
  * @return int|mixed
  */
 public function getCityid($store_id)
 {
     $store = \app\modules\autoparts\models\TStore::find()->where(['id' => $store_id])->one();
     return !empty($store) ? $store->city_id : '';
 }