Skip to content

Commit aa1ce1b

Browse files
committed
PDF catalog layout fixes
1 parent 828c063 commit aa1ce1b

File tree

7 files changed

+28
-94
lines changed

7 files changed

+28
-94
lines changed

src/Libraries/SmartStore.Services/Catalog/ProductAttributeParser.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public virtual Multimap<int, string> DeserializeProductVariantAttributes(string
7070
xmlDoc.LoadXml(attributes);
7171

7272
var nodeList1 = xmlDoc.SelectNodes(@"//Attributes/ProductVariantAttribute");
73-
foreach (var node1 in nodeList1.Cast<XmlElement>()) // codehint: sm-edit
73+
foreach (var node1 in nodeList1.Cast<XmlElement>())
7474
{
7575
string sid = node1.GetAttribute("ID").Trim();
7676
if (sid.HasValue())
@@ -226,8 +226,6 @@ public virtual string AddProductAttribute(string attributes, ProductVariantAttri
226226
/// <returns>Result</returns>
227227
public virtual bool AreProductAttributesEqual(string attributes1, string attributes2)
228228
{
229-
// codehint: sm-edit (massiv)
230-
231229
var attrs1 = DeserializeProductVariantAttributes(attributes1);
232230
var attrs2 = DeserializeProductVariantAttributes(attributes2);
233231

src/Libraries/SmartStore.Services/Catalog/ProductExtensions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public static ProductVariantAttributeCombination MergeWithCombination(this Produ
3535
{
3636
product.MergeWithCombination(combination);
3737
}
38+
3839
return combination;
3940
}
4041

src/Libraries/SmartStore.Services/Orders/OrderTotalCalculationService.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using SmartStore.Core.Domain.Orders;
1010
using SmartStore.Core.Domain.Shipping;
1111
using SmartStore.Core.Domain.Tax;
12+
using SmartStore.Core.Infrastructure;
1213
using SmartStore.Services.Catalog;
1314
using SmartStore.Services.Common;
1415
using SmartStore.Services.Discounts;
@@ -182,7 +183,12 @@ public virtual void GetShoppingCartSubTotal(IList<OrganizedShoppingCartItem> car
182183
{
183184
decimal taxRate, sciSubTotal, sciExclTax, sciInclTax = decimal.Zero;
184185

185-
shoppingCartItem.Item.Product.MergeWithCombination(shoppingCartItem.Item.AttributesXml);
186+
IProductAttributeParser productAttrParser;
187+
if (EngineContext.Current.ContainerManager.TryResolve<IProductAttributeParser>(null, out productAttrParser))
188+
{
189+
// make the call unit test safe
190+
shoppingCartItem.Item.Product.MergeWithCombination(shoppingCartItem.Item.AttributesXml, productAttrParser);
191+
}
186192

187193
if (_shoppingCartSettings.RoundPricesDuringCalculation)
188194
{

src/Libraries/SmartStore.Services/Pdf/WkHtmlToPdfConverter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ internal HtmlToPdfConverter CreateWkConverter(PdfConvertSettings settings)
131131
var path = settings.Header.Process("header");
132132
if (path.HasValue())
133133
{
134-
sb.AppendFormat(" --header-html \"{0}\" ", path);
134+
sb.AppendFormat(" --header-html \"{0}\"", path);
135135
settings.Header.WriteArguments("header", sb);
136136
}
137137
}
@@ -146,7 +146,7 @@ internal HtmlToPdfConverter CreateWkConverter(PdfConvertSettings settings)
146146
var path = settings.Footer.Process("footer");
147147
if (path.HasValue())
148148
{
149-
sb.AppendFormat(" --footer-html \"{0}\" ", path);
149+
sb.AppendFormat(" --footer-html \"{0}\"", path);
150150
settings.Footer.WriteArguments("footer", sb);
151151
}
152152
}

src/Presentation/SmartStore.Web/Administration/Controllers/ProductController.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2890,9 +2890,8 @@ public IList<PrintableProductSpecificationModel> PrepareProductSpecificationMode
28902890
[NonAction]
28912891
protected void PreparePrintableProductsModel(PrintableProductsModel model, IList<Product> products)
28922892
{
2893-
//var store = _storeService.GetStoreById(model.StoreId) ?? _services.StoreContext.CurrentStore;
28942893
var store = _services.StoreContext.CurrentStore;
2895-
2894+
28962895
var companyInfoSettings = _services.Settings.LoadSetting<CompanyInformationSettings>(store.Id);
28972896
var contactSettings = _services.Settings.LoadSetting<ContactDataSettings>(store.Id);
28982897
var pdfSettings = _services.Settings.LoadSetting<PdfSettings>(store.Id);
@@ -2960,7 +2959,7 @@ protected void PreparePrintableProductsModel(PrintableProductsModel model, IList
29602959
var pictureUrl = String.Empty;
29612960
if (picture != null)
29622961
{
2963-
pictureUrl = _pictureService.GetPictureUrl(picture.PictureId, 75, false);
2962+
pictureUrl = _pictureService.GetPictureUrl(picture.Picture, 75, false);
29642963
}
29652964

29662965
productModel.AssociatedProducts.Add(new PrintableProductModel
@@ -2984,7 +2983,7 @@ protected void PreparePrintableProductsModel(PrintableProductsModel model, IList
29842983
var pictureUrl = String.Empty;
29852984
if (picture != null)
29862985
{
2987-
pictureUrl = _pictureService.GetPictureUrl(picture.PictureId, 75, false);
2986+
pictureUrl = _pictureService.GetPictureUrl(picture.Picture, 75, false);
29882987
}
29892988

29902989
productModel.BundledItems.Add(new PrintableProductModel()

src/Presentation/SmartStore.Web/Administration/Views/Product/PdfCatalog.Print.Cover.cshtml

Lines changed: 11 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
Layout = "~/Views/Shared/_Print.cshtml";
55
}
66

7+
<style type="text/css">
8+
html, body {
9+
height: 100% !important;
10+
}
11+
</style>
12+
713
<div class="container" style="height:95%">
814

915
@Html.Widget("pdfcatalog_cover_top")
@@ -18,76 +24,12 @@
1824

1925
@Html.Widget("pdfcatalog_cover_logo_after")
2026

21-
<h1 class="margin-top-50 text-center" style="font-size: 80px; font-weight: 400;">@Model.StoreName</h1>
22-
23-
@Html.Widget("pdfcatalog_cover_storename_after")
27+
<h1 class="text-center" style="font-size: 80px; font-weight: 400; padding-top: 200px">@Model.StoreName</h1>
2428

25-
<div class="company-address text-small">
26-
@if (!String.IsNullOrEmpty(Model.MerchantCompanyInfo.CompanyName))
27-
{
28-
<div class="section-title">
29-
@Model.MerchantCompanyInfo.CompanyName
30-
</div>
31-
}
32-
<div style="text-decoration:underline">
33-
@T("PDFProductCatalog.Cover.Address")
34-
</div>
35-
@if (!String.IsNullOrEmpty(Model.MerchantCompanyInfo.Firstname) || !String.IsNullOrEmpty(Model.MerchantCompanyInfo.Lastname))
36-
{
37-
<div class="name">
38-
39-
@Model.MerchantCompanyInfo.Firstname @Model.MerchantCompanyInfo.Lastname
40-
</div>
41-
}
42-
@if (!String.IsNullOrEmpty(Model.MerchantCompanyInfo.Street))
43-
{
44-
<div class="street">
45-
@Model.MerchantCompanyInfo.Street
46-
</div>
47-
}
48-
@if (!String.IsNullOrEmpty(Model.MerchantCompanyInfo.Street2))
49-
{
50-
<div class="street2">
51-
@Model.MerchantCompanyInfo.Street2
52-
</div>
53-
}
54-
@if (!String.IsNullOrEmpty(Model.MerchantCompanyInfo.ZipCode) || !String.IsNullOrEmpty(Model.MerchantCompanyInfo.City))
55-
{
56-
<div class="city">
57-
@Model.MerchantCompanyInfo.ZipCode @Model.MerchantCompanyInfo.City
58-
</div>
59-
}
60-
@if (!String.IsNullOrEmpty(Model.MerchantCompanyInfo.CountryName))
61-
{
62-
<div class="country">
63-
@Model.MerchantCompanyInfo.CountryName
64-
</div>
65-
}
66-
<div style="text-decoration:underline">
67-
@T("PDFProductCatalog.Cover.ContactData")
68-
</div>
69-
@if (!String.IsNullOrEmpty(Model.MerchantContactData.CompanyEmailAddress))
70-
{
71-
<div class="email">
72-
@T("PDFProductCatalog.CompanyEmailAddress"):
73-
@Model.MerchantContactData.CompanyEmailAddress
74-
</div>
75-
}
76-
@if (!String.IsNullOrEmpty(Model.MerchantContactData.CompanyTelephoneNumber))
77-
{
78-
<div class="phone">
79-
@T("PDFProductCatalog.CompanyTelephoneNumber"):
80-
@Model.MerchantContactData.CompanyTelephoneNumber
81-
</div>
82-
}
83-
@if (!String.IsNullOrEmpty(Model.MerchantContactData.CompanyFaxNumber))
84-
{
85-
<div class="fax">
86-
@T("PDFProductCatalog.CompanyFaxNumber"):
87-
@Model.MerchantContactData.CompanyFaxNumber
88-
</div>
89-
}
90-
</div>
29+
@Html.Widget("pdfcatalog_cover_storename_after")
9130

31+
<div style="position: fixed; bottom: 0; width: 100%">
32+
@Html.Action("PdfReceiptFooter", "Common", new { area = "" })
33+
</div>
9234

9335
</div>

src/Presentation/SmartStore.Web/Content/print.css

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
html {
2-
height: 100% !important;
3-
}
4-
body {
1+
body {
52
width: 100% !important;
6-
height: 100% !important;
73
margin: 0;
84
padding: 0;
95
color: #000;
@@ -301,16 +297,8 @@ th, td {
301297
min-width: 80px;
302298
text-align: center;
303299
}
304-
.company-address {
305-
position: fixed;
306-
right: 0px;
307-
bottom: 0px;
308-
margin-top: 200px;
309-
}
310-
.container {
311-
height: 100% !important;
312-
}
300+
313301
.detail-picture img {
314302
max-width: 500px !important;
315-
max-height: 500px !important;
303+
/*max-height: 500px !important;*/
316304
}

0 commit comments

Comments
 (0)