|
|
|
|
|
|
|
|
]; |
|
|
]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function actionAjaxUpdateProductOrder($idUser = false, $idPointSale = false) |
|
|
|
|
|
|
|
|
public function actionAjaxUpdateProductOrder($idDistribution, $idUser = false, $idPointSale = false) |
|
|
{ |
|
|
{ |
|
|
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; |
|
|
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; |
|
|
|
|
|
|
|
|
|
|
|
$distribution = Distribution::findOne($idDistribution) ; |
|
|
$user = User::findOne($idUser) ; |
|
|
$user = User::findOne($idUser) ; |
|
|
$userProducer = UserProducer::searchOne([ |
|
|
$userProducer = UserProducer::searchOne([ |
|
|
'id_user' => $idUser, |
|
|
'id_user' => $idUser, |
|
|
|
|
|
|
|
|
->where([ |
|
|
->where([ |
|
|
'id_producer' => GlobalParam::getCurrentProducerId(), |
|
|
'id_producer' => GlobalParam::getCurrentProducerId(), |
|
|
'product.active' => 1, |
|
|
'product.active' => 1, |
|
|
])->joinWith(['productPrice']) |
|
|
|
|
|
->all(); |
|
|
|
|
|
|
|
|
])->joinWith(['productPrice', 'productDistribution' => function ($q) use ($distribution) { |
|
|
|
|
|
$q->where(['id_distribution' => $distribution->id]); |
|
|
|
|
|
}])->all(); |
|
|
|
|
|
|
|
|
$productOrderArray = []; |
|
|
$productOrderArray = []; |
|
|
foreach ($productsArray as $product) { |
|
|
foreach ($productsArray as $product) { |