Skip to content

Commit b9c990c

Browse files
Some bundle refinements
1 parent 981f479 commit b9c990c

17 files changed

Lines changed: 396 additions & 148 deletions

File tree

src/Libraries/SmartStore.Core/Domain/Orders/ShoppingCartSettings.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ public ShoppingCartSettings()
2020
MiniShoppingCartEnabled = true;
2121
ShowProductImagesInMiniShoppingCart = true;
2222
MiniShoppingCartProductNumber = 5;
23-
RoundPricesDuringCalculation = true;
23+
//RoundPricesDuringCalculation = false;
24+
ShowBasePrice = true;
25+
ShowDeliveryTimes = true;
26+
ShowShortDesc = true;
2427
}
2528

2629
/// <summary>

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,10 @@ public ActionResult Create(ProductModel model, bool continueEditing, string sele
764764
var product = model.ToEntity();
765765
product.CreatedOnUtc = DateTime.UtcNow;
766766
product.UpdatedOnUtc = DateTime.UtcNow;
767+
768+
if (product.ProductType == ProductType.BundledProduct)
769+
product.BundleTitleText = _localizationService.GetResource("Products.Bundle.BundleIncludes");
770+
767771
_productService.InsertProduct(product);
768772
//search engine name
769773
model.SeName = product.ValidateSeName(model.SeName, product.Name, true);

src/Presentation/SmartStore.Web/Content/theme.common.less

Lines changed: 167 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ nav ul, nav li {
358358
}
359359

360360
.data {
361-
width: 140px;
361+
width: 160px;
362362
overflow: hidden;
363363
.text-overflow();
364364
}
@@ -835,3 +835,169 @@ fieldset > legend {
835835
.order-summary-content .base-price.muted {
836836
font-size: .85em;
837837
}
838+
839+
840+
841+
/* PRODUCT BUNDLE ITEMS */
842+
.product-bundle {
843+
.bundle-item-border {
844+
border-top: 1px solid #ddd;
845+
}
846+
}
847+
848+
.product-bundle .bundle-item {
849+
margin-top: 10px;
850+
padding-top: 10px;
851+
852+
.bundle-item-attributes {
853+
margin-top: 3px;
854+
}
855+
856+
.bundle-item-image {
857+
float: left;
858+
margin-right: 16px;
859+
}
860+
861+
.bundle-item-body {
862+
display: table-cell;
863+
}
864+
865+
.bundle-item-name {
866+
font-weight: bold;
867+
}
868+
869+
.bundle-item-price {
870+
padding: 5px 0 5px 0;
871+
872+
.product-price-without-discount,
873+
.product-price-with-discount {
874+
font-size: 1.1em;
875+
}
876+
877+
.older-price {
878+
text-decoration: line-through;
879+
color: #aaa;
880+
}
881+
882+
.base-price {
883+
font-size: 0.85em;
884+
}
885+
}
886+
887+
.bundle-item-description {
888+
font-size: 12px;
889+
line-height: 18px;
890+
}
891+
892+
.bundle-item-attribute-info {
893+
font-size: 0.85em;
894+
line-height: 1.45em;
895+
}
896+
897+
.bundle-item-footer {
898+
clear: both;
899+
padding-top: 13px;
900+
}
901+
}
902+
903+
#AddToCart.bundled-product {
904+
border-top: none !important;
905+
}
906+
907+
.attribute-value-image {
908+
margin-right: 5px;
909+
vertical-align: middle;
910+
}
911+
.attributes .attribute-value-image-checkbox {
912+
float: left;
913+
}
914+
.attributes .image-has-value {
915+
margin-left: 28px;
916+
}
917+
918+
.mb-bundle-pictures .icon-plus {
919+
padding: 4px 10px 0 10px;
920+
}
921+
922+
.mb-bundle-pictures a,
923+
.mb-bundle-pictures i {
924+
float: left;
925+
}
926+
.mb-bundle-pictures img {
927+
max-width: 24px;
928+
max-height: 24px;
929+
}
930+
.bundle-item-overview-headline {
931+
.you-save {
932+
margin-right: 130px;
933+
}
934+
935+
.bundle-item-price,
936+
.bundle-item-price-single-units {
937+
white-space: nowrap;
938+
}
939+
940+
.bundle-item-price {
941+
color: @red;
942+
font-weight: bold;
943+
}
944+
945+
.bundle-item-price-single-units {
946+
text-decoration: line-through;
947+
color: #aaa;
948+
}
949+
950+
.add-to-cart-button {
951+
min-width: 120px !important;
952+
}
953+
954+
.add-to-cart {
955+
padding-top: 0 !important;
956+
float: right;
957+
}
958+
}
959+
.bundle-item-overview-headline .form-inline {
960+
text-align:right;
961+
}
962+
.bundle-item-overview .icon-plus {
963+
padding: 0 5px;
964+
}
965+
966+
.table-order-products {
967+
tbody.product-body:nth-child(odd) td {
968+
background-color: @tableBackgroundAccent;
969+
}
970+
971+
.product-body {
972+
border: none !important;
973+
}
974+
975+
.product-bundle-row td {
976+
border: none !important;
977+
}
978+
979+
.bundle-item-indent {
980+
padding-left: 70px;
981+
}
982+
983+
.product-body-bundle .bundle-item {
984+
.bundle-item-image {
985+
float: left;
986+
margin-right: 16px;
987+
}
988+
989+
.bundle-item-body {
990+
display: table-cell;
991+
}
992+
993+
.bundle-item-attribute-info {
994+
font-size: 0.85em;
995+
line-height: 1.45em;
996+
margin-top: 2px;
997+
}
998+
}
999+
}
1000+
1001+
.table-order-items {
1002+
border-bottom: 1px solid #ddd;
1003+
}

src/Presentation/SmartStore.Web/Controllers/CatalogController.cs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,6 @@ protected IList<ProductSpecificationModel> PrepareProductSpecificationModel(Prod
682682
});
683683
}
684684

