mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-05 12:56:04 -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
|
class OptionConfigurationFormFields
|
||||||
{
|
{
|
||||||
public function handle(
|
public function handle(
|
||||||
OptionConfigurationFormBuilder $builder,
|
OptionConfigurationFormBuilder $builder,
|
||||||
AdvRepositoryInterface $advRepository,
|
AdvRepositoryInterface $advRepository,
|
||||||
ProductoptionRepositoryInterface $productOptionRepository,
|
ProductoptionRepositoryInterface $productOptionRepository,
|
||||||
ProductoptionsValueRepositoryInterface $productoptionsValueRepository
|
ProductoptionsValueRepositoryInterface $productoptionsValueRepository
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if(request()->has('ad') || $builder->getEntry())
|
if(request()->has('ad') || $builder->getEntry())
|
||||||
{
|
{
|
||||||
$ad = $advRepository->find(request('ad') ?? $builder->getEntry());
|
$ad = $advRepository->find(request('ad') ?? $builder->getEntry());
|
||||||
$options = $productOptionRepository->getWithCategoryId($ad->cat1);
|
|
||||||
|
|
||||||
$options_fields = array();
|
$options_fields = array();
|
||||||
|
|
||||||
foreach ($options as $option)
|
if($ad)
|
||||||
{
|
{
|
||||||
if($optionValue = $productoptionsValueRepository->getWithOptionsId([$option->id]))
|
$options = $productOptionRepository->getWithCategoryId($ad->cat1);
|
||||||
{
|
|
||||||
$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);
|
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