Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/Traits/OrderItemCustomerOptionCapableTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,27 @@ public function equals(SyliusOrderItemInterface $item): bool

// iterate over all options and compare their values
foreach ($itemCustomerConfiguration as $code => $value) {
// If one option is multi-select and the other one isn't they're not equal
if (is_array($value) !== is_array($curItemCustomerConfiguration[$code])) {
return false;
}

// If it's multi-select
if (is_array($value)) {
if (count($value) !== count($curItemCustomerConfiguration[$code])) {
return false;
}

foreach ($curItemCustomerConfiguration[$code] as $optionKey => $multiSelectValue) {
if ($multiSelectValue->getOptionValue() !== $value[$optionKey]->getOptionValue()) {
return false;
}
}

return false;
}

// It's a normal value option
if ($curItemCustomerConfiguration[$code]->getOptionValue() !== $value->getOptionValue()) {
return false;
}
Expand Down