Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

Improve QuickView with product attributes (#184)

Krzysztof Pajakeb87948e8c63
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/_CreateOrUpdate.AssociatedProducts.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/_CreateOrUpdate.AssociatedProducts.cshtml
index b220250cc..da261c3ed 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/_CreateOrUpdate.AssociatedProducts.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/_CreateOrUpdate.AssociatedProducts.cshtml
@@ -117,7 +117,7 @@
name: "destroy",
text: "@Loc["Admin.Common.Delete"]"
}],
- width: 200
+ width: 300
}]
});
});
diff --git a/src/Web/Grand.Web.Common/TagHelpers/IResourceManager.cs b/src/Web/Grand.Web.Common/TagHelpers/IResourceManager.cs
index ba98fb9a3..587536c60 100644
--- a/src/Web/Grand.Web.Common/TagHelpers/IResourceManager.cs
+++ b/src/Web/Grand.Web.Common/TagHelpers/IResourceManager.cs
@@ -24,10 +24,10 @@ namespace Grand.Web.Common.TagHelpers
void RegisterFootScript(IHtmlContent script, int order);
/// <summary>
- /// Registers a custom template tag.
+ /// Registers a custom template tag in the head/footer.
/// </summary>
/// <param name="script"></param>
- void RegisterTemplate(IHtmlContent script);
+ void RegisterTemplate(IHtmlContent script, bool head);
/// <summary>
/// Returns the registered head script resources.
@@ -67,7 +67,7 @@ namespace Grand.Web.Common.TagHelpers
/// <summary>
/// Renders the registered template tags.
/// </summary>
- void RenderTemplate(IHtmlContentBuilder builder);
+ void RenderTemplate(IHtmlContentBuilder builder, bool head);
/// <summary>
/// Registers a link tag.
diff --git a/src/Web/Grand.Web.Common/TagHelpers/ResourceManager.cs b/src/Web/Grand.Web.Common/TagHelpers/ResourceManager.cs
index ef1f60a11..91798881c 100644
--- a/src/Web/Grand.Web.Common/TagHelpers/ResourceManager.cs
+++ b/src/Web/Grand.Web.Common/TagHelpers/ResourceManager.cs
@@ -11,7 +11,8 @@ namespace Grand.Web.Common.TagHelpers
private List<(IHtmlContent content, int order)> _headScripts;
private List<(IHtmlContent content, int order)> _headerScripts;
private List<(IHtmlContent content, int order)> _footScripts;
- private List<IHtmlContent> _templates;
+ private List<IHtmlContent> _templatesHeader;
+ private List<IHtmlContent> _templatesFooter;
private List<LinkEntry> _links;
public ResourceManager()
@@ -34,9 +35,13 @@ namespace Grand.Web.Common.TagHelpers
{
return _footScripts.OrderBy(x => x.order).Select(x => x.content);
}
- public IEnumerable<IHtmlContent> GetRegisteredTemplates()
+ public IEnumerable<IHtmlContent> GetRegisteredTemplatesHeader()
{
- return _templates == null ? Enumerable.Empty<IHtmlContent>() : _templates;
+ return _templatesHeader == null ? Enumerable.Empty<IHtmlContent>() : _templatesHeader;
+ }
+ public IEnumerable<IHtmlContent> GetRegisteredTemplatesFooter()
+ {
+ return _templatesFooter == null ? Enumerable.Empty<IHtmlContent>() : _templatesFooter;
}
public void RegisterHeadScript(IHtmlContent script, int order)
@@ -52,14 +57,23 @@ namespace Grand.Web.Common.TagHelpers
{
_footScripts.Add((script, order));
}
- public void RegisterTemplate(IHtmlContent script)
+
+ public void RegisterTemplate(IHtmlContent script, bool head)
{
- if (_templates == null)
+ if (head)
{
- _templates = new List<IHtmlContent>();
+ if (_templatesHeader == null)
+ _templatesHeader = new List<IHtmlContent>();
+
+ _templatesHeader.Add(script);
}
+ else
+ {
+ if (_templatesFooter == null)
+ _templatesFooter = new List<IHtmlContent>();
- _templates.Add(script);
+ _templatesFooter.Add(script);
+ }
}
/// <summary>
/// Renders the registered head script tags.
@@ -131,10 +145,11 @@ namespace Grand.Web.Common.TagHelpers
builder.AppendHtml(link.GetTag());
}
}
- public void RenderTemplate(IHtmlContentBuilder builder)
+ public void RenderTemplate(IHtmlContentBuilder builder, bool head)
{
var first = true;
- foreach (var context in GetRegisteredTemplates())
+ var templates = head ? GetRegisteredTemplatesHeader() : GetRegisteredTemplatesFooter();
+ foreach (var context in templates)
{
if (!first)
{
diff --git a/src/Web/Grand.Web.Common/TagHelpers/ResourceType.cs b/src/Web/Grand.Web.Common/TagHelpers/ResourceType.cs
index cf178883f..390493244 100644
--- a/src/Web/Grand.Web.Common/TagHelpers/ResourceType.cs
+++ b/src/Web/Grand.Web.Common/TagHelpers/ResourceType.cs
@@ -7,6 +7,7 @@ namespace Grand.Web.Common.TagHelpers
HeadScript,
ScriptHeader,
ScriptFooter,
- TemplateHeader
+ TemplateHeader,
+ TemplateFooter
}
}
diff --git a/src/Web/Grand.Web.Common/TagHelpers/ResourcesTagHelper.cs b/src/Web/Grand.Web.Common/TagHelpers/ResourcesTagHelper.cs
index 6db243fed..4174487c9 100644
--- a/src/Web/Grand.Web.Common/TagHelpers/ResourcesTagHelper.cs
+++ b/src/Web/Grand.Web.Common/TagHelpers/ResourcesTagHelper.cs
@@ -38,7 +38,11 @@ namespace Grand.Web.Common.TagHelpers
break;
case ResourceType.TemplateHeader:
- _resourceManager.RenderTemplate(output.Content);
+ _resourceManager.RenderTemplate(output.Content, true);
+ break;
+
+ case ResourceType.TemplateFooter:
+ _resourceManager.RenderTemplate(output.Content, false);
break;
default:
diff --git a/src/Web/Grand.Web.Common/TagHelpers/TemplateTagHelper.cs b/src/Web/Grand.Web.Common/TagHelpers/TemplateTagHelper.cs
index bd9450d93..266aaf23a 100644
--- a/src/Web/Grand.Web.Common/TagHelpers/TemplateTagHelper.cs
+++ b/src/Web/Grand.Web.Common/TagHelpers/TemplateTagHelper.cs
@@ -6,14 +6,20 @@ using Microsoft.AspNetCore.Razor.TagHelpers;
namespace Grand.Web.Common.TagHelpers
{
- [HtmlTargetElement("template", Attributes = AttributeName)]
+ [HtmlTargetElement("template", Attributes = AttributeNameHeader)]
+ [HtmlTargetElement("template", Attributes = AttributeNameFooter)]
public class TemplateTagHelper : TagHelper
{
- private const string AttributeName = "asp-header";
+ private const string AttributeNameHeader = "asp-header";
- [HtmlAttributeName(AttributeName)]
+ private const string AttributeNameFooter = "asp-footer";
+
+ [HtmlAttributeName(AttributeNameHeader)]
public bool Header { get; set; }
+ [HtmlAttributeName(AttributeNameFooter)]
+ public bool Footer { get; set; }
+
private readonly IResourceManager _resourceManager;
private readonly IHttpContextAccessor _httpContextAccessor;
@@ -39,10 +45,15 @@ namespace Grand.Web.Common.TagHelpers
builder.Attributes.Add(attribute.Name, attribute.Value.ToString());
}
- if (Header)
+ if (Header && !Footer)
{
- _resourceManager.RegisterTemplate(builder);
+ _resourceManager.RegisterTemplate(builder, true);
}
+ if (!Header && Footer)
+ {
+ _resourceManager.RegisterTemplate(builder, false);
+ }
+
}
}
diff --git a/src/Web/Grand.Web/Views/Shared/QuickView/_Attributes.cshtml b/src/Web/Grand.Web/Views/Shared/QuickView/_Attributes.cshtml
index d5f003ee7..88e5c2a78 100644
--- a/src/Web/Grand.Web/Views/Shared/QuickView/_Attributes.cshtml
+++ b/src/Web/Grand.Web/Views/Shared/QuickView/_Attributes.cshtml
@@ -1,165 +1,169 @@
@{
var fileLink = @Url.RouteUrl("UploadFileProductAttribute");
}
-<td :id="'product_attribute_label_' + attribute.Id">
- <span class="attribute-name">{{attribute.Name}}</span> <span v-if="attribute.IsRequired" class="required">*</span>
- <template v-if="attribute.TextPrompt !==null">
- <span class="text-prompt">{{attribute.TextPrompt}}</span>
- </template>
- <template v-if="attribute.Description !==null">
- <span v-html="attribute.Description" class="attribute-description"></span>
- </template>
-</td>
-<td :id="'product_attribute_input_' + attribute.Id">
- <template v-if="attribute.AttributeControlType==4">
- <label :for="'product_attribute_' + attribute.Id" class="sr-only">product_attribute_{{attribute.Id}}</label>
- <input :name="'product_attribute_' + attribute.Id" type="text" class="form-control textbox" :id="'product_attribute_' + attribute.Id" :value="attribute.DefaultValue" @@change="vm.attrchange(attribute.ProductId, true)" />
- </template>
- <template v-if="attribute.AttributeControlType==1">
- <label :for="'product_attribute_' + attribute.Id" class="sr-only">product_attribute_{{attribute.Id}}</label>
- <select :id="'product_attribute_' + attribute.Id" class="form-control custom-select" :name="'product_attribute_' + attribute.Id" @@change="vm.attrchange(attribute.ProductId, true)">
- <template v-if="attribute.IsRequired==false">
- <option value="">---</option>
+<template id="product-attribute-quickview" asp-footer="true">
+ <tr>
+ <td :id="'product_attribute_label_' + attribute.Id">
+ <span class="attribute-name">{{attribute.Name}}</span> <span v-if="attribute.IsRequired" class="required">*</span>
+ <template v-if="attribute.TextPrompt !==null">
+ <span class="text-prompt">{{attribute.TextPrompt}}</span>
</template>
- <option v-for="attributeValue in attribute.Values" :selected="attributeValue.IsPreSelected" :data-disable="attributeValue.Id" :value="attributeValue.Id">
- <template v-if="attributeValue.PriceAdjustment==null">
- {{attributeValue.Name}}
- </template>
- <template v-else>
- {{attributeValue.Name}}[{{attributeValue.PriceAdjustment}}]
- </template>
- </option>
- </select>
- </template>
- <template v-if="attribute.AttributeControlType==2">
- <ul class="option-list px-0 mb-0">
- <li v-for="attributeValue in attribute.Values">
+ <template v-if="attribute.Description !==null">
+ <span v-html="attribute.Description" class="attribute-description"></span>
+ </template>
+ </td>
+ <td :id="'product_attribute_input_' + attribute.Id">
+ <template v-if="attribute.AttributeControlType==4">
+ <label :for="'product_attribute_' + attribute.Id" class="sr-only">product_attribute_{{attribute.Id}}</label>
+ <input :name="'product_attribute_' + attribute.Id" type="text" class="form-control textbox" :id="'product_attribute_' + attribute.Id" :value="attribute.DefaultValue" @@change="vm.attrchange(attribute.ProductId, true)" />
+ </template>
+ <template v-if="attribute.AttributeControlType==1">
+ <label :for="'product_attribute_' + attribute.Id" class="sr-only">product_attribute_{{attribute.Id}}</label>
+ <select :id="'product_attribute_' + attribute.Id" class="form-control custom-select" :name="'product_attribute_' + attribute.Id" @@change="vm.attrchange(attribute.ProductId, true)">
+ <template v-if="attribute.IsRequired==false">
+ <option value="">---</option>
+ </template>
+ <option v-for="attributeValue in attribute.Values" :selected="attributeValue.IsPreSelected" :data-disable="attributeValue.Id" :value="attributeValue.Id">
+ <template v-if="attributeValue.PriceAdjustment==null">
+ {{attributeValue.Name}}
+ </template>
+ <template v-else>
+ {{attributeValue.Name}}[{{attributeValue.PriceAdjustment}}]
+ </template>
+ </option>
+ </select>
+ </template>
+ <template v-if="attribute.AttributeControlType==2">
+ <ul class="option-list px-0 mb-0">
+ <li v-for="attributeValue in attribute.Values">
+ <fieldset>
+ <legend class="sr-only">product_attribute_{{attribute.Id}}</legend>
+ <label class="custom-control custom-radio">
+ <input class="custom-control-input"
+ :id="'product_attribute_' + attribute.Id + '_' + attributeValue.Id"
+ type="radio"
+ :name="'product_attribute_' + attribute.Id"
+ :value="attributeValue.Id"
+ :checked="attributeValue.IsPreSelected"
+ :data-disable="attributeValue.Id"
+ @@change="vm.attrchange(attribute.ProductId, true)" />
+ <span class="custom-control-label"></span>
+ <span class="custom-control-description" :for="'product_attribute_' + attribute.Id + '_' + attributeValue.Id">
+ <template v-if="attributeValue.PriceAdjustment==null">
+ {{attributeValue.Name}}
+ </template>
+ <template v-else>
+ {{attributeValue.Name}}[{{attributeValue.PriceAdjustment}}]
+ </template>
+ </span>
+ </label>
+ </fieldset>
+ </li>
+ </ul>
+ </template>
+ <template v-if="attribute.AttributeControlType==3 || attribute.AttributeControlType==50">
<fieldset>
- <legend class="sr-only">product_attribute_{{attribute.Id}}</legend>
- <label class="custom-control custom-radio">
- <input class="custom-control-input"
- :id="'product_attribute_' + attribute.Id + '_' + attributeValue.Id"
- type="radio"
- :name="'product_attribute_' + attribute.Id"
- :value="attributeValue.Id"
- :checked="attributeValue.IsPreSelected"
- :data-disable="attributeValue.Id"
- @@change="vm.attrchange(attribute.ProductId, true)" />
- <span class="custom-control-label"></span>
- <span class="custom-control-description" :for="'product_attribute_' + attribute.Id + '_' + attributeValue.Id">
+ <legend></legend>
+ <ul class="option-list px-0 mb-0">
+ <li v-for="attributeValue in attribute.Values">
+ <label class="custom-control custom-checkbox">
+ <input v-if="attribute.AttributeControlType==50"
+ class="custom-control-input"
+ :id="'product_attribute_' + attribute.Id + '_' + attributeValue.Id"
+ type="checkbox"
+ :name="'product_attribute_' + attribute.Id"
+ :value="attributeValue.Id"
+ :checked="attributeValue.IsPreSelected"
+ @@change="vm.attrchange(attribute.ProductId, true)"
+ disabled="disabled" />
+ <input v-else
+ class="custom-control-input"
+ :id="'product_attribute_' + attribute.Id + '_' + attributeValue.Id"
+ type="checkbox"
+ :name="'product_attribute_' + attribute.Id"
+ :value="attributeValue.Id"
+ :checked="attributeValue.IsPreSelected"
+ :data-disable="attributeValue.Id"
+ @@change="vm.attrchange(attribute.ProductId, true)" />
+ <span class="custom-control-label"></span>
+ <span class="custom-control-description" :for="'product_attribute_' + attribute.Id + '_' + attributeValue.Id">
+ <template v-if="attributeValue.PriceAdjustment==null">
+ {{attributeValue.Name}}
+ </template>
+ <template v-else>
+ {{attributeValue.Name}}[{{attributeValue.PriceAdjustment}}]
+ </template>
+ </span>
+ </label>
+ </li>
+ </ul>
+ </fieldset>
+ </template>
+ <template v-if="attribute.AttributeControlType==10">
+ <textarea :id="'product_attribute_' + attribute.Id" :name="'product_attribute_' + attribute.Id">{{attribute.DefaultValue}}</textarea>
+ </template>
+ <template v-if="attribute.AttributeControlType==30">
+ <template>
+ <div :id="'product_attribute_' + attribute.Id + 'uploader'">
+ <b-form-file :accept="attribute.AllowedFileExtensions"
+ type="file"
+ id="qqfile"
+ name="qqfile"
+ :data-url="'@fileLink/' + attribute.Id + '?productId=' + attribute.ProductId"
+ @@change="vm.uploadFile($event.target)" />
+ </div>
+ </template>
+ <input class="hidden-upload-input"
+ type="hidden"
+ :id="'product_attribute_' + attribute.Id"
+ :name="'product_attribute_' + attribute.Id"
+ v-model="attribute.DefaultValue"
+ :value="attribute.DefaultValue" />
+ <div id="download-message" class="alert my-2" style="display: none;"></div>
+ <div :id="'product_attribute_' + attribute.Id + 'downloadurl'" class="download-file" style="display: none;"><a class="btn btn-outline-info"> Download </a></div>
+ </template>
+ <template v-if="attribute.AttributeControlType==40">
+ <ul class="option-list color-squares w-100 d-inline-flex flex-wrap px-0 mb-0" :id="'color-squares-' + attribute.Id">
+ <li v-for="attributeValue in attribute.Values" class="mr-1 p-0">
+ <label :for="'product_attribute_' + attribute.Id + '_' + attributeValue.Id" class="mb-0">
+ <input :id="'product_attribute_' + attribute.Id + '_' + attributeValue.Id" type="radio" :name="'product_attribute_' + attribute.Id" :value="attributeValue.Id" :data-disable="attributeValue.Id" :checked="attributeValue.IsPreSelected" @@change="vm.attrchange(attribute.ProductId, true)" />
<template v-if="attributeValue.PriceAdjustment==null">
- {{attributeValue.Name}}
+ <span class="color-container" :title="attributeValue.Name"> <span class="color" :style="'background-color:' + attributeValue.ColorSquaresRgb"></span> </span>
</template>
<template v-else>
- {{attributeValue.Name}}[{{attributeValue.PriceAdjustment}}]
+ <span class="color-container" :title="attributeValue.Name + ' [' + attributeValue.PriceAdjustment + ']'"> <span class="color" :style="'background-color:' + attributeValue.ColorSquaresRgb"></span> </span>
</template>
- </span>
- </label>
- </fieldset>
- </li>
- </ul>
- </template>
- <template v-if="attribute.AttributeControlType==3 || attribute.AttributeControlType==50">
- <fieldset>
- <legend></legend>
- <ul class="option-list px-0 mb-0">
- <li v-for="attributeValue in attribute.Values">
- <label class="custom-control custom-checkbox">
- <input v-if="attribute.AttributeControlType==50"
- class="custom-control-input"
- :id="'product_attribute_' + attribute.Id + '_' + attributeValue.Id"
- type="checkbox"
- :name="'product_attribute_' + attribute.Id"
- :value="attributeValue.Id"
- :checked="attributeValue.IsPreSelected"
- @@change="vm.attrchange(attribute.ProductId, true)"
- disabled="disabled" />
- <input v-else
- class="custom-control-input"
- :id="'product_attribute_' + attribute.Id + '_' + attributeValue.Id"
- type="checkbox"
- :name="'product_attribute_' + attribute.Id"
- :value="attributeValue.Id"
- :checked="attributeValue.IsPreSelected"
- :data-disable="attributeValue.Id"
- @@change="vm.attrchange(attribute.ProductId, true)" />
- <span class="custom-control-label"></span>
- <span class="custom-control-description" :for="'product_attribute_' + attribute.Id + '_' + attributeValue.Id">
+ </label>
+ </li>
+ </ul>
+ </template>
+ <template v-if="attribute.AttributeControlType==45">
+ <ul class="option-list color-squares w-100 d-inline-flex flex-wrap px-0 mb-0" :id="'color-squares-' + attribute.Id">
+ <li v-for="attributeValue in attribute.Values" class="mr-1 p-0">
+ <label :for="'product_attribute_' + attribute.Id + '_' + attributeValue.Id" class="mb-0">
<template v-if="attributeValue.PriceAdjustment==null">
- {{attributeValue.Name}}
+ <input :id="'product_attribute_' + attribute.Id + '_' + attributeValue.Id" type="radio" :name="'product_attribute_' + attribute.Id" :value="attributeValue.Id" :checked="attributeValue.IsPreSelected" :data-disable="attributeValue.Id" @@change="vm.attrchange(attribute.ProductId, true)" />
+ <span :id="'imgSqr_' + attributeValue.Id" class="color-container">
+ <span class="color" :style="'background: url(' + attributeValue.ImageSquaresPictureModel.ImageUrl + ') 50% 50% no-repeat;'"></span>
+ </span>
+ <b-tooltip :target="'imgSqr_' + attributeValue.Id" placement="bottom">
+ <div class="image-square-tooltip"><img :src="attributeValue.ImageSquaresPictureModel.FullSizeImageUrl" :alt="attributeValue.Name" /> <span>{{attributeValue.Name}}</span></div>
+ </b-tooltip>
</template>
<template v-else>
- {{attributeValue.Name}}[{{attributeValue.PriceAdjustment}}]
+ <input :id="'product_attribute_' + attribute.Id + '_' + attributeValue.Id" type="radio" :name="'product_attribute_' + attribute.Id" :value="attributeValue.Id" :checked="attributeValue.IsPreSelected" :data-disable="attributeValue.Id" @@change="vm.attrchange(attribute.ProductId, true)" />
+ <span class="color-container"> <span class="color" :style="'background: url(' + attributeValue.ImageSquaresPictureModel.ImageUrl + ') 50% 50% no-repeat;'"></span> </span>
+ <b-tooltip :target="'imgSqr_' + attributeValue.Id" placement="bottom">
+ <div class="image-square-tooltip">
+ <img :src="attributeValue.ImageSquaresPictureModel.FullSizeImageUrl" :alt="attributeValue.Name + ' [' + attributeValue.PriceAdjustment + ']'" />
+ <span>{{attributeValue.Name}}[{{attributeValue.PriceAdjustment}}]</span>
+ </div>
+ </b-tooltip>
</template>
- </span>
- </label>
- </li>
- </ul>
- </fieldset>
- </template>
- <template v-if="attribute.AttributeControlType==10">
- <textarea :id="'product_attribute_' + attribute.Id" :name="'product_attribute_' + attribute.Id">{{attribute.DefaultValue}}</textarea>
- </template>
- <template v-if="attribute.AttributeControlType==30">
- <template>
- <div :id="'product_attribute_' + attribute.Id + 'uploader'">
- <b-form-file :accept="attribute.AllowedFileExtensions"
- type="file"
- id="qqfile"
- name="qqfile"
- :data-url="'@fileLink/' + attribute.Id + '?productId=' + attribute.ProductId"
- @@change="vm.uploadFile($event.target)" />
- </div>
- </template>
- <input class="hidden-upload-input"
- type="hidden"
- :id="'product_attribute_' + attribute.Id"
- :name="'product_attribute_' + attribute.Id"
- v-model="attribute.DefaultValue"
- :value="attribute.DefaultValue" />
- <div id="download-message" class="alert my-2" style="display: none;"></div>
- <div :id="'product_attribute_' + attribute.Id + 'downloadurl'" class="download-file" style="display: none;"><a class="btn btn-outline-info"> Download </a></div>
- </template>
- <template v-if="attribute.AttributeControlType==40">
- <ul class="option-list color-squares w-100 d-inline-flex flex-wrap px-0 mb-0" :id="'color-squares-' + attribute.Id">
- <li v-for="attributeValue in attribute.Values" class="mr-1 p-0">
- <label :for="'product_attribute_' + attribute.Id + '_' + attributeValue.Id" class="mb-0">
- <input :id="'product_attribute_' + attribute.Id + '_' + attributeValue.Id" type="radio" :name="'product_attribute_' + attribute.Id" :value="attributeValue.Id" :data-disable="attributeValue.Id" :checked="attributeValue.IsPreSelected" @@change="vm.attrchange(attribute.ProductId, true)" />
- <template v-if="attributeValue.PriceAdjustment==null">
- <span class="color-container" :title="attributeValue.Name"> <span class="color" :style="'background-color:' + attributeValue.ColorSquaresRgb"></span> </span>
- </template>
- <template v-else>
- <span class="color-container" :title="attributeValue.Name + ' [' + attributeValue.PriceAdjustment + ']'"> <span class="color" :style="'background-color:' + attributeValue.ColorSquaresRgb"></span> </span>
- </template>
- </label>
- </li>
- </ul>
- </template>
- <template v-if="attribute.AttributeControlType==45">
- <ul class="option-list color-squares w-100 d-inline-flex flex-wrap px-0 mb-0" :id="'color-squares-' + attribute.Id">
- <li v-for="attributeValue in attribute.Values" class="mr-1 p-0">
- <label :for="'product_attribute_' + attribute.Id + '_' + attributeValue.Id" class="mb-0">
- <template v-if="attributeValue.PriceAdjustment==null">
- <input :id="'product_attribute_' + attribute.Id + '_' + attributeValue.Id" type="radio" :name="'product_attribute_' + attribute.Id" :value="attributeValue.Id" :checked="attributeValue.IsPreSelected" :data-disable="attributeValue.Id" @@change="vm.attrchange(attribute.ProductId, true)" />
- <span :id="'imgSqr_' + attributeValue.Id" class="color-container">
- <span class="color" :style="'background: url(' + attributeValue.ImageSquaresPictureModel.ImageUrl + ') 50% 50% no-repeat;'"></span>
- </span>
- <b-tooltip :target="'imgSqr_' + attributeValue.Id" placement="bottom">
- <div class="image-square-tooltip"><img :src="attributeValue.ImageSquaresPictureModel.FullSizeImageUrl" :alt="attributeValue.Name" /> <span>{{attributeValue.Name}}</span></div>
- </b-tooltip>
- </template>
- <template v-else>
- <input :id="'product_attribute_' + attribute.Id + '_' + attributeValue.Id" type="radio" :name="'product_attribute_' + attribute.Id" :value="attributeValue.Id" :checked="attributeValue.IsPreSelected" :data-disable="attributeValue.Id" @@change="vm.attrchange(attribute.ProductId, true)" />
- <span class="color-container"> <span class="color" :style="'background: url(' + attributeValue.ImageSquaresPictureModel.ImageUrl + ') 50% 50% no-repeat;'"></span> </span>
- <b-tooltip :target="'imgSqr_' + attributeValue.Id" placement="bottom">
- <div class="image-square-tooltip">
- <img :src="attributeValue.ImageSquaresPictureModel.FullSizeImageUrl" :alt="attributeValue.Name + ' [' + attributeValue.PriceAdjustment + ']'" />
- <span>{{attributeValue.Name}}[{{attributeValue.PriceAdjustment}}]</span>
- </div>
- </b-tooltip>
- </template>
- </label>
- </li>
- </ul>
- </template>
-</td>
\ No newline at end of file
+ </label>
+ </li>
+ </ul>
+ </template>
+ </td>
+ </tr>
+</template>
diff --git a/src/Web/Grand.Web/Views/Shared/QuickView/_PricesGroup.cshtml b/src/Web/Grand.Web/Views/Shared/QuickView/_PricesGroup.cshtml
index 02af491b9..1f46c3633 100644
--- a/src/Web/Grand.Web/Views/Shared/QuickView/_PricesGroup.cshtml
+++ b/src/Web/Grand.Web/Views/Shared/QuickView/_PricesGroup.cshtml
@@ -1,84 +1,84 @@
<template>
<div class="prices d-flex justify-content-center align-items-start flex-column" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
- <template v-if="PopupQuickViewVueModal.ProductPrice.EnteredPrice">
+ <template v-if="variant.ProductPrice.EnteredPrice">
@*Display empty space*@
</template>
- <template v-else-if="PopupQuickViewVueModal.ProductPrice.CallForPrice">
+ <template v-else-if="variant.ProductPrice.CallForPrice">
<div class="product-price call-for-price col-12 px-0">
<span>@Loc["Products.CallForPrice"]</span>
</div>
</template>
<template v-else>
- <template v-if="PopupQuickViewVueModal.ProductPrice.IsReservation">
+ <template v-if="variant.ProductPrice.IsReservation">
<div class="rental-price mb-2">
<label class="mb-0">@Loc["Products.Price.ReservationPrice"]:</label>
- <span>{{PopupQuickViewVueModal.ProductPrice.ReservationPrice}}</span>
+ <span>{{variant.ProductPrice.ReservationPrice}}</span>
</div>
</template>
- <template v-if="PopupQuickViewVueModal.ProductPrice.IsAuction">
+ <template v-if="variant.ProductPrice.IsAuction">
<div class="actual-price">
- <template v-if="PopupQuickViewVueModal.ProductPrice.HighestBidValue > 0">
+ <template v-if="variant.ProductPrice.HighestBidValue > 0">
<label class="mb-0">@Loc["Products.Price.CurrentPrice"]:</label>
- <span>{{PopupQuickViewVueModal.ProductPrice.HighestBid}}</span>
+ <span>{{variant.ProductPrice.HighestBid}}</span>
</template>
<template v-else>
<label class="mb-0">@Loc["Products.Price.StartPrice"]:</label>
- <span>{{PopupQuickViewVueModal.ProductPrice.StartPrice}}</span>
+ <span>{{variant.ProductPrice.StartPrice}}</span>
</template>
</div>
</template>
- <template v-if="PopupQuickViewVueModal.ProductPrice.CatalogPrice !== null">
+ <template v-if="variant.ProductPrice.CatalogPrice !== null">
<div class="catalog-product-price col-12 px-0 mb-2">
<label class="col-form-label mb-0">@Loc["Products.Price.CatalogPrice"]:</label>
- <span class="h6 mb-0">{{PopupQuickViewVueModal.ProductPrice.CatalogPrice}}</span>
+ <span class="h6 mb-0">{{variant.ProductPrice.CatalogPrice}}</span>
</div>
</template>
- <template v-if="!(PopupQuickViewVueModal.ProductPrice.IsAuction && PopupQuickViewVueModal.ProductPrice.DisableBuyButton)">
- <div v-bind:class="{ 'product-price col-12 px-0 d-inline-flex align-items-center': (PopupQuickViewVueModal.ProductPrice.PriceWithDiscount !== null), 'non-discounted-price col-12 px-0 d-flex align-items-center': (PopupQuickViewVueModal.ProductPrice.PriceWithDiscount == null) }">
- <span :class="'price-value-' + PopupQuickViewVueModal.ProductPrice.ProductId " v-bind:class="{ 'actual-price': (PopupQuickViewVueModal.ProductPrice.PriceWithDiscount == null) }">
- <template v-if="PopupQuickViewVueModal.ProductPrice.IsAuction">
+ <template v-if="!(variant.ProductPrice.IsAuction && variant.ProductPrice.DisableBuyButton)">
+ <div v-bind:class="{ 'product-price col-12 px-0 d-inline-flex align-items-center': (variant.ProductPrice.PriceWithDiscount !== null), 'non-discounted-price col-12 px-0 d-flex align-items-center': (variant.ProductPrice.PriceWithDiscount == null) }">
+ <span v-bind:class="['price-value-' + variant.ProductPrice.ProductId, { 'actual-price': (variant.ProductPrice.PriceWithDiscount == null) }]">
+ <template v-if="variant.ProductPrice.IsAuction">
<strong class="actual-price">@Loc["Products.BuyNowPrice"]:</strong>
</template>
- <template v-if="PopupQuickViewVueModal.ProductPrice.PriceWithDiscount == null">
- <span class="actual-price" v-html="PopupQuickViewVueModal.ProductPrice.Price"></span>
+ <template v-if="variant.ProductPrice.PriceWithDiscount == null">
+ <span class="actual-price" v-html="variant.ProductPrice.Price"></span>
</template>
<template v-else>
<strong>{{Model.Price}}</strong>
</template>
</span>
- <template v-if="PopupQuickViewVueModal.ProductPrice.OldPrice !== null">
+ <template v-if="variant.ProductPrice.OldPrice !== null">
<div class="old-product-price">
- <span class="old-price mx-2">{{PopupQuickViewVueModal.ProductPrice.OldPrice}}</span>
+ <span class="old-price mx-2">{{variant.ProductPrice.OldPrice}}</span>
</div>
</template>
</div>
</template>
<template v-else>
- <template v-if="PopupQuickViewVueModal.ProductPrice.OldPrice !== null">
+ <template v-if="variant.ProductPrice.OldPrice !== null">
<div class="old-product-price">
<span class="old-price mx-2">{{Model.OldPrice}}</span>
</div>
</template>
</template>
- <template v-if="PopupQuickViewVueModal.ProductPrice.PriceWithDiscount !== null">
+ <template v-if="variant.ProductPrice.PriceWithDiscount !== null">
<div class="d-inline-flex align-items-center product-price discounted-price col-12 px-0">
<label class="mb-0 mx-2">@Loc["Products.Price.WithDiscount"]:</label>
- <span :class="'your-price price-value-' + PopupQuickViewVueModal.ProductPrice.ProductId">
- <strong class="actual-price" v-html="PopupQuickViewVueModal.ProductPrice.PriceWithDiscount"></strong>
+ <span :class="'your-price price-value-' + variant.ProductPrice.ProductId">
+ <strong class="actual-price" v-html="variant.ProductPrice.PriceWithDiscount"></strong>
</span>
- <meta itemprop="price" content="PopupQuickViewVueModal.ProductPrice.PriceValue" :class="'your-price price-value-' + PopupQuickViewVueModal.ProductId" />
+ <meta itemprop="price" content="variant.ProductPrice.PriceValue" :class="'your-price price-value-' + variant.ProductId" />
</div>
</template>
- <template v-if="PopupQuickViewVueModal.ProductPrice.BasePricePAngV !== null">
+ <template v-if="variant.ProductPrice.BasePricePAngV !== null">
<div class="base-price-pangv ml-2">
- {{PopupQuickViewVueModal.ProductPrice.BasePricePAngV}}
+ {{variant.ProductPrice.BasePricePAngV}}
</div>
</template>
- <template v-if="PopupQuickViewVueModal.ProductPrice.CurrencyCode !== null">
- <meta itemprop="priceCurrency" :content="PopupQuickViewVueModal.ProductPrice.CurrencyCode" />
+ <template v-if="variant.ProductPrice.CurrencyCode !== null">
+ <meta itemprop="priceCurrency" :content="variant.ProductPrice.CurrencyCode" />
</template>
- <template v-if="PopupQuickViewVueModal.ProductPrice.PriceWithDiscount">
- <meta itemprop="price" :content="PopupQuickViewVueModal.ProductPrice.PriceValue" />
+ <template v-if="variant.ProductPrice.PriceWithDiscount">
+ <meta itemprop="price" :content="variant.ProductPrice.PriceValue" />
</template>
</template>
</div>
diff --git a/src/Web/Grand.Web/Views/Shared/QuickView/_ProductBundles.cshtml b/src/Web/Grand.Web/Views/Shared/QuickView/_ProductBundles.cshtml
index b4679d308..28e29819c 100644
--- a/src/Web/Grand.Web/Views/Shared/QuickView/_ProductBundles.cshtml
+++ b/src/Web/Grand.Web/Views/Shared/QuickView/_ProductBundles.cshtml
@@ -17,13 +17,15 @@
</div>
<template v-if="item.ProductAttributes.length > 0">
<div class="col-12">
- <div class="attributes">
- <table class="table">
- <tr v-for="attribute in item.ProductAttributes">
- <partial name="QuickView/_Attributes" />
- </tr>
- </table>
- </div>
+ <template v-if="item.ProductAttributes.length > 0">
+ <div class="attributes">
+ <table class="table">
+ <template v-for="(attribute, index) in item.ProductAttributes">
+ <product-attribute-quickview :attribute="attribute"></product-attribute-quickview>
+ </template>
+ </table>
+ </div>
+ </template>
</div>
</template>
</div>
diff --git a/src/Web/Grand.Web/Views/Shared/_Layout.cshtml b/src/Web/Grand.Web/Views/Shared/_Layout.cshtml
index 88766b4ef..4312ce4bf 100644
--- a/src/Web/Grand.Web/Views/Shared/_Layout.cshtml
+++ b/src/Web/Grand.Web/Views/Shared/_Layout.cshtml
@@ -52,5 +52,6 @@
</div>
@await Component.InvokeAsync("Widget", new { widgetZone = "body_end_html_tag_before" })
<resources asp-type="ScriptFooter" />
+ <resources asp-type="TemplateFooter" />
</body>
</html>
diff --git a/src/Web/Grand.Web/Views/Shared/_ProductQuickView.cshtml b/src/Web/Grand.Web/Views/Shared/_ProductQuickView.cshtml
index b7075a6cc..8da8c9096 100644
--- a/src/Web/Grand.Web/Views/Shared/_ProductQuickView.cshtml
+++ b/src/Web/Grand.Web/Views/Shared/_ProductQuickView.cshtml
@@ -53,22 +53,36 @@
</div>
</template>
+
+
@* PRODUCT BUNDLES *@
<partial name="QuickView/_ProductBundles" />
@* ATTRIBUTES *@
+ <partial name="QuickView/_Attributes" />
+
<template v-if="PopupQuickViewVueModal.ProductAttributes.length > 0">
<div class="attributes">
<table class="table">
- <tr v-for="attribute in PopupQuickViewVueModal.ProductAttributes">
- <partial name="QuickView/_Attributes" />
- </tr>
+ <template v-for="(attribute, index) in PopupQuickViewVueModal.ProductAttributes">
+ <product-attribute-quickview :ref="'QVattribute' + index" :attribute="attribute"></product-attribute-quickview>
+ </template>
</table>
+
</div>
</template>
+ <script asp-location="Footer" asp-order="302">
+ Vue.component('product-attribute-quickview', {
+ template: '#product-attribute-quickview',
+ props: {
+ attribute: null
+ }
+ });
+
+ </script>
@* WAREHOUSES *@
<partial name="QuickView/_Warehouses" />
@@ -190,9 +204,9 @@
<template v-if="variant.ProductAttributes.length > 0">
<div class="attributes">
<table class="table">
- <tr v-for="attribute in variant.ProductAttributes">
- <partial name="QuickView/_Attributes" />
- </tr>
+ <template v-for="(attribute, index) in variant.ProductAttributes">
+ <product-attribute-quickview :attribute="attribute"></product-attribute-quickview>
+ </template>
</table>
</div>
</template>
diff --git a/src/Web/Grand.Web/wwwroot/theme/script/app.js b/src/Web/Grand.Web/wwwroot/theme/script/app.js
index a6460cad2..83483a0e2 100644
--- a/src/Web/Grand.Web/wwwroot/theme/script/app.js
+++ b/src/Web/Grand.Web/wwwroot/theme/script/app.js
@@ -1,4 +1,5 @@
-var vm = new Vue({
+
+var vm = new Vue({
el: '#app',
data: function () {
return {
@@ -25,7 +26,7 @@
flywish: null,
wishlistitems: null,
wishindicator: undefined,
- UpdatedShoppingCartItemId: null
+ UpdatedShoppingCartItemId: null,
},
mounted: function () {
if (localStorage.fluid == "true") this.fluid = "fluid";
@@ -356,7 +357,11 @@
}
} else {
if (response.data.price) {
- vm.PopupQuickViewVueModal.ProductPrice.Price = response.data.price;
+ if (vm.PopupQuickViewVueModal.ProductType == 0) {
+ vm.PopupQuickViewVueModal.ProductPrice.Price = response.data.price;
+ } else {
+ vm.PopupQuickViewVueModal.AssociatedProducts.find(x => x.Id === pId).ProductPrice.Price = response.data.price;
+ }
}
if (response.data.sku) {
vm.PopupQuickViewVueModal.Sku = response.data.sku;