diff --git a/packages/Webkul/Product/src/Listeners/ProductFlat.php b/packages/Webkul/Product/src/Listeners/ProductFlat.php index 340255db0..090763211 100644 --- a/packages/Webkul/Product/src/Listeners/ProductFlat.php +++ b/packages/Webkul/Product/src/Listeners/ProductFlat.php @@ -137,7 +137,7 @@ class ProductFlat } }); - $this->productFlatRepository->updateAttributeColumn( $attribute ); + $this->productFlatRepository->updateAttributeColumn( $attribute , $this ); } } diff --git a/packages/Webkul/Product/src/Repositories/ProductFlatRepository.php b/packages/Webkul/Product/src/Repositories/ProductFlatRepository.php index d49a7efea..2f33f4a82 100644 --- a/packages/Webkul/Product/src/Repositories/ProductFlatRepository.php +++ b/packages/Webkul/Product/src/Repositories/ProductFlatRepository.php @@ -92,13 +92,16 @@ class ProductFlatRepository extends Repository * update product_flat custom column * * @param \Webkul\Attribute\Models\Attribute $attribute + * @param \Webkul\Product\Listeners\ProductFlat $listener */ - public function updateAttributeColumn( \Webkul\Attribute\Models\Attribute $attribute ) { + public function updateAttributeColumn( + \Webkul\Attribute\Models\Attribute $attribute , + \Webkul\Product\Listeners\ProductFlat $listener ) { return $this->model ->leftJoin('product_attribute_values as v', function($join) use ($attribute) { $join->on('product_flat.id', '=', 'v.product_id') ->on('v.attribute_id', '=', \DB::raw($attribute->id)); - })->update(['product_flat.'.$attribute->code => \DB::raw($attribute->type .'_value')]); + })->update(['product_flat.'.$attribute->code => \DB::raw($listener->attributeTypeFields[$attribute->type] .'_value')]); } } \ No newline at end of file