active brands

This commit is contained in:
merdan 2022-04-12 13:50:55 +05:00
parent c640d7cf59
commit 4aaf2867c6
3 changed files with 12 additions and 7 deletions

View File

@ -140,7 +140,7 @@ return [
|
*/
'channel' => 'trendyol',
'channel' => 'default',
/*
|--------------------------------------------------------------------------

View File

@ -14,10 +14,7 @@ class IntegrationController extends Controller
{
public function __construct(protected ProductRepository $productRepository,
protected SellerRepository $sellerRepository)
{
}
protected SellerRepository $sellerRepository){}
public function store(){
if(!request()->has('product')){
@ -65,7 +62,7 @@ class IntegrationController extends Controller
{//product_group_id
return response()->json(['success'=>true,'product_id' => $product->id]);
}
elseif($product = $this->productRepository->create($data)){
elseif($product = $this->productRepository->createProduct($data)){
return response()->json(['success'=>true,'product_id' => $product->id]);
}else{
@ -87,6 +84,10 @@ class IntegrationController extends Controller
if(! $product = $this->productRepository->findOneByField('sku',$data['sku'])){
return response()->json(['success'=> false,'message' => 'product not found'],400);
}
if($this->productRepository->updateProduct($product,$data)){
return response()->json(['success'=>true,'product_id' => $product->id]);
}
}
}

View File

@ -267,7 +267,7 @@ class ProductRepository extends WProductRepository
return $results;
}
public function create($data){
public function createProduct($data){
$time_start = microtime(true);
$product['sku'] = $data['product_group_id'];
@ -440,6 +440,9 @@ class ProductRepository extends WProductRepository
}
public function updateProduct($product,$data){
}
/**
* Returns the all products of the seller
*
@ -600,6 +603,7 @@ class ProductRepository extends WProductRepository
]);
}
}
private function assignAttributes($product, $attributes){
foreach($attributes as $code => $value){
$attribute = $this->attributeRepository->findOneByField('code', $code);