This commit is contained in:
Kerim 2023-06-27 03:08:01 +05:00
parent 71dcd82576
commit ce23e7c99a
1 changed files with 11 additions and 11 deletions

View File

@ -9,7 +9,7 @@ use Illuminate\Support\Arr;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Sarga\Brand\Repositories\BrandRepository; // use Sarga\Brand\Repositories\BrandRepository;
use Webkul\Attribute\Repositories\AttributeGroupRepository; use Webkul\Attribute\Repositories\AttributeGroupRepository;
use Webkul\Attribute\Repositories\AttributeOptionRepository; use Webkul\Attribute\Repositories\AttributeOptionRepository;
use Webkul\Attribute\Repositories\AttributeRepository; use Webkul\Attribute\Repositories\AttributeRepository;
@ -28,7 +28,7 @@ class ProductRepository extends WProductRepository
protected $attributeValueRepository; protected $attributeValueRepository;
protected $imageRepository; protected $imageRepository;
protected $vendorProductRepository; protected $vendorProductRepository;
protected $brandRepository; // protected $brandRepository;
protected $fillableTypes = ['sku', 'name', 'url_key', 'short_description', 'description', 'price', 'weight', 'status']; protected $fillableTypes = ['sku', 'name', 'url_key', 'short_description', 'description', 'price', 'weight', 'status'];
@ -40,7 +40,7 @@ class ProductRepository extends WProductRepository
ProductImageRepository $productImageRepository, ProductImageRepository $productImageRepository,
VendorProductRepository $vendorProductRepository, VendorProductRepository $vendorProductRepository,
VendorRepository $vendorRepository, VendorRepository $vendorRepository,
BrandRepository $brandRepository, // BrandRepository $brandRepository,
AttributeOptionRepository $optionRepository) AttributeOptionRepository $optionRepository)
{ {
$this->attributeGroupRepo = $attributeGroupRepo; $this->attributeGroupRepo = $attributeGroupRepo;
@ -49,7 +49,7 @@ class ProductRepository extends WProductRepository
$this->productFlatRepository = $productFlatRepository; $this->productFlatRepository = $productFlatRepository;
$this->imageRepository = $productImageRepository; $this->imageRepository = $productImageRepository;
$this->vendorProductRepository = $vendorProductRepository; $this->vendorProductRepository = $vendorProductRepository;
$this->brandRepository = $brandRepository; // $this->brandRepository = $brandRepository;
$this->vendorRepository = $vendorRepository; $this->vendorRepository = $vendorRepository;
parent::__construct($attributeRepository, $app); parent::__construct($attributeRepository, $app);
@ -100,9 +100,9 @@ class ProductRepository extends WProductRepository
// ->addSelect('marketplace_sellers.logo'); // ->addSelect('marketplace_sellers.logo');
} }
if(isset($params['brand'])){ // if(isset($params['brand'])){
$qb->whereIn('product_flat.brand_id', explode(',',$params['brand'])); // $qb->whereIn('product_flat.brand_id', explode(',',$params['brand']));
} // }
if (! core()->getConfigData('catalog.products.homepage.out_of_stock_items')) { if (! core()->getConfigData('catalog.products.homepage.out_of_stock_items')) {
$qb = $this->checkOutOfStockItem($qb); $qb = $this->checkOutOfStockItem($qb);
@ -279,7 +279,7 @@ class ProductRepository extends WProductRepository
$product['type'] = (!empty($data['color_variants']) || !empty($data['size_variants'])) ? 'configurable':'simple'; $product['type'] = (!empty($data['color_variants']) || !empty($data['size_variants'])) ? 'configurable':'simple';
$attributes = Arr::only($data,['brand','cinsiyet']); // $attributes = Arr::only($data,['brand','cinsiyet']);
try { try {
DB::beginTransaction(); DB::beginTransaction();
@ -294,9 +294,9 @@ class ProductRepository extends WProductRepository
} else } else
$product['attribute_family_id'] = $product['type'] == 'configurable' ? 2 : 1; $product['attribute_family_id'] = $product['type'] == 'configurable' ? 2 : 1;
if(!empty($data['brand']) && $brand = $this->brandRepository->findOneByField('name' , $data['brand'])){ // if(!empty($data['brand']) && $brand = $this->brandRepository->findOneByField('name' , $data['brand'])){
$product['brand_id'] = $brand->id; // $product['brand_id'] = $brand->id;
} // }
//create product //create product
$parentProduct = $this->getModel()->create($product); $parentProduct = $this->getModel()->create($product);
$this->assignAttributes($parentProduct, [ $this->assignAttributes($parentProduct, [