685-
// codehint: sm-add (mc)
686685
private CategoryNavigationModel GetCategoryNavigationModel(int currentCategoryId, int currentProductId)
687686
{
688687
var customerRolesIds = _workContext.CurrentCustomer.CustomerRoles.Where(cr => cr.Active).Select(cr => cr.Id).ToList();
@@ -1344,14 +1343,17 @@ protected ProductDetailsModel PrepareProductDetailModel(ProductDetailsModel mode
13441343
if (preSelectedValueId == 0 && attributeFilter != null && attributeFilter.IsPreSelected)
13451344
preSelectedValueId = attributeFilter.AttributeValueId;
13461345

1347-
var pvaValueModel = new ProductDetailsModel.ProductVariantAttributeValueModel()
1348-
{
1349-
Id = pvaValue.Id,
1350-
Name = pvaValue.GetLocalized(x => x.Name),
1351-
Alias = pvaValue.Alias,
1352-
ColorSquaresRgb = pvaValue.ColorSquaresRgb, //used with "Color squares" attribute type
1353-
IsPreSelected = pvaValue.IsPreSelected
1354-
};
1346+
var linkedProduct = _productService.GetProductById(pvaValue.LinkedProductId);
1347+
1348+
var pvaValueModel = new ProductDetailsModel.ProductVariantAttributeValueModel();
1349+
pvaValueModel.Id = pvaValue.Id;
1350+
pvaValueModel.Name = pvaValue.GetLocalized(x => x.Name);
1351+
pvaValueModel.Alias = pvaValue.Alias;
1352+
pvaValueModel.ColorSquaresRgb = pvaValue.ColorSquaresRgb; //used with "Color squares" attribute type
1353+
pvaValueModel.IsPreSelected = pvaValue.IsPreSelected;
1354+
1355+
if (linkedProduct != null && linkedProduct.VisibleIndividually)
1356+
pvaValueModel.SeName = linkedProduct.GetSeName();
13551357

13561358
if (hasSelectedAttributes)
13571359
pvaValueModel.IsPreSelected = false; // explicitly selected always discards pre-selected by merchant

src/Presentation/SmartStore.Web/Controllers/ShoppingCartController.cs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,6 @@ protected MiniShoppingCartModel PrepareMiniShoppingCartModel()
862862
var model = new MiniShoppingCartModel()
863863
{
864864
ShowProductImages = _shoppingCartSettings.ShowProductImagesInMiniShoppingCart,
865-
// codehint: sm-add
866865
ThumbSize = _mediaSettings.MiniCartThumbPictureSize,
867866
//let's always display it
868867
DisplayShoppingCartButton = true,
@@ -873,7 +872,7 @@ protected MiniShoppingCartModel PrepareMiniShoppingCartModel()
873872
var cart = _workContext.CurrentCustomer.GetCartItems(ShoppingCartType.ShoppingCart, _storeContext.CurrentStore.Id);
874873

875874
model.TotalProducts = cart.GetTotalProducts();
876-
model.IgnoredProductsCount = Math.Max(0, cart.Count - _shoppingCartSettings.MiniShoppingCartProductNumber); // codehint: sm-add
875+
model.IgnoredProductsCount = Math.Max(0, cart.Count - _shoppingCartSettings.MiniShoppingCartProductNumber);
877876

878877
if (cart.Count > 0)
879878
{
@@ -917,7 +916,6 @@ protected MiniShoppingCartModel PrepareMiniShoppingCartModel()
917916
ProductName = sci.Item.Product.GetLocalized(x => x.Name),
918917
ProductSeName = sci.Item.Product.GetSeName(),
919918
Quantity = sci.Item.Quantity,
920-
// codehint: sm-edit
921919
AttributeInfo = _productAttributeFormatter.FormatAttributes(
922920
sci.Item.Product,
923921
sci.Item.AttributesXml,
@@ -928,6 +926,24 @@ protected MiniShoppingCartModel PrepareMiniShoppingCartModel()
928926
allowHyperlinks: false)
929927
};
930928

929+
if (sci.Item.Product.ProductType == ProductType.BundledProduct)
930+
{
931+
var bundleItems = _productService.GetBundleItems(sci.Item.Product.Id);
932+
foreach (var bundleItem in bundleItems)
933+
{
934+
var bundleItemModel = new MiniShoppingCartModel.ShoppingCartItemBundleItem();
935+
bundleItemModel.ProductName = bundleItem.Item.Product.GetLocalized(x => x.Name);
936+
var bundlePic = _pictureService.GetPicturesByProductId(bundleItem.Item.ProductId).FirstOrDefault();
937+
if(bundlePic != null)
938+
bundleItemModel.PictureUrl = _pictureService.GetPictureUrl(bundlePic.Id, 32);
939+
940+
bundleItemModel.ProductSeName = bundleItem.Item.Product.GetSeName();
941+
942+
if (!bundleItem.Item.HideThumbnail)
943+
cartItemModel.BundleItems.Add(bundleItemModel);
944+
}
945+
}
946+
931947
//unit prices
932948
if (sci.Item.Product.CallForPrice)
933949
{
@@ -2020,7 +2036,6 @@ public ActionResult FlyoutShoppingCart()
20202036
}
20212037

20222038
// Ajax
2023-
// codehint: sm-add
20242039
public ActionResult ShoppingCartSummary(bool isWishlist = false)
20252040
{
20262041
if (!_permissionService.Authorize(StandardPermissionProvider.EnableShoppingCart))

src/Presentation/SmartStore.Web/Infrastructure/Installation/DeDESeedData.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3572,6 +3572,7 @@ protected override void Alter(IList<Product> entities)
35723572
{
35733573
x.ShortDescription = "500GB PlayStation®3 Console, 2 × DUALSHOCK®3 wireless controller und Assassin's Creed® III.";
35743574
x.FullDescription = ps3FullDescription;
3575+
x.BundleTitleText = "Produktset besteht aus";
35753576
})
35763577
.Alter("PlayStation 4", x =>
35773578
{
@@ -3593,6 +3594,7 @@ protected override void Alter(IList<Product> entities)
35933594
{
35943595
x.ShortDescription = "PlayStation®4 Console, DUALSHOCK®4 wireless controller und PS4 Kamera.";
35953596
x.FullDescription = ps4FullDescription;
3597+
x.BundleTitleText = "Produktset besteht aus";
35963598
})
35973599
.Alter("Accessories for unlimited gaming experience", x =>
35983600
{

src/Presentation/SmartStore.Web/Models/Catalog/ProductDetailsModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ public ProductVariantAttributeModel()
270270
public partial class ProductVariantAttributeValueModel : EntityModelBase
271271
{
272272
public string Name { get; set; }
273+
public string SeName { get; set; }
273274
public string Alias { get; set; }
274275
public string ColorSquaresRgb { get; set; }
275276
public string PriceAdjustment { get; set; }

src/Presentation/SmartStore.Web/Models/ShoppingCart/MiniShoppingCartModel.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Collections.Generic;
2+
using SmartStore.Core.Domain.Catalog;
23
using SmartStore.Web.Framework.Mvc;
34
using SmartStore.Web.Models.Media;
45

@@ -19,7 +20,6 @@ public MiniShoppingCartModel()
1920
public bool CurrentCustomerIsGuest { get; set; }
2021
public bool AnonymousCheckoutAllowed { get; set; }
2122
public bool ShowProductImages { get; set; }
22-
// codehint: sm-add
2323
public int ThumbSize { get; set; }
2424
public int IgnoredProductsCount { get; set; }
2525

@@ -31,6 +31,7 @@ public partial class ShoppingCartItemModel : EntityModelBase
3131
public ShoppingCartItemModel()
3232
{
3333
Picture = new PictureModel();
34+
BundleItems = new List<ShoppingCartItemBundleItem>();
3435
}
3536

3637
public int ProductId { get; set; }
@@ -46,6 +47,16 @@ public ShoppingCartItemModel()
4647
public string AttributeInfo { get; set; }
4748

4849
public PictureModel Picture { get; set; }
50+
51+
public IList<ShoppingCartItemBundleItem> BundleItems { get; set; }
52+
53+
}
54+
55+
public partial class ShoppingCartItemBundleItem : ModelBase
56+
{
57+
public string PictureUrl { get; set; }
58+
public string ProductName { get; set; }
59+
public string ProductSeName { get; set; }
4960
}
5061

5162
#endregion

src/Presentation/SmartStore.Web/SmartStore.Web.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1997,6 +1997,7 @@
19971997
<Content Include="Views\Topic\TopicWidget.cshtml" />
19981998
<Content Include="Views\Shared\_ClientRes.cshtml" />
19991999
<Content Include="Views\Catalog\_ProductBundleItems.cshtml" />
2000+
<Content Include="Views\Catalog\_ProductBundleItemsAddToCart.cshtml" />
20002001
</ItemGroup>
20012002
<ItemGroup>
20022003
<Folder Include="Content\x-editable\css\" />

0 commit comments

Comments
 (0)