Skip to content

Commit fe918f1

Browse files
committed
Resolves #5 Implement 'free shipping threshold' for feed creation
1 parent 59355e0 commit fe918f1

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* #592 Add a second category description displayed beyond products on category page
1919
* #672 Option to automatically create mutual associations for cross sell products and related products
2020
* Promotion feeds now exports the preselected price (including price adjustments and overrides)
21+
* Implement 'free shipping threshold' for feed creation
2122

2223
### Improvements
2324
* Perf: product list rendering up to 10x (!) faster now (depends on page size and view mode)

src/Libraries/SmartStore.Data/Migrations/201504171629262_V22Final.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ public void MigrateLocaleResources(LocaleResourcesBuilder builder)
9090
builder.AddOrUpdate("Admin.Common.UnknownError",
9191
"An unknown error has occurred.",
9292
"Es ist ein unbekannter Fehler aufgetreten.");
93+
94+
builder.AddOrUpdate("Plugins.Feed.FreeShippingThreshold",
95+
"Free shipping threshold",
96+
"Kostenloser Versand ab",
97+
"Amount as from shipping is free.",
98+
"Betrag, ab dem keine Versandkosten anfallen.");
9399
}
94100
}
95101
}

src/Presentation/SmartStore.Web.Framework/Plugins/FeedPluginCore.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public PromotionFeedSettings()
3131
public bool ConvertNetToGrossPrices { get; set; }
3232
public int LanguageId { get; set; }
3333
public int PageSize { get; set; }
34+
public decimal? FreeShippingThreshold { get; set; }
3435
}
3536

3637

src/Presentation/SmartStore.Web.Framework/Plugins/FeedPluginHelper.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,14 @@ public string GetManufacturerPartNumber(Product product)
244244
return "";
245245
}
246246

247-
public string GetShippingCost(Product product, decimal? shippingCost = null)
247+
public string GetShippingCost(Product product, decimal productPrice, decimal? shippingCost = null)
248248
{
249249
if (product.IsFreeShipping)
250250
return "0";
251251

252+
if (BaseSettings.FreeShippingThreshold.HasValue && productPrice >= BaseSettings.FreeShippingThreshold.Value)
253+
return "0";
254+
252255
decimal cost = shippingCost ?? BaseSettings.ShippingCost;
253256

254257
if (decimal.Compare(cost, decimal.Zero) == 0)

0 commit comments

Comments
 (0)