Bertrand Le Roy avatar Bertrand Le Roy committed 9d37499

Added quantities to title shape for bundles

Comments (0)

Files changed (3)

Nwazet.Commerce.csproj

     <Content Include="Views\MediaPickerProductImageThumbnail.cshtml" />
     <Content Include="Views\BundleSummaryAdmin.cshtml" />
     <Content Include="Views\EditorTemplates\Parts\SizeBasedShippingMethod.cshtml" />
+    <Content Include="Views\Content-Product.cshtml" />
     <None Include="Views\ShoppingCart.Summary.cshtml" />
     <None Include="Views\Parts\Product.AddButton.cshtml" />
     <None Include="Views\ShoppingCart.cshtml" />

Views/Content-Product.cshtml

+@using Orchard.Utility.Extensions;
+@{
+    if (Model.Title != null) {
+        Layout.Title = Model.Title;
+    }
+    
+    var contentTypeClassName = ((string)Model.ContentItem.ContentType).HtmlClassify();
+    
+    // Copy the quantity down to each shape under the content zone
+    var quantity = Model.Quantity;
+    if (quantity != null) {
+        foreach (dynamic shape in Model.Content.Items) {
+            shape.Quantity(Model.Quantity);
+        }
+    }
+}
+<article class="content-item @Model.Metadata.DisplayType.ToLower() @contentTypeClassName">
+    <header>
+        @Display(Model.Header)
+        @if (Model.Meta != null) {
+            <div class="metadata">
+                @Display(Model.Meta)
+            </div>
+        }
+    </header>
+    @if(Model.Images != null) {
+    <div class="images">
+        @Display(Model.Images)
+    </div>
+    }
+    @if(Model.Specs != null) {
+    <div class="specs">
+        @Display(Model.Specs)
+    </div>
+    }
+    @Display(Model.Content)
+    @if(Model.Footer != null) {
+    <footer>
+        @Display(Model.Footer)
+    </footer>
+    }
+</article>

Views/TitleWithLink.cshtml

 @using Orchard.Mvc.Html
 @using Orchard.ContentManagement
-<h1><a href="@Url.ItemDisplayUrl((IContent)Model.ContentPart)">@Model.Title</a></h1>
+<h1><a href="@Url.ItemDisplayUrl((IContent)Model.ContentPart)">@if (Model.Quantity != null && (int)Model.Quantity > 1) {<text>@(Model.Quantity)x </text>}@Model.Title</a></h1>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.