Merge branch 'master' into google-captcha
This commit is contained in:
commit
8ca470f4ea
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -106,6 +106,11 @@
|
|||
<span v-else class="fs16">__</span>
|
||||
@break;
|
||||
|
||||
@case('multiselect')
|
||||
<span v-if="product.product['{{ $attribute['code'] }}']" v-html="getAttributeOptions(product['{{ $attribute['code'] }}'] ? product : product.product['{{ $attribute['code'] }}'] ? product.product : null, '{{ $attribute['code'] }}', 'multiple')" class="fs16"></span>
|
||||
<span v-else class="fs16">__</span>
|
||||
@break
|
||||
|
||||
@case ('file')
|
||||
@case ('image')
|
||||
<a :href="`${baseUrl}/${product.url_key}`" class="unset">
|
||||
|
|
|
|||
|
|
@ -116,6 +116,11 @@
|
|||
<span v-else class="fs16">__</span>
|
||||
@break;
|
||||
|
||||
@case('multiselect')
|
||||
<span v-if="product.product['{{ $attribute['code'] }}']" v-html="getAttributeOptions(product['{{ $attribute['code'] }}'] ? product : product.product['{{ $attribute['code'] }}'] ? product.product : null, '{{ $attribute['code'] }}', 'multiple')" class="fs16"></span>
|
||||
<span v-else class="fs16">__</span>
|
||||
@break
|
||||
|
||||
@case ('file')
|
||||
@case ('image')
|
||||
<a :href="`${$root.baseUrl}/${product.url_key}`" class="unset">
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue