diff --git a/packages/Webkul/Product/src/Models/ProductAttributeValue.php b/packages/Webkul/Product/src/Models/ProductAttributeValue.php index 562fc07b3..615baf5e5 100755 --- a/packages/Webkul/Product/src/Models/ProductAttributeValue.php +++ b/packages/Webkul/Product/src/Models/ProductAttributeValue.php @@ -4,14 +4,20 @@ namespace Webkul\Product\Models; use Illuminate\Database\Eloquent\Model; use Webkul\Attribute\Models\AttributeProxy; -use Webkul\Channel\Models\ChannelProxy; use Webkul\Product\Contracts\ProductAttributeValue as ProductAttributeValueContract; class ProductAttributeValue extends Model implements ProductAttributeValueContract { + /** + * Indicates if the model should be timestamped. + * + * @var bool + */ public $timestamps = false; /** + * Attribute type fields. + * * @var array */ public static $attributeTypeFields = [ @@ -28,10 +34,14 @@ class ProductAttributeValue extends Model implements ProductAttributeValueContra 'checkbox' => 'text_value', ]; + /** + * The attributes that are mass assignable. + * + * @var array + */ protected $fillable = [ 'product_id', 'attribute_id', - 'channel_id', 'locale', 'channel', 'text_value', @@ -58,12 +68,4 @@ class ProductAttributeValue extends Model implements ProductAttributeValueContra { return $this->belongsTo(ProductProxy::modelClass()); } - - /** - * Get the channel that owns the attribute value. - */ - public function channel() - { - return $this->belongsTo(ChannelProxy::modelClass()); - } -} \ No newline at end of file +} diff --git a/packages/Webkul/Product/src/Repositories/ProductRepository.php b/packages/Webkul/Product/src/Repositories/ProductRepository.php index c591bed5d..d64fd490b 100755 --- a/packages/Webkul/Product/src/Repositories/ProductRepository.php +++ b/packages/Webkul/Product/src/Repositories/ProductRepository.php @@ -466,17 +466,19 @@ class ProductRepository extends Repository } else { $results = app(ProductFlatRepository::class)->scopeQuery(function ($query) use ($term, $channel, $locale) { + $query = $query->distinct() + ->addSelect('product_flat.*') + ->join('product_flat as variants', 'product_flat.id', '=', DB::raw('COALESCE(' . DB::getTablePrefix() . 'variants.parent_id, ' . DB::getTablePrefix() . 'variants.id)')) + ->where('product_flat.channel', $channel) + ->where('product_flat.locale', $locale) + ->whereNotNull('product_flat.url_key'); + if (! core()->getConfigData('catalog.products.homepage.out_of_stock_items')) { $query = $this->checkOutOfStockItem($query); } - return $query->distinct() - ->addSelect('product_flat.*') - ->where('product_flat.status', 1) + return $query->where('product_flat.status', 1) ->where('product_flat.visible_individually', 1) - ->where('product_flat.channel', $channel) - ->where('product_flat.locale', $locale) - ->whereNotNull('product_flat.url_key') ->where(function ($subQuery) use ($term) { $queries = explode('_', $term); diff --git a/packages/Webkul/Shop/src/Resources/views/guest/compare/compare-products.blade.php b/packages/Webkul/Shop/src/Resources/views/guest/compare/compare-products.blade.php index f3bfe154f..31eadd4f1 100644 --- a/packages/Webkul/Shop/src/Resources/views/guest/compare/compare-products.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/guest/compare/compare-products.blade.php @@ -106,6 +106,11 @@ __ @break; + @case('multiselect') + + __ + @break + @case ('file') @case ('image') diff --git a/packages/Webkul/Velocity/src/Resources/views/shop/guest/compare/compare-products.blade.php b/packages/Webkul/Velocity/src/Resources/views/shop/guest/compare/compare-products.blade.php index 3d4ce5fde..e72e090bf 100644 --- a/packages/Webkul/Velocity/src/Resources/views/shop/guest/compare/compare-products.blade.php +++ b/packages/Webkul/Velocity/src/Resources/views/shop/guest/compare/compare-products.blade.php @@ -116,6 +116,11 @@ __ @break; + @case('multiselect') + + __ + @break + @case ('file') @case ('image') @@ -215,7 +220,7 @@ } else { this.$set(this, 'products', this.products.filter(product => product.id != productId)); } - + this.$root.headerItemsCount++; window.showAlert(`alert-${response.data.status}`, response.data.label, response.data.message);