Skip to content

Commit

Permalink
Changes the order basket entities are loaded.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisWillerton authored Mar 29, 2018
1 parent 0f842e1 commit 9e01caa
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/Basket/Basket.php
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,21 @@ protected function retrieveBasket()

if ($basket)
{
foreach ($basket['items'] as $hash => $item)
{
$classname = $item['classname'];
$loaded_item = $classname::loadInstance($item['id']);

if ($loaded_item)
{
$this->silentTry('addItem', [
$loaded_item,
$item['quantity'],
$item['created_at']
]);
}
}

if ($basket['delivery_option'])
{
$classname = $basket['delivery_option']['classname'];
Expand All @@ -429,21 +444,6 @@ protected function retrieveBasket()
$this->silentTry('setPromoCode', $loaded_code);
}
}

foreach ($basket['items'] as $hash => $item)
{
$classname = $item['classname'];
$loaded_item = $classname::loadInstance($item['id']);

if ($loaded_item)
{
$this->silentTry('addItem', [
$loaded_item,
$item['quantity'],
$item['created_at']
]);
}
}
}

event($this->event_namespace . '.retrieve', $this);
Expand Down

0 comments on commit 9e01caa

Please sign in to comment.