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

HH #1477

Open
wants to merge 60 commits into
base: 3.x
Choose a base branch
from
Open

HH #1477

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
e6d084a
Merge branch '2.5.x'
Michael-Herzog Mar 4, 2016
c26a9ce
Fixed #856 Return 404 only when topic is rendered as widget
mgesing Mar 9, 2016
d609477
Fix 'occurred' typo
coliff Mar 31, 2016
d079cf1
Merge pull request #907 from coliff/patch-1
muratcakir Mar 31, 2016
e15dafa
Merge branch '2.x'
Michael-Herzog Jun 23, 2016
10e04a8
Merge branch '3.x'
Michael-Herzog May 15, 2017
4694055
Merge branch '3.x'
Michael-Herzog Jun 22, 2017
6b2501e
'Relaxed' MediaStorageData migration
muratcakir Jun 24, 2017
0d3ebde
Added area parameter to action urls else the view couldn't be used by…
Michael-Herzog Jul 3, 2017
163edec
Merge branch '3.x'
Michael-Herzog Jul 19, 2017
eb9c56a
Fixes wrong date in several backend grids
mgesing Jul 22, 2017
8e2d99f
Merge branch '3.x'
Michael-Herzog Sep 14, 2017
22d50f8
Merge branch '3.x'
muratcakir Sep 14, 2017
6e39498
Reverted developer test code
Michael-Herzog Sep 18, 2017
9b7bbdd
Fixes #1261: Moving product from cart to wish list or vice versa thro…
muratcakir Sep 15, 2017
4e3e3d9
Minor UI fix: Chrome 60+ shows scrollbars CKEditor parent container
muratcakir Sep 18, 2017
f2a5beb
Fixes price display bug for certain tax display types
Michael-Herzog Sep 20, 2017
b3dd5af
Merge branch '3.x'
Michael-Herzog Apr 20, 2018
7bbc82e
Fixes System.ArgumentException: Expression 'x => x.AccessKey.TrimSafe…
mgesing Apr 24, 2018
9d93000
Fixes relative product URLs in message templates
Michael-Herzog Apr 24, 2018
00ba240
In the context of message templates the BuildUrl method should be use…
Michael-Herzog Apr 24, 2018
c52ac95
Retry filesystem media migration per "/admin/picture/movefsmedia"
muratcakir Apr 27, 2018
a4578cd
Migration: take all same-named message templates into account
muratcakir Apr 27, 2018
81bd1e0
Messaging: OrderPlaced e-mail templates show main product image even …
muratcakir Apr 27, 2018
93d7994
MessageTemplateConverter: VirtualRootPath for templates can be passed…
muratcakir Apr 24, 2018
9aa97bc
Fixes tracking number in shipment details was not saved
mgesing Apr 30, 2018
e19d3b1
Fixes no bundle item thumbnail displayed in bundle summary if item is…
mgesing Apr 30, 2018
4d64942
Recaptcha: Should not validate against API if captcha is disabled
mgesing May 3, 2018
8cf0128
Fixed SSL certificate validation problem
Michael-Herzog May 4, 2018
687d327
Resolved SSL/TLS issues
muratcakir May 4, 2018
66499a2
Resolves #1442 Message factory should not throw an exception if a tem…
mgesing May 9, 2018
17d5ecf
MainPictureId migration: sort pictures by DisplayOrder, THEN by Id
muratcakir May 15, 2018
f8e4c53
Web API: Fixes "No NavigationLink factory was found for the navigatio…
mgesing May 16, 2018
a9e8807
Resolves #1449 IgnoreCharges of shipping methods is not working if a …
mgesing May 16, 2018
52fd72b
Resolves #1443, #1448. Fixes "The object does not support the propert…
mgesing May 17, 2018
1e8def9
Merge branch '3.x'
Michael-Herzog May 25, 2018
0227d72
Merge branch 'master' into 3.1.x
Michael-Herzog May 25, 2018
1735e48
GMC: Fixes export the product images if no attribute images are defined.
mgesing May 28, 2018
77d724f
In a multi-store environment, multiple topics with the same system na…
muratcakir May 30, 2018
af16f24
Fixes "ArgumentNullException: The value must not be NULL if a topic i…
mgesing Jun 1, 2018
81cf844
Corrected RouteUrl for privacy link when generated via settings
Michael-Herzog Jun 5, 2018
e26fe3c
Prevents cookie consent form from being submitted as form post
Michael-Herzog Jun 7, 2018
49289b8
More on "Prevents cookie consent form from being submitted as form post"
mgesing Jun 7, 2018
fdb5572
Reverts b08ed026da5d496faafd55fe2d1d33ebc36276da "Fixes the delivery …
mgesing Jun 8, 2018
9f9067a
Minor optimization
Michael-Herzog Jun 11, 2018
465b09e
Addendum: In a multi-store environment, multiple topics with the same…
Michael-Herzog Jun 12, 2018
c86eb7d
Fix #1464: MessageModelProvider creates incorrect URLs with duplicate…
muratcakir Jun 12, 2018
e0c842f
AmazonPay: Fixes in rare cases, payments were made without an order
mgesing Jun 15, 2018
a0e9408
Newsletter Subscription wasn't possible once a customer has already c…
Michael-Herzog Jun 19, 2018
8c88367
Fixes null reference exception when sending a gift card notification …
mgesing Jun 20, 2018
04e778e
Fixed EF eager loading issues in joined queries
muratcakir Jun 20, 2018
7e1bba3
Removed sample widget stuff from DevTools plugin
muratcakir Jun 20, 2018
c001db0
* Added cache stats to Admin > System Info
muratcakir Jun 26, 2018
e38ef05
Display percental tierprices according to tax settings
Michael-Herzog Jun 29, 2018
7f498ca
Amendement: Display percental tierprices according to tax settings
Michael-Herzog Jun 29, 2018
eab86cb
PayPal PLUS: additionally store access data in the database during ch…
mgesing Jun 29, 2018
3e97b0e
Fixes redirection of bots when several languages are active
Michael-Herzog Jul 4, 2018
4ea5350
Fixes switching the language always redirected to the home page if SE…
mgesing Jul 6, 2018
85dea0d
Fixes error that occurred when available domain ending were set
Michael-Herzog Jul 6, 2018
79fb620
Fixes file upload of a checkout attribute was not stored on cart page
mgesing Jul 6, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,21 @@
* Fixes the delivery time in the order notifications may differ from delivery time on the product detail page


## SmartStore.NET 3.1.5
### New Features

### Improvements
* Added double opt-in feature for newsletter subscriptions during checkout (confirm order)

### Bugfixes
* Migration: take all same-named message templates into account
* Messaging: OrderPlaced e-mail templates show main product image even when an attribute combination with a custom image has been selected
* Theming: fix broken product review voting
* Theming: added missing bottom space to .html-editor-content
* Theming: Language switcher is not displayed if no currency options are available



## SmartStore.NET 3.1.0

### Highlights
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;

namespace SmartStore.ComponentModel
{
public sealed class ReferenceEqualityComparer : IEqualityComparer, IEqualityComparer<object>
{
public static ReferenceEqualityComparer Default { get; } = new ReferenceEqualityComparer();

public new bool Equals(object x, object y) => ReferenceEquals(x, y);
public int GetHashCode(object obj) => RuntimeHelpers.GetHashCode(obj);
}
}
22 changes: 14 additions & 8 deletions src/Libraries/SmartStore.Core/Extensions/HttpExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public static class HttpExtensions
{
private const string HTTP_CLUSTER_VAR = "HTTP_CLUSTER_HTTPS";
private const string HTTP_XFWDPROTO_VAR = "HTTP_X_FORWARDED_PROTO";
private const string CACHE_REGION_NAME = "SmartStoreNET:";

/// <summary>
/// Gets a value which indicates whether the HTTP connection uses secure sockets (HTTPS protocol).
Expand Down Expand Up @@ -140,7 +141,7 @@ private static void CopyCookie(HttpWebRequest webRequest, HttpRequestBase source

public static string BuildScopedKey(this Cache cache, string key)
{
return key.HasValue() ? "SmartStoreNET:" + key : null;
return key.HasValue() ? CACHE_REGION_NAME + key : null;
}

public static T GetOrAdd<T>(this Cache cache, string key, Func<T> acquirer, TimeSpan? duration = null)
Expand Down Expand Up @@ -208,22 +209,27 @@ public static T GetItem<T>(this HttpContextBase httpContext, string key, Func<T>

public static void RemoveByPattern(this Cache cache, string pattern)
{
var regionName = "SmartStoreNET:";
var keys = cache.AllKeys(pattern);

pattern = pattern == "*" ? regionName : pattern;
foreach (var key in keys.ToArray())
{
cache.Remove(key);
}
}

public static string[] AllKeys(this Cache cache, string pattern)
{
pattern = pattern == "*" ? CACHE_REGION_NAME : pattern;

var keys = from entry in HttpRuntime.Cache.AsParallel().Cast<DictionaryEntry>()
let key = entry.Key.ToString()
where key.StartsWith(pattern, StringComparison.OrdinalIgnoreCase)
select key;

foreach (var key in keys.ToArray())
{
cache.Remove(key);
}
return keys.ToArray();
}

public static ControllerContext GetMasterControllerContext(this ControllerContext controllerContext)
public static ControllerContext GetMasterControllerContext(this ControllerContext controllerContext)
{
Guard.NotNull(controllerContext, nameof(controllerContext));

Expand Down
6 changes: 1 addition & 5 deletions src/Libraries/SmartStore.Core/Packaging/PackagingUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@

namespace SmartStore.Core.Packaging
{

public static class PackagingUtils
{

{
public static string GetExtensionPrefix(string extensionType)
{
return string.Format("SmartStore.{0}.", extensionType);
Expand All @@ -23,8 +21,6 @@ public static string BuildPackageId(string extensionName, string extensionType)
return GetExtensionPrefix(extensionType) + extensionName;
}



internal static bool IsTheme(this IPackage package)
{
return IsTheme(package.Id);
Expand Down
1 change: 1 addition & 0 deletions src/Libraries/SmartStore.Core/SmartStore.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@
<Compile Include="Collections\TopologicalSorter.cs" />
<Compile Include="Collections\TreeNodeBase.cs" />
<Compile Include="ComponentModel\MiniMapper.cs" />
<Compile Include="Collections\ReferenceEqualityComparer.cs" />
<Compile Include="ComponentModel\TypeConversion\BooleanConverter.cs" />
<Compile Include="ComponentModel\TypeConversion\DictionaryConverter.cs" />
<Compile Include="ComponentModel\TypeConversion\EmailAddressConverter.cs" />
Expand Down
97 changes: 97 additions & 0 deletions src/Libraries/SmartStore.Core/Utilities/CommonHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
using System.Web.Hosting;
using System.Web.Mvc;
using SmartStore.ComponentModel;
using System.Text;
using Newtonsoft.Json;
using System.Runtime.Serialization.Formatters.Binary;

namespace SmartStore.Utilities
{
Expand Down Expand Up @@ -265,5 +268,99 @@ public static bool IsTruthy(object value)

return true;
}

public static long GetObjectSizeInBytes(object obj, HashSet<object> instanceLookup = null)
{
if (obj == null)
return 0;

var type = obj.GetType();
var genericArguments = type.GetGenericArguments();

long size = 0;

if (obj is string str)
{
size = Encoding.Default.GetByteCount(str);
}
else if (obj is StringBuilder sb)
{
size = Encoding.Default.GetByteCount(sb.ToString());
}
else if (type.IsEnum)
{
size = System.Runtime.InteropServices.Marshal.SizeOf(Enum.GetUnderlyingType(type));
}
else if (type.IsPredefinedSimpleType() || type.IsPredefinedGenericType())
{
//size = System.Runtime.InteropServices.Marshal.SizeOf(Nullable.GetUnderlyingType(type) ?? type); // crashes often
size = 8; // mean/average
}
else if (obj is Stream stream)
{
size = stream.Length;
}
else if (obj is IDictionary dic)
{
foreach (var item in dic.Values)
{
size += GetObjectSizeInBytes(item, instanceLookup);
}
}
else if (obj is IEnumerable e)
{
foreach (var item in e)
{
size += GetObjectSizeInBytes(item, instanceLookup);
}
}
else
{
if (instanceLookup == null)
{
instanceLookup = new HashSet<object>(ReferenceEqualityComparer.Default);
}

if (!type.IsValueType && instanceLookup.Contains(obj))
{
return 0;
}

instanceLookup.Add(obj);

var serialized = false;

if (type.IsSerializable && genericArguments.All(x => x.IsSerializable))
{
try
{
using (var s = new MemoryStream())
{
var formatter = new BinaryFormatter();
formatter.Serialize(s, obj);
size = s.Length;

serialized = true;
}
}
catch { }
}

if (!serialized)
{
// Serialization failed or is not supported: make JSON.
var json = JsonConvert.SerializeObject(obj, new JsonSerializerSettings
{
DateFormatHandling = DateFormatHandling.IsoDateFormat,
DateTimeZoneHandling = DateTimeZoneHandling.Utc,
MaxDepth = 10,
ReferenceLoopHandling = ReferenceLoopHandling.Ignore
});
size = Encoding.Default.GetByteCount(json);
}
}

return size;
}
}
}
2 changes: 1 addition & 1 deletion src/Libraries/SmartStore.Core/WebHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ public static string MakeAllUrlsAbsolute(string html, string protocol, string ho
Guard.NotEmpty(protocol, nameof(protocol));
Guard.NotEmpty(host, nameof(host));

string baseUrl = string.Format("{0}://{1}", protocol, host.TrimEnd('/'));
string baseUrl = protocol.EnsureEndsWith("://") + host.TrimEnd('/');

MatchEvaluator evaluator = (match) =>
{
Expand Down
4 changes: 1 addition & 3 deletions src/Libraries/SmartStore.Data/Caching/CachingCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,7 @@ public async override Task<object> ExecuteScalarAsync(CancellationToken cancella

var key = CreateKey();

object value;

if (_cacheTransactionInterceptor.GetItem(Transaction, key, out value))
if (_cacheTransactionInterceptor.GetItem(Transaction, key, out var value))
{
return value;
}
Expand Down
1 change: 0 additions & 1 deletion src/Libraries/SmartStore.Data/Caching/DbCachingPolicy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public partial class DbCachingPolicy
typeof(ShippingMethod).Name,
typeof(StateProvince).Name,
typeof(Store).Name,
typeof(StoreMapping).Name,
typeof(TaxCategory).Name,
typeof(ThemeVariable).Name,
typeof(Topic).Name
Expand Down
7 changes: 3 additions & 4 deletions src/Libraries/SmartStore.Data/Caching/EfDbCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using SmartStore.Core.Caching;
using SmartStore.Core.Domain.Logging;
using SmartStore.Core.Domain.Messages;
Expand All @@ -23,7 +22,7 @@ public partial class EfDbCache : IDbCache
typeof(QueuedEmail).Name
};

private const string KEYPREFIX = "efcache:*";
private const string KEYPREFIX = "efcache:";
private readonly object _lock = new object();

private bool _enabled;
Expand Down Expand Up @@ -248,8 +247,8 @@ public virtual DbCacheEntry Put(string key, object value, IEnumerable<string> de

public void Clear()
{
_cache.RemoveByPattern(KEYPREFIX);
_requestCache.Value.RemoveByPattern(KEYPREFIX);
_cache.RemoveByPattern(KEYPREFIX + "*");
_requestCache.Value.RemoveByPattern(KEYPREFIX + "*");
}

public virtual void InvalidateSets(IEnumerable<string> entitySets)
Expand Down
9 changes: 7 additions & 2 deletions src/Libraries/SmartStore.Services/Catalog/CategoryService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity;
using SmartStore.Collections;
using SmartStore.Core;
using SmartStore.Core.Caching;
Expand Down Expand Up @@ -537,14 +538,16 @@ public virtual IList<ProductCategory> GetProductCategoriesByProductId(int produc
string key = string.Format(PRODUCTCATEGORIES_ALLBYPRODUCTID_KEY, showHidden, productId, _workContext.CurrentCustomer.Id, _storeContext.CurrentStore.Id);
return _requestCache.Get(key, () =>
{
var query = from pc in _productCategoryRepository.Table.Expand(x => x.Category)
var query = from pc in _productCategoryRepository.Table
join c in _categoryRepository.Table on pc.CategoryId equals c.Id
where pc.ProductId == productId &&
!c.Deleted &&
(showHidden || c.Published)
orderby pc.DisplayOrder
select pc;

query = query.Include(x => x.Category);

var allProductCategories = query.ToList();
var result = new List<ProductCategory>();
if (!showHidden)
Expand All @@ -571,12 +574,14 @@ orderby pc.DisplayOrder
Guard.NotNull(productIds, nameof(productIds));

var query =
from pc in _productCategoryRepository.TableUntracked.Expand(x => x.Category).Expand(x => x.Category.Picture)
from pc in _productCategoryRepository.TableUntracked
join c in _categoryRepository.Table on pc.CategoryId equals c.Id
where productIds.Contains(pc.ProductId) && !c.Deleted && (showHidden || c.Published)
orderby pc.DisplayOrder
select pc;

query = query.Include(x => x.Category.Picture);

if (hasDiscountsApplied.HasValue)
{
query = query.Where(x => x.Category.HasDiscountsApplied == hasDiscountsApplied);
Expand Down
16 changes: 9 additions & 7 deletions src/Libraries/SmartStore.Services/Catalog/ManufacturerService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Data.Entity;
using SmartStore.Collections;
using SmartStore.Core;
using SmartStore.Core.Caching;
Expand Down Expand Up @@ -216,15 +217,14 @@ public virtual IList<ProductManufacturer> GetProductManufacturersByProductId(int
string key = string.Format(PRODUCTMANUFACTURERS_ALLBYPRODUCTID_KEY, showHidden, productId, _workContext.CurrentCustomer.Id, _storeContext.CurrentStore.Id);
return _requestCache.Get(key, () =>
{
var query = from pm in _productManufacturerRepository.Table.Expand(x => x.Manufacturer.Picture)
join m in _manufacturerRepository.Table on
pm.ManufacturerId equals m.Id
where pm.ProductId == productId &&
!m.Deleted &&
(showHidden || m.Published)
var query = from pm in _productManufacturerRepository.Table
join m in _manufacturerRepository.Table on pm.ManufacturerId equals m.Id
where pm.ProductId == productId && !m.Deleted && (showHidden || m.Published)
orderby pm.DisplayOrder
select pm;

query = query.Include(x => x.Manufacturer.Picture);

if (!showHidden)
{
if (!QuerySettings.IgnoreMultiStore)
Expand Down Expand Up @@ -274,11 +274,13 @@ orderby mGroup.Key
Guard.NotNull(productIds, nameof(productIds));

var query =
from pm in _productManufacturerRepository.TableUntracked.Expand(x => x.Manufacturer).Expand(x => x.Manufacturer.Picture)
from pm in _productManufacturerRepository.TableUntracked
//join m in _manufacturerRepository.TableUntracked on pm.ManufacturerId equals m.Id // Eager loading does not work with this join
where !pm.Manufacturer.Deleted && productIds.Contains(pm.ProductId)
select pm;

query = query.Include(x => x.Manufacturer.Picture);

var map = query
.OrderBy(x => x.ProductId)
.ThenBy(x => x.DisplayOrder)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,6 @@ public virtual decimal GetFinalPrice(Product product, Customer customer, bool in
//tier prices
if (product.HasTierPrices && !bundleItem.IsValid() && includeDiscounts)
{

decimal? tierPrice = GetMinimumTierPrice(product, customer, quantity, context);
Discount appliedDiscountTest = null;
decimal discountAmountTest = GetDiscountAmount(product, customer, additionalCharge, quantity, out appliedDiscountTest, bundleItem);
Expand Down