return $this->asJson(['response' => $mess]);
}
-// public function actionGetStores() {
-// $stores = Products1c::find()->with('store')->where(['tip' => 'city_store'])->andWhere(['view' => '1'])->all();
-// $result = [];
-// foreach ($stores as $store) {
-// if (!empty($store->store->name ?? null)) {
-// $result [] = ['guid' => $store->id ?? null, 'id' => $store->store->id ?? null, 'name' => $store->store->name ?? null];
-// }
-// }
-// return $this->asJson(['response' => $result]);
-// }
public function actionGetStores()
{
- $stores = CityStore::find()->all();
+ $stores = Products1c::find()->with('store')->where(['tip' => 'city_store'])->andWhere(['view' => '1'])->all();
$result = [];
foreach ($stores as $store) {
- if (!empty($store->name ?? null)) {
- $result [] = ['id' => $store->id, 'name' => $store->name];
+ if (!empty($store->store->name ?? null)) {
+ $result[] = ['id' => $store->id, 'name' => $store->store->name];
}
}
return $this->asJson(['response' => $result]);