Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow User Supplied Price Upcharge #518

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
7974e23
Update ProductDTO.cs
ArielBlanco1990 Dec 5, 2024
a693be2
Update Products_Edit.aspx.resx
ArielBlanco1990 Dec 5, 2024
ddc1641
Update Products_Edit.aspx
ArielBlanco1990 Dec 5, 2024
9f74244
Update Products_Edit.aspx.cs
ArielBlanco1990 Dec 5, 2024
acc44fa
Update Products_Edit.aspx.designer.cs
ArielBlanco1990 Dec 5, 2024
84c2c67
Update Performance.ashx.cs
ArielBlanco1990 Dec 5, 2024
1dbb800
Update Hotcakes.dnn
ArielBlanco1990 Dec 5, 2024
392f159
Update Hotcakes.Modules.csproj
ArielBlanco1990 Dec 5, 2024
9c5c4d6
Create 03.09.01.SqlDataProvider
ArielBlanco1990 Dec 5, 2024
cc91f72
Update Extensions.resx
ArielBlanco1990 Dec 5, 2024
2f1317d
Update SampleData.cs
ArielBlanco1990 Dec 5, 2024
716d6e8
Update Product.cs
ArielBlanco1990 Dec 5, 2024
40cbf39
Update XmlProductRepository.cs
ArielBlanco1990 Dec 5, 2024
84b36e0
Update BaseProductTest.cs
ArielBlanco1990 Dec 5, 2024
2633201
Update ProductRepository.cs
ArielBlanco1990 Dec 5, 2024
9f5a3e4
Update hcc_Product.cs
ArielBlanco1990 Dec 5, 2024
1d6fe99
Update HccDbContext.edmx
ArielBlanco1990 Dec 5, 2024
b8a6fe0
Update LineItem.cs
ArielBlanco1990 Dec 11, 2024
123e3e0
Update Order.cs
ArielBlanco1990 Dec 11, 2024
e5d062f
Update admin.css
ArielBlanco1990 Dec 11, 2024
97c2a28
Update admin.less
ArielBlanco1990 Dec 11, 2024
05f58a8
Update OrderItems.ascx
ArielBlanco1990 Dec 11, 2024
ebb3c18
Update OrderItems.ascx.cs
ArielBlanco1990 Dec 11, 2024
48105d7
Update ProductsController.cs
ArielBlanco1990 Dec 11, 2024
ede1fe5
Update CartLineItemViewModel.cs
ArielBlanco1990 Dec 11, 2024
1e91ecd
Update CartViewModel.cs
ArielBlanco1990 Dec 11, 2024
06e32ad
Update ProductPageViewModel.cs
ArielBlanco1990 Dec 11, 2024
50065ed
Update Uninstall.SqlDataProvider
ArielBlanco1990 Dec 11, 2024
fc91c75
Update Index.cshtml
ArielBlanco1990 Dec 11, 2024
efb8a76
Update _ProductDetails.cshtml
ArielBlanco1990 Dec 11, 2024
423ded9
Update _RenderSingleProduct.cshtml
ArielBlanco1990 Dec 11, 2024
b9b27af
Update _ViewOrderItems.cshtml
ArielBlanco1990 Dec 11, 2024
f2dd313
Update CartController.cs
ArielBlanco1990 Dec 11, 2024
a917fa8
Update _ViewOrderItems.cshtml
ArielBlanco1990 Dec 12, 2024
300e644
Update ProductsController.cs
ArielBlanco1990 Dec 12, 2024
9ddc178
Update CartController.cs
ArielBlanco1990 Dec 12, 2024
3f860e7
Update LineItemDTO.cs
ArielBlanco1990 Dec 12, 2024
32ef8c9
Update OrderService.cs
ArielBlanco1990 Dec 12, 2024
c0fc1b4
Update OrderCalculator.cs
ArielBlanco1990 Dec 12, 2024
23f7e86
Update Order.cs
ArielBlanco1990 Dec 12, 2024
f948b2a
Update LineItemRepository.cs
ArielBlanco1990 Dec 12, 2024
f0f7671
Update LineItem.cs
ArielBlanco1990 Dec 12, 2024
eb52fb1
Update HccDbContext.edmx
ArielBlanco1990 Dec 12, 2024
0f76ea7
Update hcc_LineItem.cs
ArielBlanco1990 Dec 12, 2024
2887a02
Update 03.09.01.SqlDataProvider
ArielBlanco1990 Dec 12, 2024
7d1e6a5
Update Uninstall.SqlDataProvider
ArielBlanco1990 Dec 12, 2024
7237e0e
Update Products_Edit.aspx.cs
ArielBlanco1990 Dec 13, 2024
a28186d
Update Products_Edit.aspx
ArielBlanco1990 Dec 13, 2024
8cdf01c
Update ProductDTO.cs
ArielBlanco1990 Dec 13, 2024
5f628bd
Update Hotcakes.CommerceDTO.csproj
ArielBlanco1990 Dec 13, 2024
318c6d6
Update SampleData.cs
ArielBlanco1990 Dec 13, 2024
8d455bd
Update LineItem.cs
ArielBlanco1990 Dec 13, 2024
9132394
Update Constants.cs
ArielBlanco1990 Dec 13, 2024
49dc6e5
Update CatalogService.cs
ArielBlanco1990 Dec 13, 2024
aebf7c2
Update _ProductDetails.cshtml.resx
ArielBlanco1990 Dec 13, 2024
dba04f3
Update _ProductDetails.cshtml
ArielBlanco1990 Dec 13, 2024
1f389a0
Update Performance.ashx.cs
ArielBlanco1990 Dec 13, 2024
2651951
Create UpchargeAmountTypesDTO.cs
ArielBlanco1990 Dec 16, 2024
f478261
Update OrderItems.ascx.cs
ArielBlanco1990 Dec 16, 2024
b269a5f
Update Index.cshtml
ArielBlanco1990 Dec 16, 2024
945703f
Update _ProductDetails.cshtml
ArielBlanco1990 Dec 16, 2024
428af79
Update _ProductDetails.cshtml.resx
ArielBlanco1990 Dec 16, 2024
ac30fdf
Update _ViewOrderItems.cshtml
ArielBlanco1990 Dec 16, 2024
c6b0bca
Update _ProductDetails.cshtml
ArielBlanco1990 Dec 16, 2024
0ef3676
Update _ViewOrderItems.cshtml
ArielBlanco1990 Dec 16, 2024
77b8aa4
Update Index.cshtml
ArielBlanco1990 Dec 16, 2024
fca37bb
Update _ProductDetails.cshtml.resx
ArielBlanco1990 Dec 16, 2024
6654123
Update _RenderSingleProduct.cshtml
ArielBlanco1990 Dec 16, 2024
2744ef1
Update _ViewOrderItems.cshtml
ArielBlanco1990 Dec 16, 2024
3bc3de7
Update _ProductDetails.cshtml
ArielBlanco1990 Dec 16, 2024
b729bc7
Update _ProductDetails.cshtml.resx
ArielBlanco1990 Dec 16, 2024
effb2c8
Update _RenderSingleProduct.cshtml
ArielBlanco1990 Dec 16, 2024
aa4c822
Update _ProductDetails.cshtml
ArielBlanco1990 Dec 16, 2024
5ed8cbc
Update Index.cshtml
ArielBlanco1990 Dec 16, 2024
2583cff
Update _ProductDetails.cshtml.resx
ArielBlanco1990 Dec 16, 2024
a934bad
Update _ViewOrderItems.cshtml
ArielBlanco1990 Dec 16, 2024
eddd97f
Update _ViewOrderItems.cshtml
ArielBlanco1990 Dec 16, 2024
dec9a24
Update Index.cshtml
ArielBlanco1990 Dec 16, 2024
3d0d8f7
Update _ProductDetails.cshtml
ArielBlanco1990 Dec 16, 2024
9a146fa
Update CatalogImport.cs
ArielBlanco1990 Dec 16, 2024
38d59ed
Update CatalogExport.cs
ArielBlanco1990 Dec 16, 2024
d6bf868
Update hcc_Product.csv
ArielBlanco1990 Dec 16, 2024
fb497ef
Update CatalogImport.cs
ArielBlanco1990 Dec 17, 2024
b86c49b
Update LineItem.cs
ArielBlanco1990 Dec 17, 2024
29a48f1
Update hcc_LineItem.cs
ArielBlanco1990 Dec 18, 2024
77ecb60
Update HccDbContext.edmx
ArielBlanco1990 Dec 18, 2024
841a87e
Update LineItem.cs
ArielBlanco1990 Dec 18, 2024
098ded7
Update LineItemRepository.cs
ArielBlanco1990 Dec 18, 2024
5911df0
Update OrderCalculator.cs
ArielBlanco1990 Dec 18, 2024
f492785
Update OrderService.cs
ArielBlanco1990 Dec 18, 2024
504b7d4
Update LineItemDTO.cs
ArielBlanco1990 Dec 18, 2024
74d0ff1
Update OrderItems.ascx.cs
ArielBlanco1990 Dec 18, 2024
1abecdf
Update CartController.cs
ArielBlanco1990 Dec 18, 2024
3815c29
Update ProductsController.cs
ArielBlanco1990 Dec 18, 2024
f30f10a
Update CartViewModel.cs
ArielBlanco1990 Dec 18, 2024
7ad05ac
Update ProductPageViewModel.cs
ArielBlanco1990 Dec 18, 2024
787c072
Update Hotcakes.dnn
ArielBlanco1990 Dec 18, 2024
c4d6102
Update Hotcakes.Modules.csproj
ArielBlanco1990 Dec 18, 2024
1ad5ec9
Update 03.09.00.SqlDataProvider
ArielBlanco1990 Dec 18, 2024
b6a9603
Delete 03.09.01.SqlDataProvider
ArielBlanco1990 Dec 18, 2024
70e22b9
Update GlobalResources.resx
ArielBlanco1990 Dec 18, 2024
52f6d19
Update _ProductDetails.cshtml
ArielBlanco1990 Dec 18, 2024
a784a25
Update _ViewOrderItems.cshtml
ArielBlanco1990 Dec 18, 2024
05e1cd0
Update GlobalResources.resx
ArielBlanco1990 Dec 18, 2024
8ea5eab
Update _ProductDetails.cshtml
ArielBlanco1990 Dec 18, 2024
55927f3
Update _ViewOrderItems.cshtml
ArielBlanco1990 Dec 18, 2024
e81c860
Update GlobalResources.resx
ArielBlanco1990 Dec 18, 2024
3aaf4a6
Update _ProductDetails.cshtml
ArielBlanco1990 Dec 18, 2024
8715d6e
Update _ViewOrderItems.cshtml
ArielBlanco1990 Dec 18, 2024
226ba76
Update GlobalResources.resx
ArielBlanco1990 Dec 18, 2024
6f57f7c
Update _ProductDetails.cshtml
ArielBlanco1990 Dec 18, 2024
2bf30c2
Update _ViewOrderItems.cshtml
ArielBlanco1990 Dec 18, 2024
45054de
Update GlobalResources.resx
ArielBlanco1990 Dec 18, 2024
b1ea7be
Update _ProductDetails.cshtml
ArielBlanco1990 Dec 18, 2024
37e2216
Update _ViewOrderItems.cshtml
ArielBlanco1990 Dec 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Libraries/Hotcakes.Commerce.Tests/BaseProductTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ public void EditProduct()
edit.Featured = product.Featured;
edit.IsBundle = product.IsBundle;
edit.IsSearchable = product.IsSearchable;
edit.AllowUpcharge = product.AllowUpcharge;
edit.UpchargeAmount = product.UpchargeAmount;
edit.UpchargeUnit = product.UpchargeUnit;
edit.Status = product.Status;
edit.Sku = product.Sku;
edit.ProductName = product.ProductName;
Expand Down
14 changes: 7 additions & 7 deletions Libraries/Hotcakes.Commerce.Tests/CsvData/hcc_Product.csv
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Id,bvin,SKU,ProductTypeId,ListPrice,SitePrice,SiteCost,TaxExempt,TaxClass,NonShipping,ShipSeparately,ShippingMode,ShippingWeight,ShippingLength,ShippingWidth,ShippingHeight,Status,ImageFileSmall,ImageFileMedium,CreationDate,MinimumQty,ManufacturerID,VendorID,GiftWrapAllowed,ExtraShipFee,LastUpdated,TemplateName,PreContentColumnId,PostContentColumnId,RewriteUrl,CustomProperties,GiftWrapPrice,StoreId,Featured,AllowReviews,OutOfStockMode,IsAvailableForSale,IsUserPrice,HideQty,IsSearchable,IsBundle,IsGiftCard,IsRecurring,RecurringInterval,RecurringIntervalType,ShippingCharge
1,"9113e66b-43fb-4eec-b9d1-84cb9750bccc","SAMPLE001",,0.0000000000,42.9500000000,0.0000000000,0,"-1",0,0,1,0.0000000000,0.0000000000,0.0000000000,0.0000000000,1,"BraceletBlue.png","BraceletBlue.png",07/23/2015 14:19:26,1,,,0,0.0000000000,07/23/2015 14:19:26,"","","","blue-bracelet","<?xml version=""1.0"" encoding=""utf-16""?>\r\n<ArrayOfCustomProperty xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" />",0.0000000000,1,True,,100,True,False,False,True,False,False,False,0,0,1
2,"60d3f285-689f-47f6-b93c-77386f8c6377","SAMPLE004",,0.0000000000,59.8700000000,0.0000000000,0,"-1",0,0,1,0.0000000000,0.0000000000,0.0000000000,0.0000000000,1,"indiana-jones-hat.jpg","indiana-jones-hat.jpg",07/23/2015 14:19:27,1,,,0,0.0000000000,07/23/2015 14:19:27,"","","","brown-fedora","<?xml version=""1.0"" encoding=""utf-16""?>\r\n<ArrayOfCustomProperty xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" />",0.0000000000,1,True,,100,True,False,False,True,False,False,False,0,0,1
3,"7996037a-d856-4880-a4d6-eb1833d73e10","SAMPLE006",,0.0000000000,29.9500000000,0.0000000000,0,"-1",0,0,1,0.0000000000,0.0000000000,0.0000000000,0.0000000000,1,"Earrings.jpg","Earrings.jpg",07/23/2015 14:19:27,1,,,0,0.0000000000,07/23/2015 14:19:27,"","","","butterfly-earings","<?xml version=""1.0"" encoding=""utf-16""?>\r\n<ArrayOfCustomProperty xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" />",0.0000000000,1,True,,100,True,False,False,True,False,False,False,0,0,1
4,"55f88d0a-89ca-4786-a4f5-feb963350d85","SAMPLE002",,0.0000000000,1.9900000000,0.0000000000,0,"-1",0,0,1,0.0000000000,0.0000000000,0.0000000000,0.0000000000,1,"CupCake.jpg","CupCake.jpg",07/23/2015 14:19:27,1,,,0,0.0000000000,07/23/2015 14:19:27,"","","","cupcake-sample","<?xml version=""1.0"" encoding=""utf-16""?>\r\n<ArrayOfCustomProperty xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" />",0.0000000000,1,True,,100,True,False,False,True,False,False,False,0,0,1
5,"2ef85ff8-c706-433f-9cf9-64d937bcd438","SAMPLE005",,1999.0000000000,1299.0000000000,0.0000000000,0,"-1",0,0,1,0.0000000000,0.0000000000,0.0000000000,0.0000000000,1,"Laptop.png","Laptop.png",07/23/2015 14:19:27,1,,,0,0.0000000000,07/23/2015 14:19:27,"","","","laptop-computer-sample","<?xml version=""1.0"" encoding=""utf-16""?>\r\n<ArrayOfCustomProperty xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" />",0.0000000000,1,True,,100,True,False,False,True,False,False,False,0,0,1
6,"ea6e4488-4ebd-4075-a579-d2c8a208e627","SAMPLE003",,0.0000000000,39.9500000000,0.0000000000,0,"-1",0,0,1,0.0000000000,0.0000000000,0.0000000000,0.0000000000,1,"PurpleTop.jpg","PurpleTop.jpg",07/23/2015 14:19:27,1,,,0,0.0000000000,07/23/2015 14:19:28,"","","","purple-top","<?xml version=""1.0"" encoding=""utf-16""?>\r\n<ArrayOfCustomProperty xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" />",0.0000000000,1,True,,100,True,False,False,True,False,False,False,0,0,1
Id,bvin,SKU,ProductTypeId,ListPrice,SitePrice,SiteCost,TaxExempt,TaxClass,NonShipping,ShipSeparately,ShippingMode,ShippingWeight,ShippingLength,ShippingWidth,ShippingHeight,Status,ImageFileSmall,ImageFileMedium,CreationDate,MinimumQty,ManufacturerID,VendorID,GiftWrapAllowed,ExtraShipFee,LastUpdated,TemplateName,PreContentColumnId,PostContentColumnId,RewriteUrl,CustomProperties,GiftWrapPrice,StoreId,Featured,AllowReviews,OutOfStockMode,IsAvailableForSale,IsUserPrice,HideQty,IsSearchable,IsBundle,IsGiftCard,IsRecurring,RecurringInterval,RecurringIntervalType,ShippingCharge,AllowUpcharge,UpchargeAmount,UpchargeUnit
1,9113e66b-43fb-4eec-b9d1-84cb9750bccc,SAMPLE001,,0,42.95,0,0,-1,0,0,1,0,0,0,0,1,BraceletBlue.png,BraceletBlue.png,07/23/2015 14:19:26,1,,,0,0,07/23/2015 14:19:26,,,,blue-bracelet,"<?xml version=""1.0"" encoding=""utf-16""?>\r\n<ArrayOfCustomProperty xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" />",0,1,TRUE,,100,TRUE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,0,0,1,0,3,1
2,60d3f285-689f-47f6-b93c-77386f8c6377,SAMPLE004,,0,59.87,0,0,-1,0,0,1,0,0,0,0,1,indiana-jones-hat.jpg,indiana-jones-hat.jpg,07/23/2015 14:19:27,1,,,0,0,07/23/2015 14:19:27,,,,brown-fedora,"<?xml version=""1.0"" encoding=""utf-16""?>\r\n<ArrayOfCustomProperty xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" />",0,1,TRUE,,100,TRUE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,0,0,1,0,3,1
3,7996037a-d856-4880-a4d6-eb1833d73e10,SAMPLE006,,0,29.95,0,0,-1,0,0,1,0,0,0,0,1,Earrings.jpg,Earrings.jpg,07/23/2015 14:19:27,1,,,0,0,07/23/2015 14:19:27,,,,butterfly-earings,"<?xml version=""1.0"" encoding=""utf-16""?>\r\n<ArrayOfCustomProperty xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" />",0,1,TRUE,,100,TRUE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,0,0,1,0,3,1
4,55f88d0a-89ca-4786-a4f5-feb963350d85,SAMPLE002,,0,1.99,0,0,-1,0,0,1,0,0,0,0,1,CupCake.jpg,CupCake.jpg,07/23/2015 14:19:27,1,,,0,0,07/23/2015 14:19:27,,,,cupcake-sample,"<?xml version=""1.0"" encoding=""utf-16""?>\r\n<ArrayOfCustomProperty xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" />",0,1,TRUE,,100,TRUE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,0,0,1,0,3,1
5,2ef85ff8-c706-433f-9cf9-64d937bcd438,SAMPLE005,,1999,1299,0,0,-1,0,0,1,0,0,0,0,1,Laptop.png,Laptop.png,07/23/2015 14:19:27,1,,,0,0,07/23/2015 14:19:27,,,,laptop-computer-sample,"<?xml version=""1.0"" encoding=""utf-16""?>\r\n<ArrayOfCustomProperty xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" />",0,1,TRUE,,100,TRUE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,0,0,1,0,3,1
6,ea6e4488-4ebd-4075-a579-d2c8a208e627,SAMPLE003,,0,39.95,0,0,-1,0,0,1,0,0,0,0,1,PurpleTop.jpg,PurpleTop.jpg,07/23/2015 14:19:27,1,,,0,0,07/23/2015 14:19:28,,,,purple-top,"<?xml version=""1.0"" encoding=""utf-16""?>\r\n<ArrayOfCustomProperty xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" />",0,1,TRUE,,100,TRUE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,0,0,1,0,3,1
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@ private Product GetProduct(XElement element)
TemplateName = Convert.ToString(element.Element("TemplateName").Value),
IsBundle = (element.Element("IsBundle") != null && Convert.ToBoolean(element.Element("IsBundle").Value)),
IsSearchable = (element.Element("IsSearchable") != null || Convert.ToBoolean(element.Element("IsSearchable").Value)),
AllowUpcharge = (element.Element("AllowUpcharge") != null || Convert.ToBoolean(element.Element("AllowUpcharge").Value)),
UpchargeAmount = element.Element("UpchargeAmount") == null ? 1 : Convert.ToInt32(element.Element("UpchargeAmount").Value),
UpchargeUnit = Convert.ToString(element.Element("UpchargeUnit").Value),
Status = (element.Element("Status") == null ? ProductStatus.Active : (ProductStatus)Convert.ToInt32(element.Element("Status").Value)),
Sku = Convert.ToString(element.Element("Sku").Value),
ProductName = Convert.ToString(element.Element("ProductName").Value),
Expand Down
10 changes: 8 additions & 2 deletions Libraries/Hotcakes.Commerce/Catalog/CatalogExport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,10 @@ protected override void WriteHeader()
"StockOut",
"Low Stock at",
"Roles",
"Searchable"
"Searchable",
"AllowUpcharge",
"UpchargeAmount",
"UpchargeUnit"
}, _headerStyle);

