main screen categories and products
This commit is contained in:
parent
a88d02f7f0
commit
47a36585ca
|
|
@ -23,6 +23,7 @@ class ProductRepository extends WProductRepository
|
|||
protected $productFlatRepository;
|
||||
protected $attributeValueRepository;
|
||||
protected $imageRepository;
|
||||
protected $vendorProductRepository;
|
||||
protected $fillableTypes = ['sku', 'name', 'url_key', 'short_description', 'description', 'price', 'weight', 'status'];
|
||||
public function __construct(AttributeRepository $attributeRepository,
|
||||
App $app,
|
||||
|
|
@ -30,6 +31,7 @@ class ProductRepository extends WProductRepository
|
|||
ProductFlatRepository $productFlatRepository,
|
||||
ProductAttributeValueRepository $productAttributeValueRepository,
|
||||
ProductImageRepository $productImageRepository,
|
||||
VendorProductRepository $vendorProductRepository,
|
||||
AttributeOptionRepository $optionRepository)
|
||||
{
|
||||
$this->attributeGroupRepo = $attributeGroupRepo;
|
||||
|
|
@ -37,6 +39,7 @@ class ProductRepository extends WProductRepository
|
|||
$this->attributeValueRepository = $productAttributeValueRepository;
|
||||
$this->productFlatRepository = $productFlatRepository;
|
||||
$this->imageRepository = $productImageRepository;
|
||||
$this->vendorProductRepository = $vendorProductRepository;
|
||||
parent::__construct($attributeRepository, $app);
|
||||
}
|
||||
|
||||
|
|
@ -282,8 +285,7 @@ class ProductRepository extends WProductRepository
|
|||
public function createSellerProduct($product, $seller_id){
|
||||
Event::dispatch('marketplace.catalog.product.create.before');
|
||||
|
||||
|
||||
$sellerProduct = parent::create([
|
||||
$sellerProduct = $this->vendorProductRepository->create([
|
||||
'marketplace_seller_id' => $seller_id,
|
||||
'is_approved' => 1,
|
||||
'condition' => 'new',
|
||||
|
|
@ -293,7 +295,7 @@ class ProductRepository extends WProductRepository
|
|||
]);
|
||||
|
||||
foreach ($sellerProduct->product->variants as $baseVariant) {
|
||||
parent::create([
|
||||
$this->vendorProductRepository->create([
|
||||
'parent_id' => $sellerProduct->id,
|
||||
'product_id' => $baseVariant->id,
|
||||
'is_owner' => 1,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
namespace Sarga\API\Repositories;
|
||||
|
||||
use Illuminate\Container\Container as App;
|
||||
use Webkul\Core\Eloquent\Repository;
|
||||
class VendorProductRepository extends Repository
|
||||
{
|
||||
|
||||
public function __construct(
|
||||
App $app
|
||||
){
|
||||
parent::__construct($app);
|
||||
}
|
||||
public function model()
|
||||
{
|
||||
return 'Webkul\Marketplace\Contracts\Product';
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue