// Missing or invalid query param, look for a default.
foreach ($stores as $store) {
if ($store->isDefault() && $store->getWebsiteId() === $this->getFirstWebsiteId()) {
return $store['store_id'];
}
}
// No default found, return the first store.
$firstStore = array_slice($stores, 0, 1)[0];
to
$i=0;
// Missing or invalid query param, look for a default.
foreach ($stores as $store) {
if ($store->isDefault() && $store->getWebsiteId() === $this->getFirstWebsiteId()) {
return $store['store_id'];
}
if ($i === 0) {
// No default found, return the first store.
$firstStore = $store;
}
$i++;
}
Preconditions (*)
Steps to reproduce (*)
Expected result (*)
Actual result (*)
I suggest 2 options:
from
to
from
to