Answer the question
In order to leave comments, you need to log in
Why is the same item added to the cart again and again?
public function actionTocart($id, $name, $price, $count = 1){
$session = Yii::$app->session;
$session->open();
$_SESSION['cart'][$id]['name'] = $name;
$_SESSION['cart'][$id]['price'] = $price;
$_SESSION['cart'][$id]['count'] = $count;
$this->redirect("/cart");
}
Answer the question
In order to leave comments, you need to log in
code picture is so convenient!
ps Why climb directly into the session?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question