@php $product = $product->loadMissing(['options' => function ($query) { return $query->with(['values']); }]); $oldOption = old('options', []) ?? []; $currentProductOption = $product->options; foreach ($currentProductOption as $key => $option) { $currentProductOption[$key]['name'] = $option->name; foreach ($option['values'] as $valueKey => $value) { $currentProductOption[$key]['values'][$valueKey]['option_value'] = $value->option_value; } } if (!empty($oldOption)) { $currentProductOption = $oldOption; } $isDefaultLanguage = ! defined('LANGUAGE_ADVANCED_MODULE_SCREEN_NAME') || ! request()->input('ref_lang') || request()->input('ref_lang') == Language::getDefaultLocaleCode(); @endphp @push('header') @endpush