_firstRow = 3;
Expand Down Expand Up @@ -275,7 +278,10 @@ protected override int WriteProductRow(Product p, int rowIndex)
invs.Sum(i => i.OutOfStockPoint).ToString(),
invs.Sum(i => i.LowStockPoint).ToString(),
GetRoles(p.Bvin),
GetYesNo(p.IsSearchable)
GetYesNo(p.IsSearchable),
GetYesNo(p.AllowUpcharge),
p.UpchargeAmount.ToString(),
p.UpchargeUnit
}, _rowStyle);

return base.WriteProductRow(p, rowIndex);
Expand Down
42 changes: 40 additions & 2 deletions Libraries/Hotcakes.Commerce/Catalog/CatalogImport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
using DocumentFormat.OpenXml.Extensions;
using DocumentFormat.OpenXml.Spreadsheet;
using Hotcakes.Commerce.Contacts;
using Hotcakes.Commerce.Data.EF;
using Hotcakes.Commerce.Shipping;
using Hotcakes.Commerce.Storage;
using Hotcakes.Commerce.Taxes;
Expand Down Expand Up @@ -330,7 +331,7 @@ protected override bool ProcessRow(Row row)
return false;
}

p.UrlSlug = slug;
p.UrlSlug = slug;
p.Status = GetCellBool(row, "B") ? ProductStatus.Active : ProductStatus.Disabled;
p.Featured = GetCellBool(row, "C");
p.Sku = sku;
Expand Down Expand Up @@ -376,8 +377,45 @@ protected override bool ProcessRow(Row row)
var roles = GetCell(row, "AH");

