* | * | ||||
* @param array $array | * @param array $array | ||||
*/ | */ | ||||
public function actionOrder($array) | |||||
public function actionOrder() | |||||
{ | { | ||||
$array = Yii::$app->request->post('array') ; | |||||
$orderArray = json_decode(stripslashes($array)); | $orderArray = json_decode(stripslashes($array)); | ||||
foreach($orderArray as $id => $order) { | foreach($orderArray as $id => $order) { | ||||
$product = $this->findModel($id); | $product = $this->findModel($id); | ||||
$product->order = $order; | $product->order = $order; |
}) ; | }) ; | ||||
console.log(tab_ordre) ; | console.log(tab_ordre) ; | ||||
$.get(UrlManager.getBaseUrl()+'product/order',{ | |||||
/*$.get(UrlManager.getBaseUrl()+'product/order',{ | |||||
array: JSON.stringify(tab_ordre) | |||||
}) ;*/ | |||||
$.post(UrlManager.getBaseUrl()+'product/order',{ | |||||
array: JSON.stringify(tab_ordre) | array: JSON.stringify(tab_ordre) | ||||
}) ; | }) ; | ||||
} | } |
->with($optionsSearch['with']) | ->with($optionsSearch['with']) | ||||
->innerJoinWith($optionsSearch['join_with'], true) | ->innerJoinWith($optionsSearch['join_with'], true) | ||||
->where(['product.id_producer' => Producer::getId()]) | ->where(['product.id_producer' => Producer::getId()]) | ||||
->orderBy('product.order ASC') | |||||
; | ; | ||||
$dataProvider = new ActiveDataProvider([ | $dataProvider = new ActiveDataProvider([ |