mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
Merge pull request #1156 from openclassify/mua
product options error fixed
This commit is contained in:
commit
4bbd7b85ea
@ -6,37 +6,42 @@ use Visiosoft\AdvsModule\ProductoptionsValue\Contract\ProductoptionsValueReposit
|
||||
|
||||
class OptionConfigurationFormFields
|
||||
{
|
||||
public function handle(
|
||||
OptionConfigurationFormBuilder $builder,
|
||||
AdvRepositoryInterface $advRepository,
|
||||
ProductoptionRepositoryInterface $productOptionRepository,
|
||||
public function handle(
|
||||
OptionConfigurationFormBuilder $builder,
|
||||
AdvRepositoryInterface $advRepository,
|
||||
ProductoptionRepositoryInterface $productOptionRepository,
|
||||
ProductoptionsValueRepositoryInterface $productoptionsValueRepository
|
||||
)
|
||||
{
|
||||
if(request()->has('ad') || $builder->getEntry())
|
||||
{
|
||||
$ad = $advRepository->find(request('ad') ?? $builder->getEntry());
|
||||
$options = $productOptionRepository->getWithCategoryId($ad->cat1);
|
||||
{
|
||||
if(request()->has('ad') || $builder->getEntry())
|
||||
{
|
||||
$ad = $advRepository->find(request('ad') ?? $builder->getEntry());
|
||||
|
||||
$options_fields = array();
|
||||
$options_fields = array();
|
||||
|
||||
foreach ($options as $option)
|
||||
{
|
||||
if($optionValue = $productoptionsValueRepository->getWithOptionsId([$option->id]))
|
||||
{
|
||||
$options_fields['option-'.$option->getId()] = [
|
||||
'type' => 'anomaly.field_type.select',
|
||||
'label' => $option->getName(),
|
||||
'required' => true,
|
||||
'config' => [
|
||||
'options' => $optionValue->pluck('title','id')->all(),
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
$fields = array_merge($options_fields, ['price', 'currency', 'stock']);
|
||||
if($ad)
|
||||
{
|
||||
$options = $productOptionRepository->getWithCategoryId($ad->cat1);
|
||||
|
||||
$builder->setFields($fields);
|
||||
}
|
||||
}
|
||||
foreach ($options as $option)
|
||||
{
|
||||
if($optionValue = $productoptionsValueRepository->getWithOptionsId([$option->id]))
|
||||
{
|
||||
$options_fields['option-'.$option->getId()] = [
|
||||
'type' => 'anomaly.field_type.select',
|
||||
'label' => $option->getName(),
|
||||
'required' => true,
|
||||
'config' => [
|
||||
'options' => $optionValue->pluck('title','id')->all(),
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$fields = array_merge($options_fields, ['price', 'currency', 'stock']);
|
||||
|
||||
$builder->setFields($fields);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user