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