diff --git a/config/app.php b/config/app.php index c1d823636..371b16a2b 100755 --- a/config/app.php +++ b/config/app.php @@ -140,7 +140,7 @@ return [ | */ - 'channel' => 'trendyol', + 'channel' => 'default', /* |-------------------------------------------------------------------------- diff --git a/packages/Sarga/API/Http/Controllers/IntegrationController.php b/packages/Sarga/API/Http/Controllers/IntegrationController.php index 36ca4c175..542be68de 100644 --- a/packages/Sarga/API/Http/Controllers/IntegrationController.php +++ b/packages/Sarga/API/Http/Controllers/IntegrationController.php @@ -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]); + } } } \ No newline at end of file diff --git a/packages/Sarga/Shop/src/Repositories/ProductRepository.php b/packages/Sarga/Shop/src/Repositories/ProductRepository.php index 6c676fbee..38533df4c 100644 --- a/packages/Sarga/Shop/src/Repositories/ProductRepository.php +++ b/packages/Sarga/Shop/src/Repositories/ProductRepository.php @@ -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);