Take a look in my site: http://www.unidevsite.com/honolulu/p/53/white-watch
I upgraded my site to
Nopcommerce version 2.4. Here is my custom code for uploading
multiple pictures for product variant:
- Modify Nop's database follow:
+ Add Table ProductVariant_Picture_Mapping:
GO
/****** Object: Table [dbo].[ProductVariant_Picture_Mapping] Script Date: 02/09/2012 14:33:46 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProductVariant_Picture_Mapping](
[Id] [int] IDENTITY(1,1) NOT NULL,
[ProductVariantId] [int] NULL,
[PictureId] [int] NULL,
[DisplayOrder] [int] NULL,
CONSTRAINT [PK_ProductVariant_Picture_Mapping] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ProductVariant_Picture_Mapping] WITH CHECK ADD CONSTRAINT [ProductVariantPicture_Picture] FOREIGN KEY([PictureId])
REFERENCES [dbo].[Picture] ([Id])
GO
ALTER TABLE [dbo].[ProductVariant_Picture_Mapping] CHECK CONSTRAINT [ProductVariantPicture_Picture]
GO
ALTER TABLE [dbo].[ProductVariant_Picture_Mapping] WITH CHECK ADD CONSTRAINT [ProductVariantPicture_ProductVariant] FOREIGN KEY([ProductVariantId])
REFERENCES [dbo].[ProductVariant] ([Id])
GO
ALTER TABLE [dbo].[ProductVariant_Picture_Mapping] CHECK CONSTRAINT [ProductVariantPicture_ProductVariant]
GO
+ Update table ProductVariant
GO
ALTER TABLE [dbo].[ProductVariant](
[Id] [int] IDENTITY(1,1) NOT NULL,
[ProductId] [int] NOT NULL,
[Name] [nvarchar](400) NULL,
[Sku] [nvarchar](400) NULL,
[Description] [nvarchar](max) NULL,
[AdminComment] [nvarchar](max) NULL,
[ManufacturerPartNumber] [nvarchar](400) NULL,
[Gtin] [nvarchar](400) NULL,
[IsGiftCard] [bit] NOT NULL,
[GiftCardTypeId] [int] NOT NULL,
[RequireOtherProducts] [bit] NOT NULL,
[RequiredProductVariantIds] [nvarchar](1000) NULL,
[AutomaticallyAddRequiredProductVariants] [bit] NOT NULL,
[IsDownload] [bit] NOT NULL,
[DownloadId] [int] NOT NULL,
[UnlimitedDownloads] [bit] NOT NULL,
[MaxNumberOfDownloads] [int] NOT NULL,
[DownloadExpirationDays] [int] NULL,
[DownloadActivationTypeId] [int] NOT NULL,
[HasSampleDownload] [bit] NOT NULL,
[SampleDownloadId] [int] NOT NULL,
[HasUserAgreement] [bit] NOT NULL,
[UserAgreementText] [nvarchar](max) NULL,
[IsRecurring] [bit] NOT NULL,
[RecurringCycleLength] [int] NOT NULL,
[RecurringCyclePeriodId] [int] NOT NULL,
[RecurringTotalCycles] [int] NOT NULL,
[IsShipEnabled] [bit] NOT NULL,
[IsFreeShipping] [bit] NOT NULL,
[AdditionalShippingCharge] [decimal](18, 4) NOT NULL,
[IsTaxExempt] [bit] NOT NULL,
[TaxCategoryId] [int] NOT NULL,
[ManageInventoryMethodId] [int] NOT NULL,
[StockQuantity] [int] NOT NULL,
[DisplayStockAvailability] [bit] NOT NULL,
[DisplayStockQuantity] [bit] NOT NULL,
[MinStockQuantity] [int] NOT NULL,
[LowStockActivityId] [int] NOT NULL,
[NotifyAdminForQuantityBelow] [int] NOT NULL,
[BackorderModeId] [int] NOT NULL,
[AllowBackInStockSubscriptions] [bit] NOT NULL,
[OrderMinimumQuantity] [int] NOT NULL,
[OrderMaximumQuantity] [int] NOT NULL,
[DisableBuyButton] [bit] NOT NULL,
[DisableWishlistButton] [bit] NOT NULL,
[CallForPrice] [bit] NOT NULL,
[Price] [decimal](18, 4) NOT NULL,
[OldPrice] [decimal](18, 4) NOT NULL,
[ProductCost] [decimal](18, 4) NOT NULL,
[SpecialPrice] [decimal](18, 4) NULL,
[SpecialPriceStartDateTimeUtc] [datetime] NULL,
[SpecialPriceEndDateTimeUtc] [datetime] NULL,
[CustomerEntersPrice] [bit] NOT NULL,
[MinimumCustomerEnteredPrice] [decimal](18, 4) NOT NULL,
[MaximumCustomerEnteredPrice] [decimal](18, 4) NOT NULL,
[Weight] [decimal](18, 4) NOT NULL,
[Length] [decimal](18, 4) NOT NULL,
[Width] [decimal](18, 4) NOT NULL,
[Height] [decimal](18, 4) NOT NULL,
[PictureId] [int] NOT NULL,
[AvailableStartDateTimeUtc] [datetime] NULL,
[AvailableEndDateTimeUtc] [datetime] NULL,
[Published] [bit] NOT NULL,
[Deleted] [bit] NOT NULL,
[DisplayOrder] [int] NOT NULL,
[CreatedOnUtc] [datetime] NOT NULL,
[UpdatedOnUtc] [datetime] NOT NULL,
[ColorCode] [nvarchar](100) NULL,
PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ProductVariant] WITH CHECK ADD CONSTRAINT [ProductVariant_Product] FOREIGN KEY([ProductId])
REFERENCES [dbo].[Product] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[ProductVariant] CHECK CONSTRAINT [ProductVariant_Product]
GO
============================================================================
* Attached the color picker to product variant. I know is a product variant already had product attributes. But I think it would be more easier in case of a product variant will have a distinctive color.
* Product variant on the details page will have an identical image upload tab as one on the product detail page. I still keep PictureId available for a product variant for a my some reasons.
From that, on the front end so I can let end users select the color of the product (a color corresponding to a product variant), and show the picture of the product variant.
I just uploaded the logic codes (libraries) and in the "administration". Hope it will help if someone need.
http://www.mediafire.com/?7aa3b3c1l879aiz