p.IsSearchable = GetCellBool(row, "AI");
bool allowUpcharge;
var cellValueAJ = GetCell(row, "AJ");
if (string.IsNullOrWhiteSpace(cellValueAJ))
{
allowUpcharge = false;
}
else
{
allowUpcharge = GetCellBool(row, "AJ");
}

p.AllowUpcharge = allowUpcharge;

decimal upchargeAmount;
var cellValueAK = GetCell(row, "AK");
if (string.IsNullOrWhiteSpace(cellValueAK))
{
upchargeAmount = 3m;
}
else
{
upchargeAmount = GetCellDecimal(row, "AK");
}
p.UpchargeAmount = upchargeAmount;

string upchargeUnit;
var cellValueAL = GetCell(row, "AL");
if (string.IsNullOrWhiteSpace(cellValueAL))
{
upchargeUnit = "1";
}
else
{
upchargeUnit = cellValueAL;
}
p.UpchargeUnit = upchargeUnit;


if (string.IsNullOrWhiteSpace(p.ProductName))
if (string.IsNullOrWhiteSpace(p.ProductName))
{
Log(string.Format("- Product name is empty for row {0}", row.RowIndex));
return false;
Expand Down
10 changes: 9 additions & 1 deletion Libraries/Hotcakes.Commerce/Catalog/CatalogService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@
using System.Linq;
using System.Text;
using Hotcakes.Commerce.Analytics;
using Hotcakes.Commerce.Common;
using Hotcakes.Commerce.Content;
using Hotcakes.Commerce.Globalization;
using Hotcakes.Commerce.Orders;
using Hotcakes.Commerce.Storage;
using Hotcakes.Commerce.Utilities;
using Hotcakes.CommerceDTO.v1.Catalog;
using Hotcakes.Web;
using Hotcakes.Web.Data;

Expand Down Expand Up @@ -721,7 +724,12 @@ public bool ProductsCreateWithInventory(Product item, bool rebuildSearchIndex)
{
item.UrlSlug = Text.Slugify(item.ProductName, true);
}

if (string.IsNullOrWhiteSpace(item.UpchargeUnit))
{
item.UpchargeAmount = Constants.UpchargeAmount;
item.UpchargeUnit = ((int)UpchargeAmountTypesDTO.Percent).ToString();
}

var result = Products.Create(item);
if (rebuildSearchIndex)
{
Expand Down
13 changes: 13 additions & 0 deletions Libraries/Hotcakes.Commerce/Catalog/Product.cs
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,9 @@ public bool CustomPropertiesFromXml(string data)
/// If true, this product will be indexed and returned in the search results.
/// </summary>
public bool IsSearchable { get; set; }
public bool AllowUpcharge { get; set; }
public decimal UpchargeAmount { get; set; }
public string UpchargeUnit { get; set; }

/// <summary>
/// If set to true, this product will allow reviews to be saved by customers.
Expand Down Expand Up @@ -1012,6 +1015,9 @@ public Product Clone(bool cloneProductChoicesAndInputs, bool cloneProductImages)
}
result.InventoryMode = InventoryMode;
result.IsSearchable = IsSearchable;
result.AllowUpcharge = AllowUpcharge;
result.UpchargeAmount = UpchargeAmount;
result.UpchargeUnit = UpchargeUnit;
result.IsAvailableForSale = IsAvailableForSale;
result.IsBundle = IsBundle;
result.IsUserSuppliedPrice = IsUserSuppliedPrice;
Expand Down Expand Up @@ -1368,6 +1374,10 @@ public void FromDto(ProductDTO dto)

IsSearchable = dto.IsSearchable;

AllowUpcharge = dto.AllowUpcharge;
UpchargeAmount = dto.UpchargeAmount;
UpchargeUnit = dto.UpchargeUnit;

ShippingCharge = (ShippingChargeType) (int) dto.ShippingCharge;
}

