Skip to content

Commit

Permalink
Some changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tafid committed Dec 22, 2015
1 parent ed1930f commit 9820938
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/actions/AddToCartAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,18 @@ public function run()
$data = null;
$cart = $this->getModule()->getCart();
$request = Yii::$app->request;
$collection = new Collection([
'model' => new $this->productClass(),
]);
$model = new $this->productClass();
$collection = new Collection();
$collection->setModel($model);
// $data = $request->isPost ? $request->post() : $request->get();

if (!$this->bulkLoad) {
if ($this->bulkLoad) {
$data = [];
$selection = $request->post('selection');
foreach ($selection as $id) {
$data[$id] = [reset($collection->first->primaryKey()) => $id];
}
} else {
$data = [$request->post() ?: $request->get()];
}

Expand Down

0 comments on commit 9820938

Please sign in to comment.