Skip to content

Commit

Permalink
fix attr create
Browse files Browse the repository at this point in the history
  • Loading branch information
xxl4 committed Dec 10, 2024
1 parent a772d5e commit 0f7e1fd
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/Http/Controllers/Api/V1/Admin/Catalog/ProductController.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,23 +171,21 @@ public function quickCreate(Request $request){
//var_dump($attributeRepos);exit;
if(!$attributeRepos){
// attribute not found and create a new attribute
Event::dispatch('catalog.attribute.create.before');
$attributeRepos = $attributeRepository->create([
'code' => $code,
'admin_name' => $attribute['name'],
'type' => 'select',
'is_required' => 1,
'is_required' => 0,
'is_unique' => 0,
'validation' => '',
'position' => $attribute['position'],
'is_visible' => 1,
'is_configurable' => 1,
'is_filterable' => 1,
'is_filterable_in_search' => 1,
'is_filterable_in_list' => 1,
'use_in_flat' => 1,
'is_comparable' => 1,
'is_used_for_promo_rules' => 1,
'is_visible_on_front' => 1,
'use_in_flat' => 0,
'is_comparable' => 0,
'is_visible_on_front' => 0,
'swatch_type' => 'dropdown',
'use_in_product_listing' => 1,
'use_in_comparison' => 1,
Expand All @@ -198,6 +196,7 @@ public function quickCreate(Request $request){
'locale_based' => 0,
'default_value' => ''
]);
Event::dispatch('catalog.attribute.create.after', $attribute);
}
// check if the attribute option is valid
$attributeOptionRepository = app('Webkul\Attribute\Repositories\AttributeOptionRepository');
Expand Down

0 comments on commit 0f7e1fd

Please sign in to comment.