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 9b0a89f72..76fa6ff6f 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
@@ -1,6 +1,10 @@
@php
$attributeRepository = app('\Webkul\Attribute\Repositories\AttributeRepository');
$comparableAttributes = $attributeRepository->findByField('is_comparable', 1);
+
+ $locale = request()->get('locale') ?: app()->getLocale();
+
+ $attributeOptionTranslations = DB::table(DB::getTablePrefix() . 'attribute_option_translations')->where('locale', $locale)->get()->toJson();
@endphp
@push('css')
@@ -116,7 +120,40 @@
@break;
- @endswitch
+ @default
+ @switch ($attribute['type'])
+ @case('boolean')
+
+ @break;
+ @case('file')
+
+
+ arrow_downward
+
+ __
+ @break;
+
+ @case('checkbox')
+
+ __
+ @break;
+
+ @case('select')
+
+ __
+ @break;
+ @default
+
+ @break;
+ @endswitch
+
+ @break
+
+ @endswitch
@endforeach
@@ -139,6 +176,7 @@
return {
'products': [],
'isProductListLoaded': false,
+ 'attributeOptions': JSON.parse(@json($attributeOptionTranslations)),
'isCustomer': '{{ auth()->guard('customer')->user() ? "true" : "false" }}' == "true",
}
},
@@ -231,6 +269,42 @@
this.$root.headerItemsCount++;
},
+
+ 'getAttributeOptions': function (productDetails, attributeValues, type) {
+ var attributeOptions = '__';
+
+ if (productDetails && attributeValues) {
+ var attributeItems;
+
+ if (type == "multiple") {
+ attributeItems = productDetails[attributeValues].split(',');
+ } else if (type == "single") {
+ attributeItems = productDetails[attributeValues];
+ }
+
+ attributeOptions = this.attributeOptions.filter(option => {
+ if (type == "multiple") {
+ if (attributeItems.indexOf(option.attribute_option_id.toString()) > -1) {
+ return true;
+ }
+ } else if (type == "single") {
+ if (attributeItems == option.attribute_option_id.toString()) {
+ return true;
+ }
+ }
+
+ return false;
+ });
+
+ attributeOptions = attributeOptions.map(option => {
+ return option.label;
+ });
+
+ attributeOptions = attributeOptions.join(', ');
+ }
+
+ return attributeOptions;
+ }
}
});