Hi,
If you execute the below SQL it should correct the issue:
ALTER procedure {databaseOwner}[{objectQualifier}CVStore_Products_Duplicate]
(
@productId int
)
as
declare @newProductId int
--variants need to be copied in c# code since the identity of
--variant is needed to determine the options for a given
--variant
--cvstore_products
insert into {databaseOwner}[{objectQualifier}CVStore_Products]
(PortalID, Manufacturer, ModelNumber, ModelName, ProductImage, UnitCost, Keywords, Summary, [Description],
Featured, Archived, CreatedByUser, CreatedDate, ProductWeight, ProductHeight, ProductLength, ProductWidth,
SaleStartDate, SaleEndDate, SalePrice, StockQuantity, LowThreshold, HighThreshold, DeliveryTime,
PurchasePrice, RoleID, isEvent, viewRoleId)
select PortalID, Manufacturer, ModelNumber, ModelName, ProductImage, UnitCost, Keywords, Summary, [Description],
Featured, Archived, CreatedByUser, getDate(), ProductWeight, ProductHeight, ProductLength, ProductWidth,
SaleStartDate, SaleEndDate, SalePrice, StockQuantity, LowThreshold, HighThreshold, DeliveryTime,
PurchasePrice, RoleID, isEvent, viewRoleId from {databaseOwner}[{objectQualifier}CVStore_Products] where productId=@productId
set @newProductId = @@identity
--CVStore_ProductAttributes
insert into {databaseOwner}[{objectQualifier}CVStore_ProductAttributes]
(parentId, [name], [value])
select @newProductId, [name], [value] from {databaseOwner}[{objectQualifier}CVStore_ProductAttributes]
where parentId = @productId
--cvstore_productimages
insert into {databaseOwner}[{objectQualifier}cvstore_productimages]
(productId, imageUrl, caption, displayOrder)
select @newProductId, imageUrl, caption, displayOrder from {databaseOwner}[{objectQualifier}cvstore_productimages]
where productId = @productId
--cvstore_categoryproduct
insert into {databaseOwner}[{objectQualifier}cvstore_categoryproduct]
(productId, CategoryId)
select @newProductId, CategoryId from {databaseOwner}[{objectQualifier}cvstore_categoryproduct]
where productId = @productId
-- cvstore_productuserpricing
insert into {databaseOwner}[{objectQualifier}cvstore_productuserpricing]
(productId, price, roleId, userId)
select @newProductId, price, roleId, userId from {databaseOwner}[{objectQualifier}cvstore_productuserpricing]
where productId = @productId
-- cvstore_producttabs
insert into {databaseOwner}[{objectQualifier}cvstore_producttabs]
(productId, tabName, tabContent, sortOrder, TabImageUrl, DisplayImageBeforeTitleText, dnnRoleId)
select @newProductId, tabName, tabContent, sortOrder, TabImageUrl, DisplayImageBeforeTitleText, dnnRoleId from {databaseOwner}[{objectQualifier}cvstore_producttabs]
where productId = @productId
-- cvstore_productyoutubes
insert into {databaseOwner}[{objectQualifier}cvstore_productYouTubeVideos]
(productId, videoId, description)
select @newProductId, videoId, description from {databaseOwner}[{objectQualifier}cvstore_productYouTubeVideos]
where productId = @productId
-- CVStore_ProductDigitalDownload
insert into {databaseOwner}[{objectQualifier}CVStore_ProductDigitalDownload]
(productId, fileName, downloadLimit, expiryDate)
select @newProductId, fileName, downloadLimit, expiryDate from {databaseOwner}[{objectQualifier}CVStore_ProductDigitalDownload]
where productId = @productId
-- CVStore_ProductAccordionLeaf
insert into {databaseOwner}[{objectQualifier}CVStore_ProductAccordionLeaf]
(productId,sortOrder,accordionId,accordionLeafName,AccordionLeafContent)
select @newProductId, sortOrder,accordionId,accordionLeafName,AccordionLeafContent from {databaseOwner}[{objectQualifier}CVStore_ProductAccordionLeaf]
where productId = @productId
-- cvstore_productDNNRoles
insert into {databaseOwner}[{objectQualifier}CVStore_ProductDnnRoles]
(productId, roleId, expiryDate)
select @newProductId, roleId, expiryDate from {databaseOwner}[{objectQualifier}CVStore_ProductDnnRoles]
where productId = @productId
-- CVStore_QtyDiscountBand
insert into {databaseOwner}[{objectQualifier}CVStore_QtyDiscountBand]
(productId, lowerBandLimit, upperBandLimit, discountAmount,
discountAsPercent, dnnRoleId)
select @newProductId, lowerBandLimit, upperBandLimit, discountAmount,
discountAsPercent, dnnRoleId from {databaseOwner}[{objectQualifier}CVStore_QtyDiscountBand]
where productId = @productId
select @newProductId
return
GO