Hello Team,
I am trying to create another attribute control type called "Image Squares" like the Color Squares except for images.
It would be nice if a large image could be uploaded and a small predefined square piece be selected and cropped out to make the attribute value image, or a product could be selected and all the images for the product will be displayed and one chosen that would be automatically re-sized to make the attribute value image.
please find below mentioned code changes....
File Path: /SmartStoreNET/src/Libraries/SmartStore.Core/Domain/Catalog/AttributeControlType.cs
namespace SmartStore.Core.Domain.Catalog { public enum AttributeControlType { ..... /// <summary> /// Picture squares /// </summary> ImageSquares = 60, } }
File Path: /SmartStoreNET/src/Libraries/SmartStore.Core/Domain/Catalog/ProductVariantAttributeValue.cs
namespace SmartStore.Core.Domain.Catalog { public partial class ProductVariantAttributeValue : BaseEntity, ILocalizedEntity { .... .... /// <summary> /// Gets or sets the picture value (used with "Image squares" attribute type) /// </summary> public virtual int PictureId { get; set; } } }
File Path: /SmartStoreNET/src/Presentation/SmartStore.Web/Administration/Models/Catalog/ProductVariantModel.cs
namespace SmartStore.Admin.Models.Catalog { [Validator(typeof(ProductVariantValidator))] public class ProductVariantModel : EntityModelBase, ILocalizedModel<ProductVariantLocalizedModel> { [Validator(typeof(ProductVariantAttributeValueModelValidator))] public class ProductVariantAttributeValueModel : EntityModelBase, ILocalizedModel<ProductVariantAttributeValueLocalizedModel> { ..... [SmartResourceDisplayName("Admin.Catalog.Products.Variants.ProductVariantAttributes.Attributes.Values.Fields.ImageSquare")] [UIHint("Picture")] public int PictureId { get; set; } public bool DisplayImageSquares { get; set; } } } }
File Path: /SmartStoreNET/src/Presentation/SmartStore.Web/Administration/Views/ProductVariant/_CreateOrUpdateProductAttributeValue.cshtml
@if (Model.DisplayImageSquares) { <tr> <td class="adminTitle"> @Html.SmartLabelFor(model => model.PictureId) </td> <td class="adminData"> @Html.EditorFor(model => model.PictureId) @Html.ValidationMessageFor(model => model.PictureId) </td> </tr> }
and many other changes in CatalogController , OrderController for ImageSquare as similar to ColorSquare
1. PictureId shows me the Picture Uploading control but vanishes as soon as click save button
2. How do i upload image and crop it to display as Image Square?