-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow a store owner to configure a pickup location
- Loading branch information
Showing
53 changed files
with
1,835 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
using System; | ||
using System.ComponentModel; | ||
using System.Globalization; | ||
using System.IO; | ||
using System.Text; | ||
using System.Xml.Serialization; | ||
|
||
namespace Nop.Core.Domain.Shipping | ||
{ | ||
public partial class PickupPoint | ||
{ | ||
/// <summary> | ||
/// Gets or sets an identifier | ||
/// </summary> | ||
public string Id { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets a name | ||
/// </summary> | ||
public string Name { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets a description | ||
/// </summary> | ||
public string Description { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets a system name of the pickup point provider | ||
/// </summary> | ||
public string ProviderSystemName { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets an address | ||
/// </summary> | ||
public string Address { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets a city | ||
/// </summary> | ||
public string City { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets a two-letter ISO country code | ||
/// </summary> | ||
public string CountryCode { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets a zip postal code | ||
/// </summary> | ||
public string ZipPostalCode { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets a latitude | ||
/// </summary> | ||
public decimal? Latitude { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets a longitude | ||
/// </summary> | ||
public decimal? Longitude { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets a fee for the pickup | ||
/// </summary> | ||
public decimal PickupFee { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets an oppening hours | ||
/// </summary> | ||
public string OpeningHours { get; set; } | ||
} | ||
|
||
public class PickupPointTypeConverter : TypeConverter | ||
{ | ||
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) | ||
{ | ||
if (sourceType == typeof(string)) | ||
return true; | ||
|
||
return base.CanConvertFrom(context, sourceType); | ||
} | ||
|
||
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) | ||
{ | ||
if (value is string) | ||
{ | ||
PickupPoint pickupPoint = null; | ||
var valueStr = value as string; | ||
if (!string.IsNullOrEmpty(valueStr)) | ||
{ | ||
try | ||
{ | ||
using (var tr = new StringReader(valueStr)) | ||
{ | ||
pickupPoint = (PickupPoint)(new XmlSerializer(typeof(PickupPoint)).Deserialize(tr)); | ||
} | ||
} | ||
catch { } | ||
} | ||
|
||
return pickupPoint; | ||
} | ||
|
||
return base.ConvertFrom(context, culture, value); | ||
} | ||
|
||
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) | ||
{ | ||
if (destinationType == typeof(string)) | ||
{ | ||
var pickupPoint = value as PickupPoint; | ||
if (pickupPoint != null) | ||
{ | ||
var sb = new StringBuilder(); | ||
using (var tw = new StringWriter(sb)) | ||
{ | ||
new XmlSerializer(typeof(PickupPoint)).Serialize(tw, value); | ||
|
||
return sb.ToString(); | ||
} | ||
} | ||
|
||
return string.Empty; | ||
} | ||
|
||
return base.ConvertTo(context, culture, value, destinationType); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.