Expand Down Expand Up @@ -1435,6 +1445,9 @@ public ProductDTO ToDto()
dto.ShippingCharge = (ShippingChargeTypeDTO) (int) ShippingCharge;

dto.IsSearchable = IsSearchable;
dto.AllowUpcharge = AllowUpcharge;
dto.UpchargeAmount = UpchargeAmount;
dto.UpchargeUnit = UpchargeUnit;

return dto;
}
Expand Down
6 changes: 6 additions & 0 deletions Libraries/Hotcakes.Commerce/Catalog/ProductRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,9 @@ protected override void CopyItemToModel(hcc_Product data, Product model)
model.CustomPropertiesFromXml(data.CustomProperties);
model.Featured = data.Featured;
model.IsSearchable = data.IsSearchable;
model.AllowUpcharge = data.AllowUpcharge;
model.UpchargeAmount = data.UpchargeAmount;
model.UpchargeUnit = data.UpchargeUnit;
model.GiftWrapAllowed = data.GiftWrapAllowed == 1 ? true : false;
model.GiftWrapPrice = data.GiftWrapPrice;
model.ImageFileMedium = data.ImageFileMedium;
Expand Down Expand Up @@ -770,6 +773,9 @@ protected override void CopyModelToItem(JoinedItem<hcc_Product, hcc_ProductTrans
data.Item.CustomProperties = model.CustomPropertiesToXml();
data.Item.Featured = model.Featured;
data.Item.IsSearchable = model.IsSearchable;
data.Item.AllowUpcharge = model.AllowUpcharge;
data.Item.UpchargeAmount = model.UpchargeAmount;
data.Item.UpchargeUnit = model.UpchargeUnit;
data.Item.GiftWrapAllowed = model.GiftWrapAllowed ? 1 : 0;
data.Item.GiftWrapPrice = model.GiftWrapPrice;
data.Item.ImageFileMedium = model.ImageFileMedium;
Expand Down
6 changes: 6 additions & 0 deletions Libraries/Hotcakes.Commerce/Common/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,5 +169,11 @@ public class Constants
public const string TAG_IOGPRICECURRENCY = "<meta property=\"og:price:currency\" content=\"{0}\" />";
#endregion

#region AllowUpcharge

public const decimal UpchargeAmount = 3m;
public const bool AllowUpcharge = false;

#endregion
}
}
12 changes: 12 additions & 0 deletions Libraries/Hotcakes.Commerce/Data/EF/HccDbContext.edmx
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@
<Property Name="ShippingCharge" Type="int" Nullable="false" />
<Property Name="FreeQuantity" Type="int" Nullable="false" />
<Property Name="PromotionIds" Type="nvarchar" MaxLength="500" />
<Property Name="IsUpchargeAllowed" Type="bit" Nullable="false" />
</EntityType>
<EntityType Name="hcc_MailingList">
<Key>
Expand Down Expand Up @@ -587,6 +588,9 @@
<Property Name="IsUserPrice" Type="bit" Nullable="false" />
<Property Name="HideQty" Type="bit" Nullable="false" />
<Property Name="IsSearchable" Type="bit" Nullable="false" />
<Property Name="AllowUpcharge" Type="bit" Nullable="false" />
<Property Name="UpchargeAmount" Type="numeric" Precision="18" Scale="10" Nullable="false" />
<Property Name="UpchargeUnit" Type="nvarchar" Nullable="false" />
<Property Name="IsBundle" Type="bit" Nullable="false" />
<Property Name="IsGiftCard" Type="bit" Nullable="false" />
<Property Name="IsRecurring" Type="bit" Nullable="false" />
Expand Down Expand Up @@ -3206,6 +3210,9 @@
<Property Type="Boolean" Name="IsUserPrice" Nullable="false" />
<Property Type="Boolean" Name="HideQty" Nullable="false" />
<Property Type="Boolean" Name="IsSearchable" Nullable="false" />
<Property Type="Boolean" Name="AllowUpcharge" Nullable="false" />
<Property Type="Decimal" Name="UpchargeAmount" Nullable="false" Precision="18" Scale="10" />
<Property Type="String" Name="UpchargeUnit" Nullable="false" />
<NavigationProperty Name="hcc_Manufacturer" Relationship="EfModels.FK_hcc_Product_hcc_Manufacturer" FromRole="hcc_Product" ToRole="hcc_Manufacturer" />
<NavigationProperty Name="hcc_ProductType" Relationship="EfModels.FK_hcc_Product_hcc_ProductType" FromRole="hcc_Product" ToRole="hcc_ProductType" />
<NavigationProperty Name="hcc_Vendor" Relationship="EfModels.FK_hcc_Product_hcc_Vendor" FromRole="hcc_Product" ToRole="hcc_Vendor" />
Expand Down Expand Up @@ -4147,6 +4154,7 @@
<Property Type="Boolean" Name="IsRecurringCancelled" Nullable="false" />
<Property Type="Int32" Name="FreeQuantity" Nullable="false" />
<Property Type="String" Name="PromotionIds" MaxLength="500" FixedLength="false" Unicode="true" />
<Property Type="Boolean" Name="IsUpchargeAllowed" Nullable="false" />
</EntityType>
<EntityType Name="hcc_Promotions">
<Key>
Expand Down Expand Up @@ -5418,6 +5426,9 @@
<ScalarProperty Name="IsGiftCard" ColumnName="IsGiftCard" />
<ScalarProperty Name="IsBundle" ColumnName="IsBundle" />
<ScalarProperty Name="IsSearchable" ColumnName="IsSearchable" />
<ScalarProperty Name="AllowUpcharge" ColumnName="AllowUpcharge" />
<ScalarProperty Name="UpchargeAmount" ColumnName="UpchargeAmount" />
<ScalarProperty Name="UpchargeUnit" ColumnName="UpchargeUnit" />
<ScalarProperty Name="HideQty" ColumnName="HideQty" />
<ScalarProperty Name="IsUserPrice" ColumnName="IsUserPrice" />
<ScalarProperty Name="IsAvailableForSale" ColumnName="IsAvailableForSale" />
Expand Down Expand Up @@ -6076,6 +6087,7 @@
<ScalarProperty Name="PromotionIds" ColumnName="PromotionIds" />
<ScalarProperty Name="FreeQuantity" ColumnName="FreeQuantity" />
<ScalarProperty Name="IsRecurringCancelled" ColumnName="IsRecurringCancelled" />
<ScalarProperty Name="IsUpchargeAllowed" ColumnName="IsUpchargeAllowed" />
<ScalarProperty Name="ShippingCharge" ColumnName="ShippingCharge" />
<ScalarProperty Name="RecurringIntervalType" ColumnName="RecurringIntervalType" />
<ScalarProperty Name="RecurringInterval" ColumnName="RecurringInterval" />
Expand Down
1 change: 1 addition & 0 deletions Libraries/Hotcakes.Commerce/Data/EF/hcc_LineItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public partial class hcc_LineItem
public bool IsRecurringCancelled { get; set; }
public int FreeQuantity { get; set; }
public string PromotionIds { get; set; }
public bool IsUpchargeAllowed { get; set; }

public virtual hcc_Order hcc_Order { get; set; }
}
Expand Down
Loading