public function __construct()
 {
     $api_key = \common\models\Suppliers::find()->select('api_key')->where(['id_supplier' => '4'])->limit(1)->scalar();
     $keys = explode(':', $api_key);
     $this->key1 = $keys[0];
     $this->key2 = $keys[1];
     $this->client = new \SoapClient('http://vl.rossko.ru/service/v1/GetSearch?wsdl', ["exceptions" => true]);
 }
 public function __construct($auth_key = false)
 {
     $this->url_send = 'https://api2.autotrade.su/?json';
     if ($auth_key) {
         $this->auth_key = $auth_key;
     } else {
         $this->auth_key = \common\models\Suppliers::find()->select('api_key')->where(['id_supplier' => '3'])->limit(1)->scalar();
     }
 }
 public function __construct($auth_key = false)
 {
     $this->url_send = 'http://api.tmparts.ru/api/';
     if ($auth_key) {
         $this->auth_key = $auth_key;
     } else {
         $this->auth_key = \common\models\Suppliers::find()->select('api_key')->where(['id_supplier' => '5'])->limit(1)->scalar();
     }
 }
Example #4
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Suppliers::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['SupplierId' => $this->SupplierId, 'PrimaryPersonId' => $this->PrimaryPersonId, 'created_by' => $this->created_by, 'LastUpdatedBy' => $this->LastUpdatedBy, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'deleted_at' => $this->deleted_at]);
     $query->andFilterWhere(['like', 'Name', $this->Name])->andFilterWhere(['like', 'ShortName', $this->ShortName])->andFilterWhere(['like', 'Description', $this->Description])->andFilterWhere(['like', 'Website', $this->Website])->andFilterWhere(['like', 'LogoUrl', $this->LogoUrl])->andFilterWhere(['like', 'TaxOffice', $this->TaxOffice])->andFilterWhere(['like', 'TaxNumber', $this->TaxNumber])->andFilterWhere(['like', 'PrimaryPhone', $this->PrimaryPhone])->andFilterWhere(['like', 'PrimaryEmail', $this->PrimaryEmail])->andFilterWhere(['like', 'PrimaryPersonName', $this->PrimaryPersonName])->andFilterWhere(['like', 'Comment', $this->Comment]);
     return $dataProvider;
 }
Example #5
0
<?php

use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use common\models\Suppliers;
use common\models\Brands;
use common\models\Producttypes;
use common\models\Productcategories;
/* @var $this yii\web\View */
/* @var $model common\models\Products */
/* @var $form yii\bootstrap\ActiveForm */
$dataProductCategory = ArrayHelper::map(Productcategories::find()->asArray()->all(), 'ProductCategoryId', 'Name');
$dataSuppliers = ArrayHelper::map(Suppliers::find()->asArray()->all(), 'SupplierId', 'Name');
$dataBrands = ArrayHelper::map(Brands::find()->asArray()->all(), 'BrandId', 'Name');
$dataProducttypes = ArrayHelper::map(Producttypes::find()->asArray()->all(), 'ProducttypeId', 'Name');
?>
<div class="products-form">

    <?php 
$form = ActiveForm::begin(['layout' => 'horizontal']);
?>

    <?php 
echo $form->field($model, 'Name', ['horizontalCssClasses' => ['wrapper' => 'col-sm-4']])->textInput(['maxlength' => 500]);
?>

    <?php 
echo $form->field($model, 'ProductCategoryId', ['horizontalCssClasses' => ['wrapper' => 'col-sm-3']])->dropDownList($dataProductCategory, ['prompt' => '----------Choose a Category----------']);
?>

    <?php 
Example #6
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSupplier()
 {
     return $this->hasOne(Suppliers::className(), ['SupplierId' => 'SupplierId']);
 }
 public function __construct()
 {
     $this->TokenClientUniqom = \common\models\Suppliers::find()->select('api_key')->where(['id_supplier' => 2])->limit(1)->scalar();
     $this->CurlOptions[CURLOPT_URL] = 'http://uniqom.ru/api/server.php';
 }
 /**
  * Finds the Suppliers model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Suppliers the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Suppliers::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }